ESPResSo
Extensible Simulation Package for Research on Soft Matter Systems
Loading...
Searching...
No Matches
smooth_step.hpp
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#ifndef SMOOTHSTEP_H
22#define SMOOTHSTEP_H
23
24/** \file
25 * Routines to calculate the smooth step potential between particle pairs.
26 *
27 * Implementation in \ref smooth_step.cpp.
28 */
29
30#include "config/config.hpp"
31
32#ifdef SMOOTH_STEP
33
35
36#include <utils/Vector.hpp>
37#include <utils/math/sqr.hpp>
38
39#include <cmath>
40
41/** Calculate smooth step force factor */
42inline double SmSt_pair_force_factor(IA_parameters const &ia_params,
43 double dist) {
44 if (dist >= ia_params.smooth_step.cut) {
45 return 0.0;
46 }
47
48 auto const frac = ia_params.smooth_step.d / dist;
49 auto const fracP = pow(frac, ia_params.smooth_step.n);
50 auto const er =
51 exp(2. * ia_params.smooth_step.k0 * (dist - ia_params.smooth_step.sig));
52 return (ia_params.smooth_step.n * fracP +
53 2. * ia_params.smooth_step.eps * ia_params.smooth_step.k0 * dist *
54 er / Utils::sqr(1.0 + er)) /
55 Utils::sqr(dist);
56}
57
58/** Calculate smooth step energy */
59inline double SmSt_pair_energy(IA_parameters const &ia_params, double dist) {
60 if (dist >= ia_params.smooth_step.cut) {
61 return 0.0;
62 }
63
64 auto const frac = ia_params.smooth_step.d / dist;
65 auto const fracP = pow(frac, ia_params.smooth_step.n);
66 auto const er =
67 exp(2. * ia_params.smooth_step.k0 * (dist - ia_params.smooth_step.sig));
68 return fracP + ia_params.smooth_step.eps / (1.0 + er);
69}
70
71#endif /* ifdef SMOOTH_STEP */
72#endif
Vector implementation and trait types for boost qvm interoperability.
This file contains the defaults for ESPResSo.
DEVICE_QUALIFIER constexpr T sqr(T x)
Calculates the SQuaRe of x.
Definition sqr.hpp:26
Various procedures concerning interactions between particles.
double SmSt_pair_force_factor(IA_parameters const &ia_params, double dist)
Calculate smooth step force factor.
double SmSt_pair_energy(IA_parameters const &ia_params, double dist)
Calculate smooth step energy.
Parameters for non-bonded interactions.
SmoothStep_Parameters smooth_step