OpenMD 3.1
Molecular Dynamics in the Open
Loading...
Searching...
No Matches
NonBondedInteraction.hpp
1/*
2 * Copyright (c) 2004-present, The University of Notre Dame. All rights
3 * reserved.
4 *
5 * Redistribution and use in source and binary forms, with or without
6 * modification, are permitted provided that the following conditions are met:
7 *
8 * 1. Redistributions of source code must retain the above copyright notice,
9 * this list of conditions and the following disclaimer.
10 *
11 * 2. Redistributions in binary form must reproduce the above copyright notice,
12 * this list of conditions and the following disclaimer in the documentation
13 * and/or other materials provided with the distribution.
14 *
15 * 3. Neither the name of the copyright holder nor the names of its
16 * contributors may be used to endorse or promote products derived from
17 * this software without specific prior written permission.
18 *
19 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
20 * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
21 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
22 * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE
23 * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
24 * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
25 * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
26 * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
27 * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
28 * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
29 * POSSIBILITY OF SUCH DAMAGE.
30 *
31 * SUPPORT OPEN SCIENCE! If you use OpenMD or its source code in your
32 * research, please cite the appropriate papers when you publish your
33 * work. Good starting points are:
34 *
35 * [1] Meineke, et al., J. Comp. Chem. 26, 252-271 (2005).
36 * [2] Fennell & Gezelter, J. Chem. Phys. 124, 234104 (2006).
37 * [3] Sun, Lin & Gezelter, J. Chem. Phys. 128, 234107 (2008).
38 * [4] Vardeman, Stocker & Gezelter, J. Chem. Theory Comput. 7, 834 (2011).
39 * [5] Kuang & Gezelter, Mol. Phys., 110, 691-701 (2012).
40 * [6] Lamichhane, Gezelter & Newman, J. Chem. Phys. 141, 134109 (2014).
41 * [7] Lamichhane, Newman & Gezelter, J. Chem. Phys. 141, 134110 (2014).
42 * [8] Bhattarai, Newman & Gezelter, Phys. Rev. B 99, 094106 (2019).
43 */
44
45#ifndef NONBONDED_NONBONDEDINTERACTION_HPP
46#define NONBONDED_NONBONDEDINTERACTION_HPP
47
48#include <memory>
49
51#include "types/AtomType.hpp"
52
53using namespace std;
54namespace OpenMD {
55 /**
56 * The InteractionFamily enum.
57 *
58 * This is used to sort different types of non-bonded interaction
59 * and to prevent multiple interactions in the same family from
60 * being applied to any given pair of atom types.
61 */
63 NO_FAMILY = 0, /**< No family defined */
65 1, /**< Long-range dispersion and short-range pauli repulsion */
66 ELECTROSTATIC_FAMILY = 2, /**< Coulombic and point-multipole interactions */
68 3, /**< Transition metal interactions involving electron density */
70 4, /**< Transition metal interactions involving pair potentials */
71 HYDROGENBONDING_FAMILY = 5, /**< Short-range directional interactions */
72 BONDED_FAMILY = 6, /**< directly bonded 1-2, 1-3, or 1-4 interactions */
73 N_INTERACTION_FAMILIES = 7
74 };
75
76 /**
77 * Boolean flags for the iHash_ and sHash_ data structures. These
78 * are used to greatly increase the speed of looking up the
79 * low-level interaction for any given pair:
80 */
81 const static int ELECTROSTATIC_INTERACTION = (1 << 0);
82 const static int LJ_INTERACTION = (1 << 1);
83 const static int EAM_INTERACTION = (1 << 2);
84 const static int SC_INTERACTION = (1 << 3);
85 const static int STICKY_INTERACTION = (1 << 4);
86 const static int GB_INTERACTION = (1 << 5);
87 const static int MORSE_INTERACTION = (1 << 6);
88 const static int REPULSIVEPOWER_INTERACTION = (1 << 7);
89 const static int MAW_INTERACTION = (1 << 8);
90 const static int MIE_INTERACTION = (1 << 9);
91 const static int BUCKINGHAM_INTERACTION = (1 << 10);
92 const static int INVERSEPOWERSERIES_INTERACTION = (1 << 11);
93
95
96 /**
97 * The InteractionData struct.
98 *
99 * This is used to pass data and references to data to specific non-bonded
100 * interactions for force calculations. Not all of the struct
101 * members are utilized by any given interaction.
102 */
104 int atid1 = -1; /**< atomType ident for atom 1 */
105 int atid2 = -1; /**< atomType ident for atom 2 */
106 Vector3d d {}; /**< interatomic vector (already wrapped into box) */
107 RealType rij {}; /**< interatomic separation */
108 RealType r2 {}; /**< square of rij */
109 RealType rcut {}; /**< cutoff radius for this interaction */
110 bool shiftedPot {false}; /**< shift the potential up inside the cutoff? */
112 false}; /**< shifted forces smoothly inside the cutoff? */
113 RealType sw {}; /**< switching function value at rij */
114 int topoDist {}; /**< topological distance between atoms */
115 bool excluded {
116 false}; /**< is this excluded from direct pairwise interactions? (some
117 indirect interactions may still apply) */
119 false}; /**< are these atoms specified to be in the same region? */
120 RealType vdwMult {}; /**< multiplier for van der Waals interactions */
121 RealType electroMult {}; /**< multiplier for electrostatic interactions */
122 potVec pot {}; /**< total potential */
123 potVec excludedPot {}; /**< potential energy excluded from the overall
124 calculation */
125 RealType vpair {}; /**< pair potential */
126 bool doParticlePot {false}; /**< should we bother with the particle pot? */
128 false}; /**< should we bother with the electric field? */
130 false}; /**< should we bother with electrostatic site potential */
131 bool isSelected {false}; /**< one of the particles has been selected for
132 selection potential */
133 potVec selePot {}; /**< potential energies of the selected sites */
134 RealType particlePot1 {}; /**< particle potential for atom1 */
135 RealType particlePot2 {}; /**< particle potential for atom2 */
136 Vector3d f1 {}; /**< force between the two atoms */
137 RotMat3x3d A1 {}; /**< rotation matrix of first atom */
138 RotMat3x3d A2 {}; /**< rotation matrix of second atom */
139 Vector3d D_1 {}; /**< dipole vector of first atom */
140 Vector3d D_2 {}; /**< dipole vector of first atom */
141 Mat3x3d Q_1 {}; /**< quadrupole tensor of first atom */
142 Mat3x3d Q_2 {}; /**< quadrupole tensor of first atom */
143 Vector3d t1 {}; /**< torque on first atom */
144 Vector3d t2 {}; /**< torque on second atom */
145 RealType rho1 {}; /**< total electron density at first atom */
146 RealType rho2 {}; /**< total electron density at second atom */
147 RealType frho1 {}; /**< density functional at first atom */
148 RealType frho2 {}; /**< density functional at second atom */
149 RealType dfrho1 {}; /**< derivative of functional for atom 1 */
150 RealType dfrho2 {}; /**< derivative of functional for atom 2 */
151 RealType flucQ1 {}; /**< fluctuating charge on atom1 */
152 RealType flucQ2 {}; /**< fluctuating charge on atom2 */
153 RealType dVdFQ1 {}; /**< fluctuating charge force on atom1 */
154 RealType dVdFQ2 {}; /**< fluctuating charge force on atom2 */
155 Vector3d eField1 {}; /**< electric field on first atom */
156 Vector3d eField2 {}; /**< electric field on second atom */
157 RealType skippedCharge1 {}; /**< charge skipped on atom1 in pairwise
158 interaction loop with atom2 */
159 RealType skippedCharge2 {}; /**< charge skipped on atom2 in pairwise
160 interaction loop with atom1 */
161 RealType sPot1 {}; /**< site potential on first atom */
162 RealType sPot2 {}; /**< site potential on second atom */
163 };
164
165 /**
166 * The SelfData struct.
167 *
168 * This is used to pass data for the self-interaction or
169 * derived information on a single atom after a pass through all
170 * other interactions. This is used by electrostatic methods that
171 * have long-range corrections involving interactions with a medium
172 * or a boundary and also by specific metal interactions for
173 * electron density functional calculations. Not all of the struct
174 * members are utilized by any given self interaction.
175 */
176 struct SelfData {
177 int atid {}; /**< atomType ident for the atom */
178 RealType
179 skippedCharge {}; /**< charge skipped in pairwise interaction loop */
180 potVec selfPot {}; /**< total potential (including embedding energy) */
181 bool doParticlePot {false}; /**< should we bother with the particle pot? */
182 RealType
183 particlePot {}; /**< contribution to potential from this particle */
184 RealType rho {}; /**< electron density */
185 RealType frho {}; /**< value of density functional for atom */
186 RealType dfrhodrho {}; /**< derivative of density functional for atom */
187 RealType flucQ {}; /**< current value of atom's fluctuating charge */
188 RealType flucQfrc {}; /**< fluctuating charge derivative */
190 false}; /**< this site has been selected for selection potential */
191 potVec selePot {}; /**< potential energy of the selected site */
192 };
193
194 /**
195 * The basic interface for non-bonded interactions.
196 */
198 public:
200 virtual ~NonBondedInteraction() {}
201 virtual void calcForce(InteractionData& idat) = 0;
202 virtual InteractionFamily getFamily() = 0;
203 virtual int getHash() = 0;
204 virtual RealType getSuggestedCutoffRadius(
205 pair<AtomType*, AtomType*> atypes) = 0;
206 virtual string getName() = 0;
207 };
208
209 using NonBondedInteractionPtr = std::shared_ptr<NonBondedInteraction>;
210
211 /**
212 * The basic interface for van der Waals interactions.
213 */
215 public:
217 virtual ~VanDerWaalsInteraction() {}
218 virtual InteractionFamily getFamily() { return VANDERWAALS_FAMILY; }
219 };
220
221 /**
222 * The basic interface for electrostatic interactions.
223 */
225 public:
227 virtual ~ElectrostaticInteraction() {}
228 virtual void calcSelfCorrection(SelfData& sdat) = 0;
229 virtual InteractionFamily getFamily() { return ELECTROSTATIC_FAMILY; }
230 virtual int getHash() { return ELECTROSTATIC_INTERACTION; }
231 };
232
233 /**
234 * The basic interface for metallic interactions.
235 */
237 public:
239 virtual ~MetallicInteraction() {}
240 virtual void calcDensity(InteractionData& idat) = 0;
241 virtual void calcFunctional(SelfData& sdat) = 0;
242 virtual InteractionFamily getFamily() { return METALLIC_EMBEDDING_FAMILY; }
243 };
244
245 /**
246 * The basic interface for hydrogen bonding interactions.
247 */
249 public:
251 virtual ~HydrogenBondingInteraction() {}
252 virtual InteractionFamily getFamily() { return HYDROGENBONDING_FAMILY; }
253 };
254} // namespace OpenMD
255
256#endif
The basic interface for electrostatic interactions.
The basic interface for hydrogen bonding interactions.
The basic interface for metallic interactions.
The basic interface for non-bonded interactions.
The basic interface for van der Waals interactions.
This basic Periodic Table class was originally taken from the data.cpp file in OpenBabel.
static const int ELECTROSTATIC_INTERACTION
Boolean flags for the iHash_ and sHash_ data structures.
InteractionFamily
The InteractionFamily enum.
@ HYDROGENBONDING_FAMILY
Short-range directional interactions.
@ VANDERWAALS_FAMILY
Long-range dispersion and short-range pauli repulsion.
@ NO_FAMILY
No family defined.
@ METALLIC_EMBEDDING_FAMILY
Transition metal interactions involving electron density.
@ BONDED_FAMILY
directly bonded 1-2, 1-3, or 1-4 interactions
@ METALLIC_PAIR_FAMILY
Transition metal interactions involving pair potentials.
@ ELECTROSTATIC_FAMILY
Coulombic and point-multipole interactions.
The InteractionData struct.
bool shiftedPot
shift the potential up inside the cutoff?
Vector3d d
interatomic vector (already wrapped into box)
RealType sPot2
site potential on second atom
Vector3d D_1
dipole vector of first atom
RealType skippedCharge1
charge skipped on atom1 in pairwise interaction loop with atom2
RealType dVdFQ1
fluctuating charge force on atom1
RealType dVdFQ2
fluctuating charge force on atom2
RealType particlePot2
particle potential for atom2
RealType electroMult
multiplier for electrostatic interactions
int atid1
atomType ident for atom 1
potVec selePot
potential energies of the selected sites
RealType flucQ2
fluctuating charge on atom2
bool sameRegion
are these atoms specified to be in the same region?
bool excluded
is this excluded from direct pairwise interactions? (some indirect interactions may still apply)
RealType rho2
total electron density at second atom
RealType sw
switching function value at rij
Vector3d eField1
electric field on first atom
RotMat3x3d A2
rotation matrix of second atom
bool isSelected
one of the particles has been selected for selection potential
RotMat3x3d A1
rotation matrix of first atom
bool doElectricField
should we bother with the electric field?
RealType flucQ1
fluctuating charge on atom1
Mat3x3d Q_2
quadrupole tensor of first atom
Vector3d eField2
electric field on second atom
Vector3d t1
torque on first atom
Vector3d t2
torque on second atom
RealType vpair
pair potential
RealType sPot1
site potential on first atom
int atid2
atomType ident for atom 2
bool doSitePotential
should we bother with electrostatic site potential
bool shiftedForce
shifted forces smoothly inside the cutoff?
int topoDist
topological distance between atoms
RealType rcut
cutoff radius for this interaction
Vector3d D_2
dipole vector of first atom
RealType skippedCharge2
charge skipped on atom2 in pairwise interaction loop with atom1
RealType dfrho2
derivative of functional for atom 2
potVec excludedPot
potential energy excluded from the overall calculation
RealType vdwMult
multiplier for van der Waals interactions
RealType frho2
density functional at second atom
bool doParticlePot
should we bother with the particle pot?
RealType dfrho1
derivative of functional for atom 1
Mat3x3d Q_1
quadrupole tensor of first atom
RealType frho1
density functional at first atom
Vector3d f1
force between the two atoms
RealType rij
interatomic separation
RealType particlePot1
particle potential for atom1
RealType rho1
total electron density at first atom
The SelfData struct.
potVec selePot
potential energy of the selected site
RealType flucQfrc
fluctuating charge derivative
RealType frho
value of density functional for atom
RealType dfrhodrho
derivative of density functional for atom
potVec selfPot
total potential (including embedding energy)
RealType particlePot
contribution to potential from this particle
RealType rho
electron density
bool isSelected
this site has been selected for selection potential
RealType flucQ
current value of atom's fluctuating charge
RealType skippedCharge
charge skipped in pairwise interaction loop
bool doParticlePot
should we bother with the particle pot?
int atid
atomType ident for the atom