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 ESPRESSO_THOLE
32#include "Particle.hpp"
38
39#include <utils/Vector.hpp>
40
41#include <cmath>
42
43/** Calculate Thole force */
44inline Utils::Vector3d
45thole_pair_force(Particle const &p1, Particle const &p2,
46 IA_parameters const &ia_params, Utils::Vector3d const &d,
47 double dist, BondedInteractionsMap const &bonded_ias,
49 auto const thole_q1q2 = ia_params.thole.q1q2;
50 auto const thole_s = ia_params.thole.scaling_coeff;
51
52 if (thole_s != 0. and thole_q1q2 != 0. and kernel != nullptr and
53 not bonded_ias.pair_bond_exists_between<ThermalizedBond>(p1, p2)) {
54 // Calc damping function (see @cite thole81a)
55 // S(r) = 1.0 - (1.0 + thole_s*r/2.0) * exp(-thole_s*r);
56 // Calc F = - d/dr ( S(r)*q1q2/r) =
57 // -(1/2)*(-2+(r^2*s^2+2*r*s+2)*exp(-s*r))*q1q2/r^2 Everything before
58 // q1q2/r^2 can be used as a factor for the Coulomb::central_force method
59 auto const sr = thole_s * dist;
60 auto const dS_r = 0.5 * (2.0 - (exp(-sr) * (sr * (sr + 2.0) + 2.0)));
61 return (*kernel)(thole_q1q2 * (-1. + dS_r), d, dist);
62 }
63 return {};
64}
65
66/** Calculate Thole energy */
67inline double
68thole_pair_energy(Particle const &p1, Particle const &p2,
69 IA_parameters const &ia_params, Utils::Vector3d const &d,
70 double dist, BondedInteractionsMap const &bonded_ias,
71 Coulomb::Solver const &coulomb,
73
74 auto const thole_s = ia_params.thole.scaling_coeff;
75 auto const thole_q1q2 = ia_params.thole.q1q2;
76
77 if (thole_s != 0. and thole_q1q2 != 0. and kernel != nullptr and
78 dist < coulomb.cutoff() and
79 not bonded_ias.pair_bond_exists_between<ThermalizedBond>(p1, p2)) {
80 auto const sd = thole_s * dist;
81 auto const S_r = 1.0 - (1.0 + sd / 2.0) * exp(-sd);
82 // Subtract p3m short-range energy and add thole energy
83 return (*kernel)(p1.pos(), p2.pos(), thole_q1q2 * (-1.0 + S_r), d, dist);
84 }
85 return 0.0;
86}
87#endif // ESPRESSO_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.
Various procedures concerning interactions between particles.
Solver::ShortRangeEnergyKernel kernel_type
Solver::ShortRangeForceKernel kernel_type
double cutoff() const
Definition coulomb.cpp:163
Parameters for non-bonded interactions.
Struct holding all information for one particle.
Definition Particle.hpp:450
auto const & pos() const
Definition Particle.hpp:486
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:45
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::Solver const &coulomb, Coulomb::ShortRangeEnergyKernel::kernel_type const *kernel)
Calculate Thole energy.
Definition thole.hpp:68