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" |
13 |
|
#include "Thermo.hpp" |
14 |
|
#include "ReadWrite.hpp" |
15 |
|
#include "ZConsWriter.hpp" |
16 |
+ |
#include "Restraints.hpp" |
17 |
|
|
18 |
|
using namespace std; |
19 |
|
const double kB = 8.31451e-7;// boltzmann constant amu*Ang^2*fs^-2/K |
22 |
|
const int maxIteration = 300; |
23 |
|
const double tol = 1.0e-6; |
24 |
|
|
23 |
– |
|
25 |
|
template<typename T = BaseIntegrator> class Integrator : public T { |
26 |
|
|
27 |
|
public: |
46 |
|
virtual void calcForce( int calcPot, int calcStress ); |
47 |
|
virtual void thermalize(); |
48 |
|
|
49 |
< |
virtual void rotationPropagation( DirectionalAtom* dAtom, double ji[3] ); |
49 |
> |
virtual bool stopIntegrator() {return false;} |
50 |
|
|
51 |
+ |
virtual void rotationPropagation( StuntDouble* sd, double ji[3] ); |
52 |
+ |
|
53 |
|
void checkConstraints( void ); |
54 |
|
void rotate( int axes1, int axes2, double angle, double j[3], |
55 |
|
double A[3][3] ); |
57 |
|
ForceFields* myFF; |
58 |
|
|
59 |
|
SimInfo *info; // all the info we'll ever need |
60 |
+ |
vector<StuntDouble*> integrableObjects; |
61 |
|
int nAtoms; /* the number of atoms */ |
62 |
|
int oldAtoms; |
63 |
|
Atom **atoms; /* array of atom pointers */ |
84 |
|
StatWriter* statOut; |
85 |
|
DumpWriter* dumpOut; |
86 |
|
|
87 |
+ |
int i; // just an int |
88 |
|
}; |
89 |
|
|
90 |
|
typedef Integrator<BaseIntegrator> RealIntegrator; |
91 |
|
|
92 |
+ |
// ansi instantiation |
93 |
+ |
template class Integrator<BaseIntegrator>; |
94 |
+ |
|
95 |
|
template<typename T> class NVE : public T { |
96 |
|
|
97 |
|
public: |
426 |
|
|
427 |
|
void zeroOutVel(); |
428 |
|
void doZconstraintForce(); |
429 |
< |
void doHarmonic(); |
429 |
> |
void doHarmonic(vector<double>& resPos); |
430 |
|
bool checkZConsState(); |
431 |
|
|
432 |
|
bool haveFixedZMols(); |
457 |
|
|
458 |
|
vector<int> indexOfAllZConsMols; //index of All Z-Constraint Molecuels |
459 |
|
|
460 |
< |
int* indexOfZConsMols; //index of local Z-Constraint Molecules |
461 |
< |
double* fz; |
462 |
< |
double* curZPos; |
460 |
> |
vector<int> indexOfZConsMols; //index of local Z-Constraint Molecules |
461 |
> |
vector<double> fz; |
462 |
> |
vector<double> curZPos; |
463 |
> |
|
464 |
> |
bool usingSMD; |
465 |
> |
vector<double> prevCantPos; |
466 |
> |
vector<double> cantPos; |
467 |
> |
vector<double> cantVel; |
468 |
|
|
469 |
|
double zconsFixTime; |
470 |
|
double zconsGap; |
484 |
|
double calcSysCOMVel(); |
485 |
|
double calcTotalForce(); |
486 |
|
void updateZPos(); |
487 |
< |
|
487 |
> |
void updateCantPos(); |
488 |
> |
|
489 |
|
ForceSubtractionPolicy* forcePolicy; //force subtraction policy |
490 |
|
friend class ForceSubtractionPolicy; |
491 |
|
|
492 |
|
}; |
493 |
|
|
494 |
|
/* |
495 |
< |
//Steered Molecular Dynamics |
495 |
> |
template<typename T> class SingleZConstrain : public T{ |
496 |
> |
|
497 |
> |
|
498 |
> |
}; |
499 |
> |
*/ |
500 |
> |
|
501 |
> |
template<typename T> class NonEquMD : public T { |
502 |
> |
public: |
503 |
> |
|
504 |
> |
|
505 |
> |
|
506 |
> |
}; |
507 |
> |
|
508 |
> |
|
509 |
> |
// |
510 |
> |
template<typename T> class SingleZConstraint : public T{ |
511 |
> |
public: |
512 |
> |
SingleZConstraint(SimInfo *theInfo, ForceFields* the_ff); |
513 |
> |
~SingleZConstraint(); |
514 |
> |
|
515 |
> |
bool stopIntegrator(); |
516 |
> |
|
517 |
> |
protected: |
518 |
> |
|
519 |
> |
}; |
520 |
> |
|
521 |
> |
//Steered Molecular Dynamics, curret implement only support one steered molecule |
522 |
|
template<typename T> class SMD : public T{ |
523 |
|
public: |
524 |
|
SMD( SimInfo *theInfo, ForceFields* the_ff); |
525 |
|
~SMD(); |
526 |
|
|
527 |
< |
virtual void integrate(); |
528 |
< |
virtual void calcForce( int calcPot, int calcStress ); |
527 |
> |
virtual void integrate(); |
528 |
> |
virtual void calcForce( int calcPot, int calcStress ); |
529 |
> |
bool stopIntegrator(); |
530 |
> |
private: |
531 |
> |
|
532 |
|
}; |
533 |
< |
*/ |
533 |
> |
|
534 |
> |
//By using state pattern, Coordinate Drive is responsible for switching back and forth between |
535 |
> |
//Driven Molecular Dynamics and ZConstraint Method. |
536 |
> |
template<typename T> class CoordinateDriver : public T { |
537 |
> |
public: |
538 |
> |
typedef T ParentIntegrator; |
539 |
> |
|
540 |
> |
CoordinateDriver(SimInfo*, ForceFields*, BaseIntegrator*, BaseIntegrator*); |
541 |
> |
~CoordinateDriver(); |
542 |
> |
|
543 |
> |
virtual void integrate(); |
544 |
> |
|
545 |
> |
private: |
546 |
> |
BaseIntegrator* zconsIntegrator; |
547 |
> |
BaseIntegrator* drivenIntegrator; |
548 |
> |
|
549 |
> |
}; |
550 |
> |
|
551 |
|
#endif |