--- trunk/OOPSE/libmdtools/Integrator.hpp 2003/09/19 20:00:27 778 +++ trunk/OOPSE/libmdtools/Integrator.hpp 2003/10/22 21:17:32 812 @@ -195,6 +195,7 @@ template class NPT : public T{ (protected) double tt2, tb2; double instaTemp, instaPress, instaVol; + double press[3][3]; int Nparticles; @@ -252,344 +253,65 @@ template class NPTi : public T{ (protected double eta, oldEta, prevEta; }; - -template class NPTim : public T{ +template class NPTf : public T{ public: - - NPTim ( SimInfo *theInfo, ForceFields* the_ff); - virtual ~NPTim() {} - virtual void integrateStep( int calcPot, int calcStress ){ - calcStress = 1; - T::integrateStep( calcPot, calcStress ); - accIntegralOfChidt(); - } + NPTf ( SimInfo *theInfo, ForceFields* the_ff); + virtual ~NPTf(); virtual double getConservedQuantity(void); + virtual void resetIntegrator(void); - void setTauThermostat(double tt) {tauThermostat = tt; have_tau_thermostat=1;} - void setTauBarostat(double tb) {tauBarostat = tb; have_tau_barostat=1;} - void setTargetTemp(double tt) {targetTemp = tt; have_target_temp = 1;} - void setTargetPressure(double tp) {targetPressure = tp; have_target_pressure = 1;} - void setChiTolerance(double tol) {chiTolerance = tol;} - void setPosIterTolerance(double tol) {posIterTolerance = tol;} - protected: - virtual void moveA( void ); - virtual void moveB( void ); + virtual void evolveEtaA(void); + virtual void evolveEtaB(void); - virtual int readyCheck(); + virtual bool etaConverged( void ); - virtual void resetIntegrator( void ); + virtual void scaleSimBox( void ); - void accIntegralOfChidt(void) { integralOfChidt += dt * chi;} - - Molecule* myMolecules; - Atom** myAtoms; - - // chi and eta are the propagated degrees of freedom - - double chi; - double eta; - double NkBT; - double integralOfChidt; - - // targetTemp, targetPressure, and tauBarostat must be set. - // One of qmass or tauThermostat must be set; - - double targetTemp; - double targetPressure; - double tauThermostat; - double tauBarostat; + virtual void getVelScaleA( double sc[3], double vel[3] ); + virtual void getVelScaleB( double sc[3], int index ); + virtual void getPosScale(double pos[3], double COM[3], + int index, double sc[3]); - short int have_tau_thermostat, have_tau_barostat, have_target_temp; - short int have_target_pressure; - double chiTolerance; - short int have_chi_tolerance; - double posIterTolerance; - short int have_pos_iter_tolerance; - + double eta[3][3]; + double oldEta[3][3]; + double prevEta[3][3]; }; -template class NPTzm : public T{ +template class NPTxyz : public T{ public: - NPTzm ( SimInfo *theInfo, ForceFields* the_ff); - virtual ~NPTzm() {}; + NPTxyz ( SimInfo *theInfo, ForceFields* the_ff); + virtual ~NPTxyz(); - virtual void integrateStep( int calcPot, int calcStress ){ - calcStress = 1; - T::integrateStep( calcPot, calcStress ); - } + virtual double getConservedQuantity(void); + virtual void resetIntegrator(void); - void setTauThermostat(double tt) {tauThermostat = tt; have_tau_thermostat=1;} - void setTauBarostat(double tb) {tauBarostat = tb; have_tau_barostat=1;} - void setTargetTemp(double tt) {targetTemp = tt; have_target_temp = 1;} - void setTargetPressure(double tp) {targetPressure = tp; have_target_pressure = 1;} - protected: - virtual void moveA( void ); - virtual void moveB( void ); + virtual void evolveEtaA(void); + virtual void evolveEtaB(void); - virtual int readyCheck(); + virtual bool etaConverged( void ); - virtual void resetIntegrator( void ); - - Molecule* myMolecules; - Atom** myAtoms; + virtual void scaleSimBox( void ); - // chi and eta are the propagated degrees of freedom + virtual void getVelScaleA( double sc[3], double vel[3] ); + virtual void getVelScaleB( double sc[3], int index ); + virtual void getPosScale(double pos[3], double COM[3], + int index, double sc[3]); - double chi; - double eta; - double etaZ; - double NkBT; - - // targetTemp, targetPressure, and tauBarostat must be set. - // One of qmass or tauThermostat must be set; - - double targetTemp; - double targetPressure; - double tauThermostat; - double tauBarostat; - - short int have_tau_thermostat, have_tau_barostat, have_target_temp; - short int have_target_pressure; - -}; - -template class NPTf : public T{ - -public: - - NPTf ( SimInfo *theInfo, ForceFields* the_ff); - virtual ~NPTf(); - - virtual void integrateStep( int calcPot, int calcStress ){ - calcStress = 1; - T::integrateStep( calcPot, calcStress ); - } - - virtual double getConservedQuantity(void); - - void setTauThermostat(double tt) {tauThermostat = tt; have_tau_thermostat=1;} - void setTauBarostat(double tb) {tauBarostat = tb; have_tau_barostat=1;} - void setTargetTemp(double tt) {targetTemp = tt; have_target_temp = 1;} - void setTargetPressure(double tp) {targetPressure = tp; have_target_pressure = 1;} - void setChiTolerance(double tol) {chiTolerance = tol;} - void setPosIterTolerance(double tol) {posIterTolerance = tol;} - -protected: - - virtual void moveA( void ); - virtual void moveB( void ); - - virtual void resetIntegrator( void ); - - virtual int readyCheck(); - - - // chi and eta are the propagated degrees of freedom - - double chi; double eta[3][3]; - double NkBT; - double fkBT; - - int Nparticles; - - double *oldPos; - double *oldVel; - double *oldJi; - - double integralOfChidt; - - // targetTemp, targetPressure, and tauBarostat must be set. - // One of qmass or tauThermostat must be set; - - double targetTemp; - double targetPressure; - double tauThermostat; - double tauBarostat; - - short int have_tau_thermostat, have_tau_barostat, have_target_temp; - short int have_target_pressure; - double chiTolerance; - short int have_chi_tolerance; - double posIterTolerance; - short int have_pos_iter_tolerance; - double etaTolerance; - short int have_eta_tolerance; -}; - -template class NPTxym : public T{ - -public: - - NPTxym ( SimInfo *theInfo, ForceFields* the_ff); - virtual ~NPTxym() {}; - - virtual void integrateStep( int calcPot, int calcStress ){ - calcStress = 1; - T::integrateStep( calcPot, calcStress ); - } - - void setTauThermostat(double tt) {tauThermostat = tt; have_tau_thermostat=1;} - void setTauBarostat(double tb) {tauBarostat = tb; have_tau_barostat=1;} - void setTargetTemp(double tt) {targetTemp = tt; have_target_temp = 1;} - void setTargetPressure(double tp) {targetPressure = tp; have_target_pressure = 1;} - -protected: - - virtual void moveA( void ); - virtual void moveB( void ); - - virtual int readyCheck(); - - virtual void resetIntegrator( void ); - - Molecule* myMolecules; - Atom** myAtoms; - - // chi and eta are the propagated degrees of freedom - - double chi; - double eta; - double etaX; - double etaY; - double NkBT; - - // targetTemp, targetPressure, and tauBarostat must be set. - // One of qmass or tauThermostat must be set; - - double targetTemp; - double targetPressure; - double tauThermostat; - double tauBarostat; - - short int have_tau_thermostat, have_tau_barostat, have_target_temp; - short int have_target_pressure; - + double oldEta[3][3]; + double prevEta[3][3]; }; -template class NPTfm : public T{ - -public: - - NPTfm ( SimInfo *theInfo, ForceFields* the_ff); - virtual ~NPTfm() {}; - - virtual void integrateStep( int calcPot, int calcStress ){ - calcStress = 1; - T::integrateStep( calcPot, calcStress ); - accIntegralOfChidt(); - } - - virtual double getConservedQuantity(void); - - void setTauThermostat(double tt) {tauThermostat = tt; have_tau_thermostat=1;} - void setTauBarostat(double tb) {tauBarostat = tb; have_tau_barostat=1;} - void setTargetTemp(double tt) {targetTemp = tt; have_target_temp = 1;} - void setTargetPressure(double tp) {targetPressure = tp; have_target_pressure = 1;} - void setChiTolerance(double tol) {chiTolerance = tol;} - void setPosIterTolerance(double tol) {posIterTolerance = tol;} - -protected: - - virtual void moveA( void ); - virtual void moveB( void ); - - virtual void resetIntegrator( void ); - - virtual int readyCheck(); - - void accIntegralOfChidt(void) { integralOfChidt += dt * chi;} - - Molecule* myMolecules; - Atom** myAtoms; - - // chi and eta are the propagated degrees of freedom - - double chi; - double eta[3][3]; - double NkBT; - double integralOfChidt; - - // targetTemp, targetPressure, and tauBarostat must be set. - // One of qmass or tauThermostat must be set; - - double targetTemp; - double targetPressure; - double tauThermostat; - double tauBarostat; - - short int have_tau_thermostat, have_tau_barostat, have_target_temp; - short int have_target_pressure; - double chiTolerance; - short int have_chi_tolerance; - double posIterTolerance; - short int have_pos_iter_tolerance; - -}; - - -template class NPTpr : public T{ - -public: - - NPTpr ( SimInfo *theInfo, ForceFields* the_ff); - virtual ~NPTpr() {}; - - virtual void integrateStep( int calcPot, int calcStress ){ - calcStress = 1; - T::integrateStep( calcPot, calcStress ); - } - - void setTauThermostat(double tt) {tauThermostat = tt; have_tau_thermostat=1;} - void setTauBarostat(double tb) {tauBarostat = tb; have_tau_barostat=1;} - void setTargetTemp(double tt) {targetTemp = tt; have_target_temp = 1;} - void setTargetPressure(double tp) {targetPressure = tp; have_target_pressure = 1;} - void setChiTolerance(double tol) {chiTolerance = tol;} - void setPosIterTolerance(double tol) {posIterTolerance = tol;} - -protected: - - virtual void moveA( void ); - virtual void moveB( void ); - - virtual int readyCheck(); - - virtual void resetIntegrator( void ); - - // chi and eta are the propagated degrees of freedom - - double chi; - double eta[3][3]; - double NkBT; - - // targetTemp, targetPressure, and tauBarostat must be set. - // One of qmass or tauThermostat must be set; - - double targetTemp; - double targetPressure; - double tauThermostat; - double tauBarostat; - - short int have_tau_thermostat, have_tau_barostat, have_target_temp; - short int have_target_pressure; - double chiTolerance; - short int have_chi_tolerance; - double posIterTolerance; - short int have_pos_iter_tolerance; - -}; - - template class ZConstraint : public T { public: @@ -604,7 +326,7 @@ template class ZConstraint : public T { virtual double getHFOfUnconsMols(Atom* atom, double totalForce) = 0; protected: - ZConstraint* zconsIntegrator;; + ZConstraint* zconsIntegrator; }; class PolicyByNumber : public ForceSubtractionPolicy{ @@ -657,9 +379,20 @@ template class ZConstraint : public T { virtual void update(); //which is called to indicate the molecules' migration #endif + enum ZConsState {zcsMoving, zcsFixed}; + + vector zconsMols; //z-constraint molecules array + vector states; //state of z-constraint molecules + + + + int totNumOfUnconsAtoms; //total number of uncontraint atoms + double totalMassOfUncons; //total mas of unconstraint molecules + + protected: - enum ZConsState {zcsMoving, zcsFixed}; + virtual void calcForce( int calcPot, int calcStress ); virtual void thermalize(void); @@ -682,17 +415,17 @@ template class ZConstraint : public T { double zForceConst; //base force constant term //which is estimate by OOPSE - vector zconsMols; //z-constraint molecules array + vector massOfZConsMols; //mass of z-constraint molecule vector kz; //force constant array - vector states; //state of z-constraint molecules + vector zPos; // vector unconsMols; //unconstraint molecules array vector massOfUnconsMols; //mass array of unconstraint molecules - double totalMassOfUncons; //total mas of unconstraint molecules + vector* parameters; // vector indexOfAllZConsMols; //index of All Z-Constraint Molecuels @@ -701,8 +434,8 @@ template class ZConstraint : public T { double* fz; double* curZPos; - int totNumOfUnconsAtoms; //total number of uncontraint atoms + int whichDirection; //constraint direction private: