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: |
45 |
|
virtual void calcForce( int calcPot, int calcStress ); |
46 |
|
virtual void thermalize(); |
47 |
|
|
48 |
< |
virtual void rotationPropagation( DirectionalAtom* dAtom, double ji[3] ); |
48 |
> |
virtual bool stopIntegrator() {return false;} |
49 |
|
|
50 |
+ |
virtual void rotationPropagation( StuntDouble* sd, double ji[3] ); |
51 |
+ |
|
52 |
|
void checkConstraints( void ); |
53 |
|
void rotate( int axes1, int axes2, double angle, double j[3], |
54 |
|
double A[3][3] ); |
56 |
|
ForceFields* myFF; |
57 |
|
|
58 |
|
SimInfo *info; // all the info we'll ever need |
59 |
+ |
vector<StuntDouble*> integrableObjects; |
60 |
|
int nAtoms; /* the number of atoms */ |
61 |
|
int oldAtoms; |
62 |
|
Atom **atoms; /* array of atom pointers */ |
87 |
|
|
88 |
|
typedef Integrator<BaseIntegrator> RealIntegrator; |
89 |
|
|
90 |
+ |
// ansi instantiation |
91 |
+ |
template class Integrator<BaseIntegrator>; |
92 |
+ |
|
93 |
|
template<typename T> class NVE : public T { |
94 |
|
|
95 |
|
public: |
159 |
|
|
160 |
|
virtual double getConservedQuantity(void) = 0; |
161 |
|
virtual string getAdditionalParameters(void) = 0; |
162 |
+ |
|
163 |
+ |
double myTauThermo( void ) { return tauThermostat; } |
164 |
+ |
double myTauBaro( void ) { return tauBarostat; } |
165 |
+ |
|
166 |
|
void setTauThermostat(double tt) {tauThermostat = tt; have_tau_thermostat=1;} |
167 |
|
void setTauBarostat(double tb) {tauBarostat = tb; have_tau_barostat=1;} |
168 |
|
void setTargetTemp(double tt) {targetTemp = tt; have_target_temp = 1;} |
185 |
|
virtual void getPosScale(double pos[3], double COM[3], |
186 |
|
int index, double sc[3]) = 0; |
187 |
|
|
188 |
+ |
virtual void calcVelScale( void ) = 0; |
189 |
+ |
|
190 |
|
virtual bool chiConverged( void ); |
191 |
|
virtual bool etaConverged( void ) = 0; |
192 |
|
|
264 |
|
virtual void getPosScale(double pos[3], double COM[3], |
265 |
|
int index, double sc[3]); |
266 |
|
|
267 |
+ |
virtual void calcVelScale( void ); |
268 |
+ |
|
269 |
|
double eta, oldEta, prevEta; |
270 |
+ |
double vScale; |
271 |
|
}; |
272 |
|
|
273 |
|
template<typename T> class NPTf : public T{ |
294 |
|
virtual void getVelScaleB( double sc[3], int index ); |
295 |
|
virtual void getPosScale(double pos[3], double COM[3], |
296 |
|
int index, double sc[3]); |
297 |
+ |
|
298 |
+ |
virtual void calcVelScale( void ); |
299 |
|
|
300 |
|
double eta[3][3]; |
301 |
|
double oldEta[3][3]; |
302 |
|
double prevEta[3][3]; |
303 |
+ |
double vScale[3][3]; |
304 |
|
}; |
305 |
|
|
306 |
|
template<typename T> class NPTxyz : public T{ |
328 |
|
virtual void getPosScale(double pos[3], double COM[3], |
329 |
|
int index, double sc[3]); |
330 |
|
|
331 |
+ |
virtual void calcVelScale( void ); |
332 |
+ |
|
333 |
|
double eta[3][3]; |
334 |
|
double oldEta[3][3]; |
335 |
|
double prevEta[3][3]; |
336 |
+ |
double vScale[3][3]; |
337 |
|
}; |
338 |
|
|
339 |
|
|
424 |
|
|
425 |
|
void zeroOutVel(); |
426 |
|
void doZconstraintForce(); |
427 |
< |
void doHarmonic(); |
427 |
> |
void doHarmonic(vector<double>& resPos); |
428 |
|
bool checkZConsState(); |
429 |
|
|
430 |
|
bool haveFixedZMols(); |
455 |
|
|
456 |
|
vector<int> indexOfAllZConsMols; //index of All Z-Constraint Molecuels |
457 |
|
|
458 |
< |
int* indexOfZConsMols; //index of local Z-Constraint Molecules |
459 |
< |
double* fz; |
460 |
< |
double* curZPos; |
458 |
> |
vector<int> indexOfZConsMols; //index of local Z-Constraint Molecules |
459 |
> |
vector<double> fz; |
460 |
> |
vector<double> curZPos; |
461 |
|
|
462 |
+ |
bool usingSMD; |
463 |
+ |
vector<double> prevCantPos; |
464 |
+ |
vector<double> cantPos; |
465 |
+ |
vector<double> cantVel; |
466 |
|
|
467 |
< |
|
467 |
> |
double zconsFixTime; |
468 |
> |
double zconsGap; |
469 |
> |
bool hasZConsGap; |
470 |
> |
vector<double> endFixTime; |
471 |
> |
|
472 |
|
int whichDirection; //constraint direction |
473 |
|
|
474 |
|
private: |
481 |
|
double calcMovingMolsCOMVel(); |
482 |
|
double calcSysCOMVel(); |
483 |
|
double calcTotalForce(); |
484 |
< |
|
484 |
> |
void updateZPos(); |
485 |
> |
void updateCantPos(); |
486 |
> |
|
487 |
|
ForceSubtractionPolicy* forcePolicy; //force subtraction policy |
488 |
|
friend class ForceSubtractionPolicy; |
489 |
+ |
|
490 |
+ |
}; |
491 |
+ |
|
492 |
+ |
/* |
493 |
+ |
template<typename T> class SingleZConstrain : public T{ |
494 |
+ |
|
495 |
|
|
496 |
|
}; |
497 |
+ |
*/ |
498 |
|
|
499 |
+ |
template<typename T> class NonEquMD : public T { |
500 |
+ |
public: |
501 |
+ |
|
502 |
+ |
|
503 |
+ |
|
504 |
+ |
}; |
505 |
+ |
|
506 |
+ |
|
507 |
+ |
// |
508 |
+ |
template<typename T> class SingleZConstraint : public T{ |
509 |
+ |
public: |
510 |
+ |
SingleZConstraint(SimInfo *theInfo, ForceFields* the_ff); |
511 |
+ |
~SingleZConstraint(); |
512 |
+ |
|
513 |
+ |
bool stopIntegrator(); |
514 |
+ |
|
515 |
+ |
protected: |
516 |
+ |
|
517 |
+ |
}; |
518 |
+ |
|
519 |
+ |
//Steered Molecular Dynamics, curret implement only support one steered molecule |
520 |
+ |
template<typename T> class SMD : public T{ |
521 |
+ |
public: |
522 |
+ |
SMD( SimInfo *theInfo, ForceFields* the_ff); |
523 |
+ |
~SMD(); |
524 |
+ |
|
525 |
+ |
virtual void integrate(); |
526 |
+ |
virtual void calcForce( int calcPot, int calcStress ); |
527 |
+ |
bool stopIntegrator(); |
528 |
+ |
private: |
529 |
+ |
|
530 |
+ |
}; |
531 |
+ |
|
532 |
+ |
//By using state pattern, Coordinate Drive is responsible for switching back and forth between |
533 |
+ |
//Driven Molecular Dynamics and ZConstraint Method. |
534 |
+ |
template<typename T> class CoordinateDriver : public T { |
535 |
+ |
public: |
536 |
+ |
typedef T ParentIntegrator; |
537 |
+ |
|
538 |
+ |
CoordinateDriver(SimInfo*, ForceFields*, BaseIntegrator*, BaseIntegrator*); |
539 |
+ |
~CoordinateDriver(); |
540 |
+ |
|
541 |
+ |
virtual void integrate(); |
542 |
+ |
|
543 |
+ |
private: |
544 |
+ |
BaseIntegrator* zconsIntegrator; |
545 |
+ |
BaseIntegrator* drivenIntegrator; |
546 |
+ |
|
547 |
+ |
}; |
548 |
+ |
|
549 |
|
#endif |