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