ESPResSo
Extensible Simulation Package for Research on Soft Matter Systems
Loading...
Searching...
No Matches
thole.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
22#pragma once
23
24/** \file
25 * Routines to calculate the Thole damping potential between particle pairs.
26 * See @cite thole81a.
27 */
28
29#include "config/config.hpp"
30
31#ifdef THOLE
32#include "Particle.hpp"
37
38#include <utils/Vector.hpp>
39
40#include <cmath>
41
42/** Calculate Thole force */
43inline Utils::Vector3d
44thole_pair_force(Particle const &p1, Particle const &p2,
45 IA_parameters const &ia_params, Utils::Vector3d const &d,
46 double dist, BondedInteractionsMap const &bonded_ias,
48 auto const thole_q1q2 = ia_params.thole.q1q2;
49 auto const thole_s = ia_params.thole.scaling_coeff;
50
51 if (thole_s != 0. and thole_q1q2 != 0. and kernel != nullptr and
52 not bonded_ias.pair_bond_exists_between<ThermalizedBond>(p1, p2)) {
53 // Calc damping function (see @cite thole81a)
54 // S(r) = 1.0 - (1.0 + thole_s*r/2.0) * exp(-thole_s*r);
55 // Calc F = - d/dr ( S(r)*q1q2/r) =
56 // -(1/2)*(-2+(r^2*s^2+2*r*s+2)*exp(-s*r))*q1q2/r^2 Everything before
57 // q1q2/r^2 can be used as a factor for the Coulomb::central_force method
58 auto const sr = thole_s * dist;
59 auto const dS_r = 0.5 * (2.0 - (exp(-sr) * (sr * (sr + 2.0) + 2.0)));
60 return (*kernel)(thole_q1q2 * (-1. + dS_r), d, dist);
61 }
62 return {};
63}
64
65/** Calculate Thole energy */
66inline double
67thole_pair_energy(Particle const &p1, Particle const &p2,
68 IA_parameters const &ia_params, Utils::Vector3d const &d,
69 double dist, BondedInteractionsMap const &bonded_ias,
71
72 auto const thole_s = ia_params.thole.scaling_coeff;
73 auto const thole_q1q2 = ia_params.thole.q1q2;
74
75 if (thole_s != 0. and thole_q1q2 != 0. and kernel != nullptr and
76 dist < Coulomb::get_coulomb().cutoff() and
77 not bonded_ias.pair_bond_exists_between<ThermalizedBond>(p1, p2)) {
78 auto const sd = thole_s * dist;
79 auto const S_r = 1.0 - (1.0 + sd / 2.0) * exp(-sd);
80 // Subtract p3m short-range energy and add thole energy
81 return (*kernel)(p1, p2, thole_q1q2 * (-1.0 + S_r), d, dist);
82 }
83 return 0.0;
84}
85#endif // THOLE
Vector implementation and trait types for boost qvm interoperability.
Data structures for bonded interactions.
container for bonded interactions.
bool pair_bond_exists_between(Particle const &p1, Particle const &p2) const
Checks both particles for a specific bond, even on ghost particles.
This file contains the defaults for ESPResSo.
Solver const & get_coulomb()
Definition coulomb.cpp:66
Various procedures concerning interactions between particles.
Solver::ShortRangeEnergyKernel kernel_type
Solver::ShortRangeForceKernel kernel_type
Parameters for non-bonded interactions.
Struct holding all information for one particle.
Definition Particle.hpp:395
Parameters for Thermalized bond.
Utils::Vector3d thole_pair_force(Particle const &p1, Particle const &p2, IA_parameters const &ia_params, Utils::Vector3d const &d, double dist, BondedInteractionsMap const &bonded_ias, Coulomb::ShortRangeForceKernel::kernel_type const *kernel)
Calculate Thole force.
Definition thole.hpp:44
double thole_pair_energy(Particle const &p1, Particle const &p2, IA_parameters const &ia_params, Utils::Vector3d const &d, double dist, BondedInteractionsMap const &bonded_ias, Coulomb::ShortRangeEnergyKernel::kernel_type const *kernel)
Calculate Thole energy.
Definition thole.hpp:67