--- trunk/OOPSE/libmdtools/Integrator.hpp 2003/07/22 19:54:52 645 +++ trunk/OOPSE/libmdtools/Integrator.hpp 2003/08/14 16:16:39 696 @@ -1,6 +1,8 @@ #ifndef _INTEGRATOR_H_ #define _INTEGRATOR_H_ +#include +#include #include "Atom.hpp" #include "Molecule.hpp" #include "SRI.hpp" @@ -9,7 +11,9 @@ #include "ForceFields.hpp" #include "Thermo.hpp" #include "ReadWrite.hpp" +#include "ZConsWriter.hpp" +using namespace std; const double kB = 8.31451e-7;// boltzmann constant amu*Ang^2*fs^-2/K const double eConvert = 4.184e-4; // converts kcal/mol -> amu*A^2/fs^2 const double p_convert = 1.63882576e8; //converts amu*fs^-2*Ang^-1 -> atm @@ -34,12 +38,14 @@ template class Integrator virtual void constrainA( void ); virtual void constrainB( void ); virtual int readyCheck( void ) { return 1; } + + virtual void calcForce( int calcPot, int calcStress ); + virtual void thermalize(); void checkConstraints( void ); void rotate( int axes1, int axes2, double angle, double j[3], double A[3][3] ); - - + ForceFields* myFF; SimInfo *info; // all the info we'll ever need @@ -289,7 +295,89 @@ template class NPTfm : public T{ (protecte short int have_tau_thermostat, have_tau_barostat, have_target_temp; short int have_target_pressure; + +}; + +template class ZConstraint : public T { + +public: + + ZConstraint( SimInfo *theInfo, ForceFields* the_ff); + ~ZConstraint(); + + void setZConsTime(double time) {this->zconsTime = time;} + void getZConsTime() {return zconsTime;} + + void setIndexOfAllZConsMols(vector index) {indexOfAllZConsMols = index;} + void getIndexOfAllZConsMols() {return indexOfAllZConsMols;} + + void setZConsOutput(const char * fileName) {zconsOutput = fileName;} + string getZConsOutput() {return zconsOutput;} + + virtual void integrate(); + + +#ifdef IS_MPI + virtual void update(); //which is called to indicate the molecules' migration +#endif + +protected: + + enum ZConsState {zcsMoving, zcsFixed}; + + + + virtual void calcForce( int calcPot, int calcStress ); + virtual void thermalize(void); + + void zeroOutVel(); + void doZconstraintForce(); + void doHarmonic(); + bool checkZConsState(); + bool haveFixedZMols(); + bool haveMovingZMols(); + + double calcZSys(); + + int isZConstraintMol(Molecule* mol); + + + double zconsTime; + double zconsTol; + double zForceConst; + + vector zconsMols; + vector massOfZConsMols; + vector kz; + vector states; + vector zPos; + + + vector unconsMols; + vector massOfUnconsMols; + double totalMassOfUncons; + + vector* parameters; + + vector indexOfAllZConsMols; //index of All Z-Constraint Molecuels + + int* indexOfZConsMols; //index of local Z-Constraint Molecules + double* fz; + + int totNumOfUnconsAtoms; + + int whichDirection; //constraint direction + +private: + + string zconsOutput; + ZConsWriter* fzOut; + + double calcMovingMolsCOMVel(); + double calcSysCOMVel(); + double calcTotalForce(); + }; #endif