--- trunk/OOPSE/libmdtools/Integrator.hpp 2003/10/29 20:41:39 843 +++ trunk/OOPSE/libmdtools/Integrator.hpp 2004/05/11 21:44:05 1161 @@ -4,6 +4,7 @@ #include #include #include "Atom.hpp" +#include "StuntDouble.hpp" #include "Molecule.hpp" #include "SRI.hpp" #include "AbstractClasses.hpp" @@ -20,7 +21,6 @@ const double tol = 1.0e-6; const int maxIteration = 300; const double tol = 1.0e-6; - template class Integrator : public T { public: @@ -45,8 +45,10 @@ template class Integrator virtual void calcForce( int calcPot, int calcStress ); virtual void thermalize(); - virtual void rotationPropagation( DirectionalAtom* dAtom, double ji[3] ); + virtual bool stopIntegrator() {return false;} + virtual void rotationPropagation( StuntDouble* sd, double ji[3] ); + void checkConstraints( void ); void rotate( int axes1, int axes2, double angle, double j[3], double A[3][3] ); @@ -54,6 +56,7 @@ template class Integrator ForceFields* myFF; SimInfo *info; // all the info we'll ever need + vector integrableObjects; int nAtoms; /* the number of atoms */ int oldAtoms; Atom **atoms; /* array of atom pointers */ @@ -84,6 +87,9 @@ template class NVE : public T { typedef Integrator RealIntegrator; +// ansi instantiation +template class Integrator; + template class NVE : public T { public: @@ -179,6 +185,8 @@ template class NPT : public T{ (protected) virtual void getPosScale(double pos[3], double COM[3], int index, double sc[3]) = 0; + virtual void calcVelScale( void ) = 0; + virtual bool chiConverged( void ); virtual bool etaConverged( void ) = 0; @@ -255,8 +263,11 @@ template class NPTi : public T{ (protected virtual void getVelScaleB( double sc[3], int index ); virtual void getPosScale(double pos[3], double COM[3], int index, double sc[3]); + + virtual void calcVelScale( void ); double eta, oldEta, prevEta; + double vScale; }; template class NPTf : public T{ @@ -284,9 +295,12 @@ template class NPTf : public T{ (protected virtual void getPosScale(double pos[3], double COM[3], int index, double sc[3]); + virtual void calcVelScale( void ); + double eta[3][3]; double oldEta[3][3]; double prevEta[3][3]; + double vScale[3][3]; }; template class NPTxyz : public T{ @@ -314,9 +328,12 @@ template class NPTxyz : public T{ (protect virtual void getPosScale(double pos[3], double COM[3], int index, double sc[3]); + virtual void calcVelScale( void ); + double eta[3][3]; double oldEta[3][3]; double prevEta[3][3]; + double vScale[3][3]; }; @@ -407,7 +424,7 @@ template class ZConstraint : public T { (p void zeroOutVel(); void doZconstraintForce(); - void doHarmonic(); + void doHarmonic(vector& resPos); bool checkZConsState(); bool haveFixedZMols(); @@ -438,12 +455,20 @@ template class ZConstraint : public T { (p vector indexOfAllZConsMols; //index of All Z-Constraint Molecuels - int* indexOfZConsMols; //index of local Z-Constraint Molecules - double* fz; - double* curZPos; + vector indexOfZConsMols; //index of local Z-Constraint Molecules + vector fz; + vector curZPos; + bool usingSMD; + vector prevCantPos; + vector cantPos; + vector cantVel; - + double zconsFixTime; + double zconsGap; + bool hasZConsGap; + vector endFixTime; + int whichDirection; //constraint direction private: @@ -456,10 +481,69 @@ template class ZConstraint : public T { (p double calcMovingMolsCOMVel(); double calcSysCOMVel(); double calcTotalForce(); - + void updateZPos(); + void updateCantPos(); + ForceSubtractionPolicy* forcePolicy; //force subtraction policy friend class ForceSubtractionPolicy; + +}; + +/* +template class SingleZConstrain : public T{ + + +}; +*/ +template class NonEquMD : public T { + public: + + + }; + +// +template class SingleZConstraint : public T{ + public: + SingleZConstraint(SimInfo *theInfo, ForceFields* the_ff); + ~SingleZConstraint(); + + bool stopIntegrator(); + + protected: + +}; + +//Steered Molecular Dynamics, curret implement only support one steered molecule + template class SMD : public T{ + public: + SMD( SimInfo *theInfo, ForceFields* the_ff); + ~SMD(); + + virtual void integrate(); + virtual void calcForce( int calcPot, int calcStress ); + bool stopIntegrator(); + private: + +}; + +//By using state pattern, Coordinate Drive is responsible for switching back and forth between +//Driven Molecular Dynamics and ZConstraint Method. +template class CoordinateDriver : public T { + public: + typedef T ParentIntegrator; + + CoordinateDriver(SimInfo*, ForceFields*, BaseIntegrator*, BaseIntegrator*); + ~CoordinateDriver(); + + virtual void integrate(); + + private: + BaseIntegrator* zconsIntegrator; + BaseIntegrator* drivenIntegrator; + +}; + #endif