OpenMD 3.1
Molecular Dynamics in the Open
Loading...
Searching...
No Matches
Electrostatic.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_ELECTROSTATIC_HPP
46#define NONBONDED_ELECTROSTATIC_HPP
47
48#include "brains/ForceField.hpp"
49#include "brains/SimInfo.hpp"
50#include "flucq/FluctuatingChargeForces.hpp"
51#include "math/CubicSpline.hpp"
53#include "nonbonded/NonBondedInteraction.hpp"
54#include "primitives/Atom.hpp"
55#include "types/AtomType.hpp"
56
57namespace OpenMD {
58
60 bool is_Charge;
61 bool is_Dipole;
62 bool is_Quadrupole;
63 bool is_Fluctuating;
64 bool uses_SlaterIntramolecular;
65 RealType fixedCharge;
66 RealType hardness;
67 RealType electronegativity;
68 int slaterN;
69 RealType slaterZeta;
70 Vector3d dipole;
71 Mat3x3d quadrupole;
72 };
73
75 esm_HARD,
76 esm_SWITCHING_FUNCTION,
77 esm_SHIFTED_POTENTIAL,
78 esm_SHIFTED_FORCE,
79 esm_TAYLOR_SHIFTED,
80 esm_REACTION_FIELD,
81 esm_EWALD_FULL,
82 esm_EWALD_PME, /**< PME Ewald methods aren't supported yet */
83 esm_EWALD_SPME /**< SPME Ewald methods aren't supported yet */
84 };
85
86 enum ElectrostaticScreeningMethod { UNDAMPED, DAMPED };
87
89 public:
92 void setForceField(ForceField* ff);
93 void setSimulatedAtomTypes(AtomTypeSet& simtypes);
94 void setSimInfo(SimInfo* info) { info_ = info; };
95 void addType(AtomType* atomType);
96 virtual void calcForce(InteractionData& idat);
97 virtual void calcSelfCorrection(SelfData& sdat);
98 virtual string getName() { return name_; }
99 virtual RealType getSuggestedCutoffRadius(
100 pair<AtomType*, AtomType*> atypes);
101 void setCutoffRadius(RealType rCut);
102 void setElectrostaticSummationMethod(ElectrostaticSummationMethod esm);
103 void setElectrostaticScreeningMethod(ElectrostaticScreeningMethod sm);
104 void setDampingAlpha(RealType alpha);
105 void setReactionFieldDielectric(RealType dielectric);
106 void calcSurfaceTerm(bool slabGeometry, int axis, RealType& pot);
107 void ReciprocalSpaceSum(RealType& pot);
108
109 // Used by EAM to compute local fields:
110 RealType getFieldFunction(RealType r);
111
112 // Utility routine
113 void getSitePotentials(Atom* a1, Atom* a2, bool excluded, RealType& spot1,
114 RealType& spot2);
115
116 private:
117 void initialize();
118 string name_;
119 bool initialized_;
120 bool haveCutoffRadius_;
121 bool haveDampingAlpha_;
122 bool haveDielectric_;
123 bool haveElectroSplines_;
124
125 int nElectro_;
126 int nFlucq_;
127
128 set<int>
129 Etypes; /**< The set of AtomType idents that are Electrostatic types */
130 vector<int>
131 Etids; /**< The mapping from AtomType ident -> Electrostatic ident */
132 set<int>
133 FQtypes; /**< The set of AtomType idents that are fluctuating types */
134 vector<int>
135 FQtids; /**< The mapping from AtomType ident -> fluctuating ident */
136 vector<ElectrostaticAtomData>
137 ElectrostaticMap; /**< data about Electrostatic types */
138 vector<vector<CubicSplinePtr>>
139 Jij; /**< Coulomb integral for two fq types */
140
141 SimInfo* info_ {nullptr};
142 ForceField* forceField_;
144 AtomTypeSet simTypes_;
145 RealType cutoffRadius_;
146 RealType pre11_;
147 RealType pre12_;
148 RealType pre22_;
149 RealType pre14_;
150 RealType pre24_;
151 RealType pre44_;
152 RealType v01, v11, v21, v22, v31, v32, v41, v42, v43;
153 RealType dv01, dv11, dv21, dv22, dv31, dv32, dv41, dv42, dv43;
154 RealType v11or, v22or, v31or, v32or, v42or, v43or;
155 RealType chargeToC_;
156 RealType angstromToM_;
157 RealType debyeToCm_;
158 int np_;
159 ElectrostaticSummationMethod summationMethod_;
160 ElectrostaticScreeningMethod screeningMethod_;
161 map<string, ElectrostaticSummationMethod> summationMap_;
162 map<string, ElectrostaticScreeningMethod> screeningMap_;
163 RealType dampingAlpha_;
164 RealType dielectric_;
165 RealType preRF_;
166 RealType selfMult1_;
167 RealType selfMult2_;
168 RealType selfMult4_;
169
170 CubicSplinePtr v01s;
171 CubicSplinePtr v11s;
172 CubicSplinePtr v21s;
173 CubicSplinePtr v22s;
174 CubicSplinePtr v31s;
175 CubicSplinePtr v32s;
176 CubicSplinePtr v41s;
177 CubicSplinePtr v42s;
178 CubicSplinePtr v43s;
179
182 RealType C_a, C_b; // Charges
183 Vector3d D_a, D_b; // Dipoles (space-fixed)
184 Mat3x3d Q_a, Q_b; // Quadrupoles (space-fixed)
185
186 RealType ri; // Distance utility scalar
187 RealType rdDa, rdDb; // Dipole utility scalars
188 Vector3d rxDa, rxDb; // Dipole utility vectors
189 RealType rdQar, rdQbr, trQa, trQb; // Quadrupole utility scalars
190 Vector3d Qar, Qbr, rQa, rQb, rxQar, rxQbr; // Quadrupole utility vectors
191 RealType pref;
192
193 RealType DadDb, trQaQb, DadQbr, DbdQar; // Cross-interaction scalars
194 RealType rQaQbr;
195 Vector3d DaxDb, DadQb, DbdQa, DaxQbr, DbxQar; // Cross-interaction vectors
196 Vector3d rQaQb, QaQbr, QaxQb, rQaxQbr;
197 Mat3x3d QaQb; // Cross-interaction matrices
198
199 RealType U; // Potential
200 Vector3d F; // Force
201 Vector3d Ta; // Torque on site a
202 Vector3d Tb; // Torque on site b
203 Vector3d Ea; // Electric field at site a
204 Vector3d Eb; // Electric field at site b
205 RealType Pa; // Site potential at site a
206 RealType Pb; // Site potential at site b
207 RealType dUdCa; // fluctuating charge force at site a
208 RealType dUdCb; // fluctuating charge force at site a
209
210 // Indirect interactions mediated by the reaction field.
211 RealType indirect_Pot; // Potential
212 Vector3d indirect_F; // Force
213 Vector3d indirect_Ta; // Torque on site a
214 Vector3d indirect_Tb; // Torque on site b
215
216 // Excluded potential that is still computed for fluctuating charges
217 RealType excluded_Pot;
218
219 RealType rfContrib, coulInt;
220
221 // spline for coulomb integral
222 CubicSplinePtr J;
223 Vector3d rhat;
224
225 // logicals
226
227 bool a_is_Charge;
228 bool a_is_Dipole;
229 bool a_is_Quadrupole;
230 bool a_is_Fluctuating;
231 bool a_uses_SlaterIntra;
232
233 bool b_is_Charge;
234 bool b_is_Dipole;
235 bool b_is_Quadrupole;
236 bool b_is_Fluctuating;
237 bool b_uses_SlaterIntra;
238 };
239} // namespace OpenMD
240
241#endif
AtomType is what OpenMD looks to for unchanging data about an atom.
Definition AtomType.hpp:66
The basic interface for electrostatic interactions.
One of the heavy-weight classes of OpenMD, SimInfo maintains objects and variables relating to the cu...
Definition SimInfo.hpp:93
This basic Periodic Table class was originally taken from the data.cpp file in OpenBabel.
ElectrostaticSummationMethod
@ esm_EWALD_SPME
SPME Ewald methods aren't supported yet.
@ esm_EWALD_PME
PME Ewald methods aren't supported yet.
The InteractionData struct.
The SelfData struct.