ViewVC Help
View File | Revision Log | Show Annotations | View Changeset | Root Listing
root/OpenMD/trunk/src/nonbonded/Electrostatic.hpp
Revision: 1994
Committed: Wed Apr 30 18:50:45 2014 UTC (11 years, 3 months ago) by gezelter
File size: 8622 byte(s)
Log Message:
Added NitrileFrequencyMap module to staticProps

File Contents

# Content
1 /*
2 * Copyright (c) 2009 The University of Notre Dame. All Rights Reserved.
3 *
4 * The University of Notre Dame grants you ("Licensee") a
5 * non-exclusive, royalty free, license to use, modify and
6 * redistribute this software in source and binary code form, provided
7 * that the following conditions are met:
8 *
9 * 1. Redistributions of source code must retain the above copyright
10 * notice, this list of conditions and the following disclaimer.
11 *
12 * 2. Redistributions in binary form must reproduce the above copyright
13 * notice, this list of conditions and the following disclaimer in the
14 * documentation and/or other materials provided with the
15 * distribution.
16 *
17 * This software is provided "AS IS," without a warranty of any
18 * kind. All express or implied conditions, representations and
19 * warranties, including any implied warranty of merchantability,
20 * fitness for a particular purpose or non-infringement, are hereby
21 * excluded. The University of Notre Dame and its licensors shall not
22 * be liable for any damages suffered by licensee as a result of
23 * using, modifying or distributing the software or its
24 * derivatives. In no event will the University of Notre Dame or its
25 * licensors be liable for any lost revenue, profit or data, or for
26 * direct, indirect, special, consequential, incidental or punitive
27 * damages, however caused and regardless of the theory of liability,
28 * arising out of the use of or inability to use software, even if the
29 * University of Notre Dame has been advised of the possibility of
30 * such damages.
31 *
32 * SUPPORT OPEN SCIENCE! If you use OpenMD or its source code in your
33 * research, please cite the appropriate papers when you publish your
34 * work. Good starting points are:
35 *
36 * [1] Meineke, et al., J. Comp. Chem. 26, 252-271 (2005).
37 * [2] Fennell & Gezelter, J. Chem. Phys. 124, 234104 (2006).
38 * [3] Sun, Lin & Gezelter, J. Chem. Phys. 128, 234107 (2008).
39 * [4] Kuang & Gezelter, J. Chem. Phys. 133, 164101 (2010).
40 * [5] Vardeman, Stocker & Gezelter, J. Chem. Theory Comput. 7, 834 (2011).
41 */
42
43 #ifndef NONBONDED_ELECTROSTATIC_HPP
44 #define NONBONDED_ELECTROSTATIC_HPP
45
46 #include "nonbonded/NonBondedInteraction.hpp"
47 #include "types/AtomType.hpp"
48 #include "primitives/Atom.hpp"
49 #include "brains/ForceField.hpp"
50 #include "math/SquareMatrix3.hpp"
51 #include "math/CubicSpline.hpp"
52 #include "brains/SimInfo.hpp"
53 #include "flucq/FluctuatingChargeForces.hpp"
54
55 namespace OpenMD {
56
57 struct ElectrostaticAtomData {
58 bool is_Charge;
59 bool is_Dipole;
60 bool is_Quadrupole;
61 bool is_Fluctuating;
62 bool has_MultipleMinima;
63 RealType fixedCharge;
64 RealType hardness;
65 RealType electronegativity;
66 int slaterN;
67 RealType slaterZeta;
68 RealType curvature;
69 RealType coupling;
70 vector<pair<int, RealType> > diabats;
71 Vector3d dipole;
72 Mat3x3d quadrupole;
73 };
74
75 enum ElectrostaticSummationMethod{
76 esm_HARD,
77 esm_SWITCHING_FUNCTION,
78 esm_SHIFTED_POTENTIAL,
79 esm_SHIFTED_FORCE,
80 esm_TAYLOR_SHIFTED,
81 esm_REACTION_FIELD,
82 esm_EWALD_FULL,
83 esm_EWALD_PME, /**< PME Ewald methods aren't supported yet */
84 esm_EWALD_SPME /**< SPME Ewald methods aren't supported yet */
85 };
86
87 enum ElectrostaticScreeningMethod{
88 UNDAMPED,
89 DAMPED
90 };
91
92 class Electrostatic : public ElectrostaticInteraction {
93
94 public:
95 Electrostatic();
96 void setForceField(ForceField *ff);
97 void setSimulatedAtomTypes(set<AtomType*> &simtypes);
98 void setSimInfo(SimInfo* info) {info_ = info;};
99 void addType(AtomType* atomType);
100 virtual void calcForce(InteractionData &idat);
101 virtual void calcSelfCorrection(SelfData &sdat);
102 virtual string getName() {return name_;}
103 virtual RealType getSuggestedCutoffRadius(pair<AtomType*, AtomType*> atypes);
104 void setCutoffRadius( RealType rCut );
105 void setElectrostaticSummationMethod( ElectrostaticSummationMethod esm );
106 void setElectrostaticScreeningMethod( ElectrostaticScreeningMethod sm );
107 void setDampingAlpha( RealType alpha );
108 void setReactionFieldDielectric( RealType dielectric );
109 void ReciprocalSpaceSum(RealType &pot);
110
111 // Utility routine
112 void getSitePotentials(Atom* a1, Atom* a2, bool excluded, RealType &spot1, RealType &spot2);
113
114 private:
115 void initialize();
116 string name_;
117 bool initialized_;
118 bool haveCutoffRadius_;
119 bool haveDampingAlpha_;
120 bool haveDielectric_;
121 bool haveElectroSplines_;
122
123 int nElectro_;
124 int nFlucq_;
125
126 set<int> Etypes; /**< The set of AtomType idents that are Electrostatic types */
127 vector<int> Etids; /**< The mapping from AtomType ident -> Electrostatic ident */
128 set<int> FQtypes; /**< The set of AtomType idents that are fluctuating types */
129 vector<int> FQtids; /**< The mapping from AtomType ident -> fluctuating ident */
130 vector<ElectrostaticAtomData> ElectrostaticMap; /**< data about Electrostatic types */
131 vector<vector<CubicSpline*> > Jij; /**< Coulomb integral for two fq types */
132
133
134 SimInfo* info_;
135 ForceField* forceField_;
136 FluctuatingChargeForces* flucQ_;
137 set<AtomType*> simTypes_;
138 RealType cutoffRadius_;
139 RealType pre11_;
140 RealType pre12_;
141 RealType pre22_;
142 RealType pre14_;
143 RealType pre24_;
144 RealType pre44_;
145 RealType v01, v11, v21, v22, v31, v32, v41, v42, v43;
146 RealType dv01, dv11, dv21, dv22, dv31, dv32, dv41, dv42, dv43;
147 RealType v01or, v11or, v21or, v22or, v31or, v32or, v41or, v42or, v43or;
148 RealType chargeToC_;
149 RealType angstromToM_;
150 RealType debyeToCm_;
151 int np_;
152 ElectrostaticSummationMethod summationMethod_;
153 ElectrostaticScreeningMethod screeningMethod_;
154 map<string, ElectrostaticSummationMethod> summationMap_;
155 map<string, ElectrostaticScreeningMethod> screeningMap_;
156 RealType dampingAlpha_;
157 RealType dielectric_;
158 RealType preRF_;
159 RealType selfMult1_;
160 RealType selfMult2_;
161 RealType selfMult4_;
162
163 CubicSpline* v01s;
164 CubicSpline* v11s;
165 CubicSpline* v21s;
166 CubicSpline* v22s;
167 CubicSpline* v31s;
168 CubicSpline* v32s;
169 CubicSpline* v41s;
170 CubicSpline* v42s;
171 CubicSpline* v43s;
172
173 ElectrostaticAtomData data1;
174 ElectrostaticAtomData data2;
175 RealType C_a, C_b; // Charges
176 Vector3d D_a, D_b; // Dipoles (space-fixed)
177 Mat3x3d Q_a, Q_b; // Quadrupoles (space-fixed)
178
179 RealType ri; // Distance utility scalar
180 RealType rdDa, rdDb; // Dipole utility scalars
181 Vector3d rxDa, rxDb; // Dipole utility vectors
182 RealType rdQar, rdQbr, trQa, trQb; // Quadrupole utility scalars
183 Vector3d Qar, Qbr, rQa, rQb, rxQar, rxQbr; // Quadrupole utility vectors
184 RealType pref;
185
186 RealType DadDb, trQaQb, DadQbr, DbdQar; // Cross-interaction scalars
187 RealType rQaQbr;
188 Vector3d DaxDb, DadQb, DbdQa, DaxQbr, DbxQar; // Cross-interaction vectors
189 Vector3d rQaQb, QaQbr, QaxQb, rQaxQbr;
190 Mat3x3d QaQb; // Cross-interaction matrices
191
192 RealType U; // Potential
193 Vector3d F; // Force
194 Vector3d Ta; // Torque on site a
195 Vector3d Tb; // Torque on site b
196 Vector3d Ea; // Electric field at site a
197 Vector3d Eb; // Electric field at site b
198 RealType Pa; // Site potential at site a
199 RealType Pb; // Site potential at site b
200 RealType dUdCa; // fluctuating charge force at site a
201 RealType dUdCb; // fluctuating charge force at site a
202
203 // Indirect interactions mediated by the reaction field.
204 RealType indirect_Pot; // Potential
205 Vector3d indirect_F; // Force
206 Vector3d indirect_Ta; // Torque on site a
207 Vector3d indirect_Tb; // Torque on site b
208
209 // Excluded potential that is still computed for fluctuating charges
210 RealType excluded_Pot;
211
212 RealType rfContrib, coulInt, dJdr;
213
214 // spline for coulomb integral
215 CubicSpline* J;
216 Vector3d rhat;
217
218 // logicals
219
220 bool a_is_Charge;
221 bool a_is_Dipole;
222 bool a_is_Quadrupole;
223 bool a_is_Fluctuating;
224
225 bool b_is_Charge;
226 bool b_is_Dipole;
227 bool b_is_Quadrupole;
228 bool b_is_Fluctuating;
229
230
231 /*
232 CubicSpline* dv01s;
233 CubicSpline* dv11s;
234 CubicSpline* dv21s;
235 CubicSpline* dv22s;
236 CubicSpline* dv31s;
237 CubicSpline* dv32s;
238 CubicSpline* dv41s;
239 CubicSpline* dv42s;
240 CubicSpline* dv43s;
241 */
242 };
243 }
244
245
246 #endif

Properties

Name Value
svn:eol-style native