ESPResSo
Extensible Simulation Package for Research on Soft Matter Systems
Loading...
Searching...
No Matches
ljcos.cpp
Go to the documentation of this file.
1
/*
2
* Copyright (C) 2010-2022 The ESPResSo project
3
* Copyright (C) 2002,2003,2004,2005,2006,2007,2008,2009,2010
4
* Max-Planck-Institute for Polymer Research, Theory Group
5
*
6
* This file is part of ESPResSo.
7
*
8
* ESPResSo is free software: you can redistribute it and/or modify
9
* it under the terms of the GNU General Public License as published by
10
* the Free Software Foundation, either version 3 of the License, or
11
* (at your option) any later version.
12
*
13
* ESPResSo is distributed in the hope that it will be useful,
14
* but WITHOUT ANY WARRANTY; without even the implied warranty of
15
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16
* GNU General Public License for more details.
17
*
18
* You should have received a copy of the GNU General Public License
19
* along with this program. If not, see <http://www.gnu.org/licenses/>.
20
*/
21
/** \file
22
*
23
* Implementation of \ref ljcos.hpp
24
*/
25
#include "
ljcos.hpp
"
26
27
#ifdef LJCOS
28
#include "
nonbonded_interaction_data.hpp
"
29
30
#include <
utils/math/sqr.hpp
>
31
32
#include <numbers>
33
#include <stdexcept>
34
35
LJcos_Parameters::LJcos_Parameters
(
double
epsilon,
double
sigma,
double
cutoff,
36
double
offset)
37
: eps{epsilon}, sig{sigma}, cut{cutoff}, offset{offset} {
38
if
(epsilon < 0.) {
39
throw
std::domain_error(
"LJcos parameter 'epsilon' has to be >= 0"
);
40
}
41
if
(sigma < 0.) {
42
throw
std::domain_error(
"LJcos parameter 'sigma' has to be >= 0"
);
43
}
44
if
(cutoff < 0.) {
45
throw
std::domain_error(
"LJcos parameter 'cutoff' has to be >= 0"
);
46
}
47
48
constexpr
auto
cbrt2 = 1.25992104989487316476721060727822835057025;
49
auto
const
facsq = cbrt2 *
Utils::sqr
(
sig
);
50
51
rmin
= sqrt(cbrt2) *
sig
;
52
alfa
= std::numbers::pi / (
Utils::sqr
(
cut
) - facsq);
53
beta
= std::numbers::pi * (1. - (1. / (
Utils::sqr
(
cut
) / facsq - 1.)));
54
}
55
56
#endif
// LJCOS
ljcos.hpp
Routines to calculate the Lennard-Jones+cosine potential between particle pairs.
Utils::sqr
DEVICE_QUALIFIER constexpr T sqr(T x)
Calculates the SQuaRe of x.
Definition
sqr.hpp:28
nonbonded_interaction_data.hpp
Various procedures concerning interactions between particles.
sqr.hpp
LJcos_Parameters::cut
double cut
Definition
nonbonded_interaction_data.hpp:209
LJcos_Parameters::beta
double beta
Definition
nonbonded_interaction_data.hpp:212
LJcos_Parameters::sig
double sig
Definition
nonbonded_interaction_data.hpp:208
LJcos_Parameters::LJcos_Parameters
LJcos_Parameters()=default
LJcos_Parameters::rmin
double rmin
Definition
nonbonded_interaction_data.hpp:213
LJcos_Parameters::alfa
double alfa
Definition
nonbonded_interaction_data.hpp:211
src
core
nonbonded_interactions
ljcos.cpp
Generated on Fri Nov 22 2024 02:13:54 for ESPResSo by
1.9.8