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