ViewVC Help
View File | Revision Log | Show Annotations | View Changeset | Root Listing
root/OpenMD/trunk/src/nonbonded/Electrostatic.hpp
Revision: 1900
Committed: Fri Jul 12 17:38:06 2013 UTC (12 years ago) by gezelter
File size: 8205 byte(s)
Log Message:
Added self-interaction for shifted multipoles

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

Properties

Name Value
svn:eol-style native