27 |
|
Integrator( SimInfo *theInfo, ForceFields* the_ff ); |
28 |
|
virtual ~Integrator(); |
29 |
|
void integrate( void ); |
30 |
+ |
virtual double getConservedQuantity(void); |
31 |
+ |
virtual string getAdditionalParameters(void); |
32 |
|
|
31 |
– |
|
33 |
|
protected: |
34 |
< |
|
34 |
> |
|
35 |
|
virtual void integrateStep( int calcPot, int calcStress ); |
36 |
|
virtual void preMove( void ); |
37 |
|
virtual void moveA( void ); |
42 |
|
|
43 |
|
virtual void resetIntegrator( void ) { } |
44 |
|
|
45 |
< |
virtual void calcForce( int calcPot, int calcStress ); |
45 |
> |
virtual void calcForce( int calcPot, int calcStress ); |
46 |
|
virtual void thermalize(); |
47 |
< |
|
47 |
> |
|
48 |
> |
virtual void rotationPropagation( DirectionalAtom* dAtom, double ji[3] ); |
49 |
> |
|
50 |
|
void checkConstraints( void ); |
51 |
< |
void rotate( int axes1, int axes2, double angle, double j[3], |
51 |
> |
void rotate( int axes1, int axes2, double angle, double j[3], |
52 |
|
double A[3][3] ); |
53 |
< |
|
53 |
> |
|
54 |
|
ForceFields* myFF; |
55 |
|
|
56 |
|
SimInfo *info; // all the info we'll ever need |
62 |
|
|
63 |
|
int isConstrained; // boolean to know whether the systems contains |
64 |
|
// constraints. |
65 |
< |
int nConstrained; // counter for number of constraints |
66 |
< |
int *constrainedA; // the i of a constraint pair |
67 |
< |
int *constrainedB; // the j of a constraint pair |
68 |
< |
double *constrainedDsqr; // the square of the constraint distance |
69 |
< |
|
65 |
> |
int nConstrained; // counter for number of constraints |
66 |
> |
int *constrainedA; // the i of a constraint pair |
67 |
> |
int *constrainedB; // the j of a constraint pair |
68 |
> |
double *constrainedDsqr; // the square of the constraint distance |
69 |
> |
|
70 |
|
int* moving; // tells whether we are moving atom i |
71 |
|
int* moved; // tells whether we have moved atom i |
72 |
< |
double* oldPos; // pre constrained positions |
72 |
> |
double* oldPos; // pre constrained positions |
73 |
|
|
74 |
|
short isFirst; /*boolean for the first time integrate is called */ |
75 |
< |
|
75 |
> |
|
76 |
|
double dt; |
77 |
|
double dt2; |
78 |
|
|
79 |
|
Thermo *tStats; |
80 |
|
StatWriter* statOut; |
81 |
|
DumpWriter* dumpOut; |
82 |
< |
|
82 |
> |
|
83 |
|
}; |
84 |
|
|
85 |
|
typedef Integrator<BaseIntegrator> RealIntegrator; |
89 |
|
public: |
90 |
|
NVE ( SimInfo *theInfo, ForceFields* the_ff ): |
91 |
|
T( theInfo, the_ff ){} |
92 |
< |
virtual ~NVE(){} |
92 |
> |
virtual ~NVE(){} |
93 |
|
}; |
94 |
|
|
95 |
|
|
98 |
|
public: |
99 |
|
|
100 |
|
NVT ( SimInfo *theInfo, ForceFields* the_ff); |
101 |
< |
virtual ~NVT() {} |
101 |
> |
virtual ~NVT(); |
102 |
|
|
103 |
|
void setTauThermostat(double tt) {tauThermostat = tt; have_tau_thermostat=1;} |
104 |
|
void setTargetTemp(double tt) {targetTemp = tt; have_target_temp = 1;} |
105 |
+ |
void setChiTolerance(double tol) {chiTolerance = tol;} |
106 |
+ |
virtual double getConservedQuantity(void); |
107 |
+ |
virtual string getAdditionalParameters(void); |
108 |
|
|
109 |
|
protected: |
110 |
|
|
119 |
|
|
120 |
|
double chi; |
121 |
|
|
122 |
+ |
//integral of chi(t)dt |
123 |
+ |
double integralOfChidt; |
124 |
+ |
|
125 |
|
// targetTemp must be set. tauThermostat must also be set; |
126 |
|
|
127 |
|
double targetTemp; |
128 |
|
double tauThermostat; |
129 |
< |
|
129 |
> |
|
130 |
|
short int have_tau_thermostat, have_target_temp; |
131 |
|
|
132 |
+ |
double *oldVel; |
133 |
+ |
double *oldJi; |
134 |
+ |
|
135 |
+ |
double chiTolerance; |
136 |
+ |
short int have_chi_tolerance; |
137 |
+ |
|
138 |
|
}; |
139 |
|
|
140 |
|
|
141 |
|
|
142 |
< |
template<typename T> class NPTi : public T{ |
142 |
> |
template<typename T> class NPT : public T{ |
143 |
|
|
144 |
|
public: |
145 |
|
|
146 |
< |
NPTi ( SimInfo *theInfo, ForceFields* the_ff); |
147 |
< |
virtual ~NPTi() {}; |
146 |
> |
NPT ( SimInfo *theInfo, ForceFields* the_ff); |
147 |
> |
virtual ~NPT(); |
148 |
|
|
149 |
|
virtual void integrateStep( int calcPot, int calcStress ){ |
150 |
|
calcStress = 1; |
151 |
|
T::integrateStep( calcPot, calcStress ); |
152 |
|
} |
153 |
|
|
154 |
+ |
virtual double getConservedQuantity(void) = 0; |
155 |
+ |
virtual string getAdditionalParameters(void) = 0; |
156 |
|
void setTauThermostat(double tt) {tauThermostat = tt; have_tau_thermostat=1;} |
157 |
|
void setTauBarostat(double tb) {tauBarostat = tb; have_tau_barostat=1;} |
158 |
|
void setTargetTemp(double tt) {targetTemp = tt; have_target_temp = 1;} |
159 |
|
void setTargetPressure(double tp) {targetPressure = tp; have_target_pressure = 1;} |
160 |
+ |
void setChiTolerance(double tol) {chiTolerance = tol; have_chi_tolerance = 1;} |
161 |
+ |
void setPosIterTolerance(double tol) {posIterTolerance = tol; have_pos_iter_tolerance = 1;} |
162 |
+ |
void setEtaTolerance(double tol) {etaTolerance = tol; have_eta_tolerance = 1;} |
163 |
|
|
164 |
|
protected: |
165 |
|
|
170 |
|
|
171 |
|
virtual void resetIntegrator( void ); |
172 |
|
|
173 |
+ |
virtual void getVelScaleA( double sc[3], double vel[3] ) = 0; |
174 |
+ |
virtual void getVelScaleB( double sc[3], int index ) = 0; |
175 |
+ |
virtual void getPosScale(double pos[3], double COM[3], |
176 |
+ |
int index, double sc[3]) = 0; |
177 |
+ |
|
178 |
+ |
virtual bool chiConverged( void ); |
179 |
+ |
virtual bool etaConverged( void ) = 0; |
180 |
+ |
|
181 |
+ |
virtual void evolveChiA( void ); |
182 |
+ |
virtual void evolveEtaA( void ) = 0; |
183 |
+ |
virtual void evolveChiB( void ); |
184 |
+ |
virtual void evolveEtaB( void ) = 0; |
185 |
+ |
|
186 |
+ |
virtual void scaleSimBox( void ) = 0; |
187 |
+ |
|
188 |
+ |
void accIntegralOfChidt(void) { integralOfChidt += dt * chi;} |
189 |
+ |
|
190 |
|
// chi and eta are the propagated degrees of freedom |
191 |
|
|
192 |
+ |
double oldChi; |
193 |
+ |
double prevChi; |
194 |
|
double chi; |
156 |
– |
double eta; |
195 |
|
double NkBT; |
196 |
+ |
double fkBT; |
197 |
|
|
198 |
< |
// targetTemp, targetPressure, and tauBarostat must be set. |
198 |
> |
double tt2, tb2; |
199 |
> |
double instaTemp, instaPress, instaVol; |
200 |
> |
double press[3][3]; |
201 |
> |
|
202 |
> |
int Nparticles; |
203 |
> |
|
204 |
> |
double integralOfChidt; |
205 |
> |
|
206 |
> |
// targetTemp, targetPressure, and tauBarostat must be set. |
207 |
|
// One of qmass or tauThermostat must be set; |
208 |
|
|
209 |
|
double targetTemp; |
214 |
|
short int have_tau_thermostat, have_tau_barostat, have_target_temp; |
215 |
|
short int have_target_pressure; |
216 |
|
|
217 |
+ |
double *oldPos; |
218 |
+ |
double *oldVel; |
219 |
+ |
double *oldJi; |
220 |
+ |
|
221 |
+ |
double chiTolerance; |
222 |
+ |
short int have_chi_tolerance; |
223 |
+ |
double posIterTolerance; |
224 |
+ |
short int have_pos_iter_tolerance; |
225 |
+ |
double etaTolerance; |
226 |
+ |
short int have_eta_tolerance; |
227 |
+ |
|
228 |
|
}; |
229 |
|
|
230 |
< |
template<typename T> class NPTim : public T{ |
230 |
> |
template<typename T> class NPTi : public T{ |
231 |
|
|
232 |
|
public: |
233 |
+ |
NPTi( SimInfo *theInfo, ForceFields* the_ff); |
234 |
+ |
~NPTi(); |
235 |
|
|
236 |
< |
NPTim ( SimInfo *theInfo, ForceFields* the_ff); |
237 |
< |
virtual ~NPTim() {}; |
238 |
< |
|
179 |
< |
virtual void integrateStep( int calcPot, int calcStress ){ |
180 |
< |
calcStress = 1; |
181 |
< |
T::integrateStep( calcPot, calcStress ); |
182 |
< |
} |
183 |
< |
|
184 |
< |
void setTauThermostat(double tt) {tauThermostat = tt; have_tau_thermostat=1;} |
185 |
< |
void setTauBarostat(double tb) {tauBarostat = tb; have_tau_barostat=1;} |
186 |
< |
void setTargetTemp(double tt) {targetTemp = tt; have_target_temp = 1;} |
187 |
< |
void setTargetPressure(double tp) {targetPressure = tp; have_target_pressure = 1;} |
188 |
< |
|
236 |
> |
virtual double getConservedQuantity(void); |
237 |
> |
virtual void resetIntegrator(void); |
238 |
> |
virtual string getAdditionalParameters(void); |
239 |
|
protected: |
240 |
|
|
191 |
– |
virtual void moveA( void ); |
192 |
– |
virtual void moveB( void ); |
241 |
|
|
194 |
– |
virtual int readyCheck(); |
242 |
|
|
243 |
< |
virtual void resetIntegrator( void ); |
243 |
> |
virtual void evolveEtaA(void); |
244 |
> |
virtual void evolveEtaB(void); |
245 |
|
|
246 |
< |
Molecule* myMolecules; |
199 |
< |
Atom** myAtoms; |
246 |
> |
virtual bool etaConverged( void ); |
247 |
|
|
248 |
< |
// chi and eta are the propagated degrees of freedom |
248 |
> |
virtual void scaleSimBox( void ); |
249 |
|
|
250 |
< |
double chi; |
251 |
< |
double eta; |
252 |
< |
double NkBT; |
250 |
> |
virtual void getVelScaleA( double sc[3], double vel[3] ); |
251 |
> |
virtual void getVelScaleB( double sc[3], int index ); |
252 |
> |
virtual void getPosScale(double pos[3], double COM[3], |
253 |
> |
int index, double sc[3]); |
254 |
|
|
255 |
< |
// targetTemp, targetPressure, and tauBarostat must be set. |
208 |
< |
// One of qmass or tauThermostat must be set; |
209 |
< |
|
210 |
< |
double targetTemp; |
211 |
< |
double targetPressure; |
212 |
< |
double tauThermostat; |
213 |
< |
double tauBarostat; |
214 |
< |
|
215 |
< |
short int have_tau_thermostat, have_tau_barostat, have_target_temp; |
216 |
< |
short int have_target_pressure; |
217 |
< |
|
255 |
> |
double eta, oldEta, prevEta; |
256 |
|
}; |
257 |
|
|
220 |
– |
template<typename T> class NPTzm : public T{ |
221 |
– |
|
222 |
– |
public: |
223 |
– |
|
224 |
– |
NPTzm ( SimInfo *theInfo, ForceFields* the_ff); |
225 |
– |
virtual ~NPTzm() {}; |
226 |
– |
|
227 |
– |
virtual void integrateStep( int calcPot, int calcStress ){ |
228 |
– |
calcStress = 1; |
229 |
– |
T::integrateStep( calcPot, calcStress ); |
230 |
– |
} |
231 |
– |
|
232 |
– |
void setTauThermostat(double tt) {tauThermostat = tt; have_tau_thermostat=1;} |
233 |
– |
void setTauBarostat(double tb) {tauBarostat = tb; have_tau_barostat=1;} |
234 |
– |
void setTargetTemp(double tt) {targetTemp = tt; have_target_temp = 1;} |
235 |
– |
void setTargetPressure(double tp) {targetPressure = tp; have_target_pressure = 1;} |
236 |
– |
|
237 |
– |
protected: |
238 |
– |
|
239 |
– |
virtual void moveA( void ); |
240 |
– |
virtual void moveB( void ); |
241 |
– |
|
242 |
– |
virtual int readyCheck(); |
243 |
– |
|
244 |
– |
virtual void resetIntegrator( void ); |
245 |
– |
|
246 |
– |
Molecule* myMolecules; |
247 |
– |
Atom** myAtoms; |
248 |
– |
|
249 |
– |
// chi and eta are the propagated degrees of freedom |
250 |
– |
|
251 |
– |
double chi; |
252 |
– |
double eta; |
253 |
– |
double etaZ; |
254 |
– |
double NkBT; |
255 |
– |
|
256 |
– |
// targetTemp, targetPressure, and tauBarostat must be set. |
257 |
– |
// One of qmass or tauThermostat must be set; |
258 |
– |
|
259 |
– |
double targetTemp; |
260 |
– |
double targetPressure; |
261 |
– |
double tauThermostat; |
262 |
– |
double tauBarostat; |
263 |
– |
|
264 |
– |
short int have_tau_thermostat, have_tau_barostat, have_target_temp; |
265 |
– |
short int have_target_pressure; |
266 |
– |
|
267 |
– |
}; |
268 |
– |
|
258 |
|
template<typename T> class NPTf : public T{ |
259 |
|
|
260 |
|
public: |
261 |
|
|
262 |
|
NPTf ( SimInfo *theInfo, ForceFields* the_ff); |
263 |
< |
virtual ~NPTf() {}; |
263 |
> |
virtual ~NPTf(); |
264 |
|
|
265 |
< |
virtual void integrateStep( int calcPot, int calcStress ){ |
266 |
< |
calcStress = 1; |
267 |
< |
T::integrateStep( calcPot, calcStress ); |
279 |
< |
} |
265 |
> |
virtual double getConservedQuantity(void); |
266 |
> |
virtual string getAdditionalParameters(void); |
267 |
> |
virtual void resetIntegrator(void); |
268 |
|
|
281 |
– |
void setTauThermostat(double tt) {tauThermostat = tt; have_tau_thermostat=1;} |
282 |
– |
void setTauBarostat(double tb) {tauBarostat = tb; have_tau_barostat=1;} |
283 |
– |
void setTargetTemp(double tt) {targetTemp = tt; have_target_temp = 1;} |
284 |
– |
void setTargetPressure(double tp) {targetPressure = tp; have_target_pressure = 1;} |
285 |
– |
|
269 |
|
protected: |
270 |
|
|
271 |
< |
virtual void moveA( void ); |
272 |
< |
virtual void moveB( void ); |
271 |
> |
virtual void evolveEtaA(void); |
272 |
> |
virtual void evolveEtaB(void); |
273 |
|
|
274 |
< |
virtual void resetIntegrator( void ); |
274 |
> |
virtual bool etaConverged( void ); |
275 |
|
|
276 |
< |
virtual int readyCheck(); |
276 |
> |
virtual void scaleSimBox( void ); |
277 |
|
|
278 |
< |
// chi and eta are the propagated degrees of freedom |
278 |
> |
virtual void getVelScaleA( double sc[3], double vel[3] ); |
279 |
> |
virtual void getVelScaleB( double sc[3], int index ); |
280 |
> |
virtual void getPosScale(double pos[3], double COM[3], |
281 |
> |
int index, double sc[3]); |
282 |
|
|
297 |
– |
double chi; |
283 |
|
double eta[3][3]; |
284 |
< |
double NkBT; |
285 |
< |
|
301 |
< |
// targetTemp, targetPressure, and tauBarostat must be set. |
302 |
< |
// One of qmass or tauThermostat must be set; |
303 |
< |
|
304 |
< |
double targetTemp; |
305 |
< |
double targetPressure; |
306 |
< |
double tauThermostat; |
307 |
< |
double tauBarostat; |
308 |
< |
|
309 |
< |
short int have_tau_thermostat, have_tau_barostat, have_target_temp; |
310 |
< |
short int have_target_pressure; |
311 |
< |
|
284 |
> |
double oldEta[3][3]; |
285 |
> |
double prevEta[3][3]; |
286 |
|
}; |
287 |
|
|
288 |
< |
template<typename T> class NPTxym : public T{ |
288 |
> |
template<typename T> class NPTxyz : public T{ |
289 |
|
|
290 |
|
public: |
291 |
|
|
292 |
< |
NPTxym ( SimInfo *theInfo, ForceFields* the_ff); |
293 |
< |
virtual ~NPTxym() {}; |
292 |
> |
NPTxyz ( SimInfo *theInfo, ForceFields* the_ff); |
293 |
> |
virtual ~NPTxyz(); |
294 |
|
|
295 |
< |
virtual void integrateStep( int calcPot, int calcStress ){ |
296 |
< |
calcStress = 1; |
297 |
< |
T::integrateStep( calcPot, calcStress ); |
324 |
< |
} |
325 |
< |
|
326 |
< |
void setTauThermostat(double tt) {tauThermostat = tt; have_tau_thermostat=1;} |
327 |
< |
void setTauBarostat(double tb) {tauBarostat = tb; have_tau_barostat=1;} |
328 |
< |
void setTargetTemp(double tt) {targetTemp = tt; have_target_temp = 1;} |
329 |
< |
void setTargetPressure(double tp) {targetPressure = tp; have_target_pressure = 1;} |
295 |
> |
virtual double getConservedQuantity(void); |
296 |
> |
virtual string getAdditionalParameters(void); |
297 |
> |
virtual void resetIntegrator(void); |
298 |
|
|
299 |
|
protected: |
300 |
|
|
301 |
< |
virtual void moveA( void ); |
302 |
< |
virtual void moveB( void ); |
301 |
> |
virtual void evolveEtaA(void); |
302 |
> |
virtual void evolveEtaB(void); |
303 |
|
|
304 |
< |
virtual int readyCheck(); |
304 |
> |
virtual bool etaConverged( void ); |
305 |
|
|
306 |
< |
virtual void resetIntegrator( void ); |
306 |
> |
virtual void scaleSimBox( void ); |
307 |
|
|
308 |
< |
Molecule* myMolecules; |
309 |
< |
Atom** myAtoms; |
308 |
> |
virtual void getVelScaleA( double sc[3], double vel[3] ); |
309 |
> |
virtual void getVelScaleB( double sc[3], int index ); |
310 |
> |
virtual void getPosScale(double pos[3], double COM[3], |
311 |
> |
int index, double sc[3]); |
312 |
|
|
343 |
– |
// chi and eta are the propagated degrees of freedom |
344 |
– |
|
345 |
– |
double chi; |
346 |
– |
double eta; |
347 |
– |
double etaX; |
348 |
– |
double etaY; |
349 |
– |
double NkBT; |
350 |
– |
|
351 |
– |
// targetTemp, targetPressure, and tauBarostat must be set. |
352 |
– |
// One of qmass or tauThermostat must be set; |
353 |
– |
|
354 |
– |
double targetTemp; |
355 |
– |
double targetPressure; |
356 |
– |
double tauThermostat; |
357 |
– |
double tauBarostat; |
358 |
– |
|
359 |
– |
short int have_tau_thermostat, have_tau_barostat, have_target_temp; |
360 |
– |
short int have_target_pressure; |
361 |
– |
|
362 |
– |
}; |
363 |
– |
|
364 |
– |
|
365 |
– |
template<typename T> class NPTfm : public T{ |
366 |
– |
|
367 |
– |
public: |
368 |
– |
|
369 |
– |
NPTfm ( SimInfo *theInfo, ForceFields* the_ff); |
370 |
– |
virtual ~NPTfm() {}; |
371 |
– |
|
372 |
– |
virtual void integrateStep( int calcPot, int calcStress ){ |
373 |
– |
calcStress = 1; |
374 |
– |
T::integrateStep( calcPot, calcStress ); |
375 |
– |
} |
376 |
– |
|
377 |
– |
void setTauThermostat(double tt) {tauThermostat = tt; have_tau_thermostat=1;} |
378 |
– |
void setTauBarostat(double tb) {tauBarostat = tb; have_tau_barostat=1;} |
379 |
– |
void setTargetTemp(double tt) {targetTemp = tt; have_target_temp = 1;} |
380 |
– |
void setTargetPressure(double tp) {targetPressure = tp; have_target_pressure = 1;} |
381 |
– |
|
382 |
– |
protected: |
383 |
– |
|
384 |
– |
virtual void moveA( void ); |
385 |
– |
virtual void moveB( void ); |
386 |
– |
|
387 |
– |
virtual void resetIntegrator( void ); |
388 |
– |
|
389 |
– |
virtual int readyCheck(); |
390 |
– |
|
391 |
– |
Molecule* myMolecules; |
392 |
– |
Atom** myAtoms; |
393 |
– |
|
394 |
– |
// chi and eta are the propagated degrees of freedom |
395 |
– |
|
396 |
– |
double chi; |
313 |
|
double eta[3][3]; |
314 |
< |
double NkBT; |
315 |
< |
|
400 |
< |
// targetTemp, targetPressure, and tauBarostat must be set. |
401 |
< |
// One of qmass or tauThermostat must be set; |
402 |
< |
|
403 |
< |
double targetTemp; |
404 |
< |
double targetPressure; |
405 |
< |
double tauThermostat; |
406 |
< |
double tauBarostat; |
407 |
< |
|
408 |
< |
short int have_tau_thermostat, have_tau_barostat, have_target_temp; |
409 |
< |
short int have_target_pressure; |
410 |
< |
|
314 |
> |
double oldEta[3][3]; |
315 |
> |
double prevEta[3][3]; |
316 |
|
}; |
317 |
|
|
318 |
|
|
414 |
– |
template<typename T> class NPTpr : public T{ |
415 |
– |
|
416 |
– |
public: |
417 |
– |
|
418 |
– |
NPTpr ( SimInfo *theInfo, ForceFields* the_ff); |
419 |
– |
virtual ~NPTpr() {}; |
420 |
– |
|
421 |
– |
virtual void integrateStep( int calcPot, int calcStress ){ |
422 |
– |
calcStress = 1; |
423 |
– |
T::integrateStep( calcPot, calcStress ); |
424 |
– |
} |
425 |
– |
|
426 |
– |
void setTauThermostat(double tt) {tauThermostat = tt; have_tau_thermostat=1;} |
427 |
– |
void setTauBarostat(double tb) {tauBarostat = tb; have_tau_barostat=1;} |
428 |
– |
void setTargetTemp(double tt) {targetTemp = tt; have_target_temp = 1;} |
429 |
– |
void setTargetPressure(double tp) {targetPressure = tp; have_target_pressure = 1;} |
430 |
– |
|
431 |
– |
protected: |
432 |
– |
|
433 |
– |
virtual void moveA( void ); |
434 |
– |
virtual void moveB( void ); |
435 |
– |
|
436 |
– |
virtual int readyCheck(); |
437 |
– |
|
438 |
– |
virtual void resetIntegrator( void ); |
439 |
– |
|
440 |
– |
// chi and eta are the propagated degrees of freedom |
441 |
– |
|
442 |
– |
double chi; |
443 |
– |
double eta[3][3]; |
444 |
– |
double NkBT; |
445 |
– |
|
446 |
– |
// targetTemp, targetPressure, and tauBarostat must be set. |
447 |
– |
// One of qmass or tauThermostat must be set; |
448 |
– |
|
449 |
– |
double targetTemp; |
450 |
– |
double targetPressure; |
451 |
– |
double tauThermostat; |
452 |
– |
double tauBarostat; |
453 |
– |
|
454 |
– |
short int have_tau_thermostat, have_tau_barostat, have_target_temp; |
455 |
– |
short int have_target_pressure; |
456 |
– |
|
457 |
– |
}; |
458 |
– |
|
459 |
– |
|
319 |
|
template<typename T> class ZConstraint : public T { |
320 |
< |
|
321 |
< |
public: |
320 |
> |
|
321 |
> |
public: |
322 |
|
class ForceSubtractionPolicy{ |
323 |
|
public: |
324 |
|
ForceSubtractionPolicy(ZConstraint<T>* integrator) {zconsIntegrator = integrator;} |
325 |
|
|
326 |
< |
virtual void update() = 0; |
326 |
> |
virtual void update() = 0; |
327 |
|
virtual double getZFOfFixedZMols(Molecule* mol, Atom* atom, double totalForce) = 0; |
328 |
|
virtual double getZFOfMovingMols(Atom* atom, double totalForce) = 0; |
329 |
|
virtual double getHFOfFixedZMols(Molecule* mol, Atom* atom, double totalForce) = 0; |
330 |
|
virtual double getHFOfUnconsMols(Atom* atom, double totalForce) = 0; |
331 |
< |
|
331 |
> |
|
332 |
|
protected: |
333 |
< |
ZConstraint<T>* zconsIntegrator;; |
333 |
> |
ZConstraint<T>* zconsIntegrator; |
334 |
|
}; |
335 |
|
|
336 |
|
class PolicyByNumber : public ForceSubtractionPolicy{ |
337 |
|
|
338 |
|
public: |
339 |
< |
PolicyByNumber(ZConstraint<T>* integrator) :ForceSubtractionPolicy(integrator) {} |
340 |
< |
virtual void update(); |
339 |
> |
PolicyByNumber(ZConstraint<T>* integrator) :ForceSubtractionPolicy(integrator) {} |
340 |
> |
virtual void update(); |
341 |
|
virtual double getZFOfFixedZMols(Molecule* mol, Atom* atom, double totalForce) ; |
342 |
|
virtual double getZFOfMovingMols(Atom* atom, double totalForce) ; |
343 |
|
virtual double getHFOfFixedZMols(Molecule* mol, Atom* atom, double totalForce); |
344 |
|
virtual double getHFOfUnconsMols(Atom* atom, double totalForce); |
345 |
< |
|
345 |
> |
|
346 |
|
private: |
347 |
< |
int totNumOfMovingAtoms; |
347 |
> |
int totNumOfMovingAtoms; |
348 |
|
}; |
349 |
|
|
350 |
|
class PolicyByMass : public ForceSubtractionPolicy{ |
351 |
|
|
352 |
|
public: |
353 |
< |
PolicyByMass(ZConstraint<T>* integrator) :ForceSubtractionPolicy(integrator) {} |
354 |
< |
|
355 |
< |
virtual void update(); |
353 |
> |
PolicyByMass(ZConstraint<T>* integrator) :ForceSubtractionPolicy(integrator) {} |
354 |
> |
|
355 |
> |
virtual void update(); |
356 |
|
virtual double getZFOfFixedZMols(Molecule* mol, Atom* atom, double totalForce) ; |
357 |
|
virtual double getZFOfMovingMols(Atom* atom, double totalForce) ; |
358 |
|
virtual double getHFOfFixedZMols(Molecule* mol, Atom* atom, double totalForce); |
366 |
|
|
367 |
|
ZConstraint( SimInfo *theInfo, ForceFields* the_ff); |
368 |
|
~ZConstraint(); |
369 |
< |
|
369 |
> |
|
370 |
|
void setZConsTime(double time) {this->zconsTime = time;} |
371 |
|
void getZConsTime() {return zconsTime;} |
372 |
< |
|
372 |
> |
|
373 |
|
void setIndexOfAllZConsMols(vector<int> index) {indexOfAllZConsMols = index;} |
374 |
|
void getIndexOfAllZConsMols() {return indexOfAllZConsMols;} |
375 |
< |
|
375 |
> |
|
376 |
|
void setZConsOutput(const char * fileName) {zconsOutput = fileName;} |
377 |
|
string getZConsOutput() {return zconsOutput;} |
378 |
< |
|
378 |
> |
|
379 |
|
virtual void integrate(); |
521 |
– |
|
380 |
|
|
381 |
+ |
|
382 |
|
#ifdef IS_MPI |
383 |
|
virtual void update(); //which is called to indicate the molecules' migration |
384 |
|
#endif |
385 |
|
|
386 |
+ |
enum ZConsState {zcsMoving, zcsFixed}; |
387 |
+ |
|
388 |
+ |
vector<Molecule*> zconsMols; //z-constraint molecules array |
389 |
+ |
vector<ZConsState> states; //state of z-constraint molecules |
390 |
+ |
|
391 |
+ |
|
392 |
+ |
|
393 |
+ |
int totNumOfUnconsAtoms; //total number of uncontraint atoms |
394 |
+ |
double totalMassOfUncons; //total mas of unconstraint molecules |
395 |
+ |
|
396 |
+ |
|
397 |
|
protected: |
398 |
|
|
399 |
< |
enum ZConsState {zcsMoving, zcsFixed}; |
400 |
< |
|
401 |
< |
virtual void calcForce( int calcPot, int calcStress ); |
399 |
> |
|
400 |
> |
|
401 |
> |
virtual void calcForce( int calcPot, int calcStress ); |
402 |
|
virtual void thermalize(void); |
403 |
< |
|
403 |
> |
|
404 |
|
void zeroOutVel(); |
405 |
|
void doZconstraintForce(); |
406 |
|
void doHarmonic(); |
418 |
|
double zconsTol; //tolerance of z-contratint |
419 |
|
double zForceConst; //base force constant term |
420 |
|
//which is estimate by OOPSE |
421 |
< |
|
422 |
< |
vector<Molecule*> zconsMols; //z-constraint molecules array |
423 |
< |
vector<double> massOfZConsMols; //mass of z-constraint molecule |
421 |
> |
|
422 |
> |
|
423 |
> |
vector<double> massOfZConsMols; //mass of z-constraint molecule |
424 |
|
vector<double> kz; //force constant array |
425 |
< |
vector<ZConsState> states; //state of z-constraint molecules |
425 |
> |
|
426 |
|
vector<double> zPos; // |
427 |
< |
|
428 |
< |
|
427 |
> |
|
428 |
> |
|
429 |
|
vector<Molecule*> unconsMols; //unconstraint molecules array |
430 |
|
vector<double> massOfUnconsMols; //mass array of unconstraint molecules |
561 |
– |
double totalMassOfUncons; //total mas of unconstraint molecules |
431 |
|
|
432 |
+ |
|
433 |
|
vector<ZConsParaItem>* parameters; // |
434 |
< |
|
434 |
> |
|
435 |
|
vector<int> indexOfAllZConsMols; //index of All Z-Constraint Molecuels |
436 |
|
|
437 |
< |
int* indexOfZConsMols; //index of local Z-Constraint Molecules |
437 |
> |
int* indexOfZConsMols; //index of local Z-Constraint Molecules |
438 |
|
double* fz; |
439 |
|
double* curZPos; |
570 |
– |
|
571 |
– |
int totNumOfUnconsAtoms; //total number of uncontraint atoms |
440 |
|
|
441 |
< |
int whichDirection; //constraint direction |
442 |
< |
|
441 |
> |
|
442 |
> |
|
443 |
> |
int whichDirection; //constraint direction |
444 |
> |
|
445 |
|
private: |
446 |
< |
|
446 |
> |
|
447 |
|
string zconsOutput; //filename of zconstraint output |
448 |
|
ZConsWriter* fzOut; //z-constraint writer |
449 |
|
|
450 |
< |
double curZconsTime; |
450 |
> |
double curZconsTime; |
451 |
|
|
452 |
|
double calcMovingMolsCOMVel(); |
453 |
|
double calcSysCOMVel(); |
454 |
|
double calcTotalForce(); |
455 |
< |
|
455 |
> |
|
456 |
|
ForceSubtractionPolicy* forcePolicy; //force subtraction policy |
457 |
|
friend class ForceSubtractionPolicy; |
458 |
|
|