--- trunk/OOPSE/libmdtools/Integrator.hpp 2003/09/09 20:35:25 755 +++ trunk/OOPSE/libmdtools/Integrator.hpp 2003/09/15 16:52:02 763 @@ -27,8 +27,8 @@ template class Integrator Integrator( SimInfo *theInfo, ForceFields* the_ff ); virtual ~Integrator(); void integrate( void ); + virtual double getConservedQuantity(void); - protected: virtual void integrateStep( int calcPot, int calcStress ); @@ -40,7 +40,7 @@ template class Integrator virtual int readyCheck( void ) { return 1; } virtual void resetIntegrator( void ) { } - + virtual void calcForce( int calcPot, int calcStress ); virtual void thermalize(); @@ -95,10 +95,12 @@ template class NVT : public T { (public) public: NVT ( SimInfo *theInfo, ForceFields* the_ff); - virtual ~NVT() {} + virtual ~NVT(); void setTauThermostat(double tt) {tauThermostat = tt; have_tau_thermostat=1;} void setTargetTemp(double tt) {targetTemp = tt; have_target_temp = 1;} + void setChiTolerance(double tol) {chiTolerance = tol;} + virtual double getConservedQuantity(void); protected: @@ -113,6 +115,9 @@ template class NVT : public T { (public) double chi; + //integral of chi(t)dt + double integralOfChidt; + // targetTemp must be set. tauThermostat must also be set; double targetTemp; @@ -120,6 +125,12 @@ template class NVT : public T { (public) short int have_tau_thermostat, have_target_temp; + double *oldVel; + double *oldJi; + + double chiTolerance; + short int have_chi_tolerance; + }; @@ -129,17 +140,23 @@ template class NPTi : public T{ (public) public: NPTi ( SimInfo *theInfo, ForceFields* the_ff); - virtual ~NPTi() {}; - + virtual ~NPTi(); + 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; have_chi_tolerance = 1;} + void setPosIterTolerance(double tol) {posIterTolerance = tol; have_pos_iter_tolerance = 1;} + void setEtaTolerance(double tol) {etaTolerance = tol; have_eta_tolerance = 1;} protected: @@ -150,12 +167,19 @@ template class NPTi : public T{ (public) virtual void resetIntegrator( void ); + void accIntegralOfChidt(void) { integralOfChidt += dt * chi;} + // chi and eta are the propagated degrees of freedom double chi; double eta; double NkBT; + double fkBT; + int Nparticles; + + double integralOfChidt; + // targetTemp, targetPressure, and tauBarostat must be set. // One of qmass or tauThermostat must be set; @@ -166,6 +190,19 @@ template class NPTi : public T{ (public) short int have_tau_thermostat, have_tau_barostat, have_target_temp; short int have_target_pressure; + + double *oldPos; + double *oldVel; + double *oldJi; + + double chiTolerance; + short int have_chi_tolerance; + double posIterTolerance; + short int have_pos_iter_tolerance; + double etaTolerance; + short int have_eta_tolerance; + + double volume; }; @@ -174,17 +211,22 @@ template class NPTim : public T{ (public) public: NPTim ( SimInfo *theInfo, ForceFields* the_ff); - virtual ~NPTim() {}; + virtual ~NPTim() {} 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: @@ -195,6 +237,8 @@ template class NPTim : public T{ (public) virtual void resetIntegrator( void ); + void accIntegralOfChidt(void) { integralOfChidt += dt * chi;} + Molecule* myMolecules; Atom** myAtoms; @@ -203,6 +247,7 @@ template class NPTim : public T{ (public) double chi; double eta; double NkBT; + double integralOfChidt; // targetTemp, targetPressure, and tauBarostat must be set. // One of qmass or tauThermostat must be set; @@ -214,6 +259,10 @@ template class NPTim : public T{ (public) 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; }; @@ -276,12 +325,17 @@ template class NPTf : public T{ (public) 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: @@ -292,12 +346,16 @@ template class NPTf : public T{ (public) virtual int readyCheck(); + void accIntegralOfChidt(void) { integralOfChidt += dt * chi;} + // 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; @@ -308,6 +366,10 @@ template class NPTf : public T{ (public) 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; }; @@ -372,12 +434,17 @@ template class NPTfm : public T{ (public) 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: @@ -388,6 +455,8 @@ template class NPTfm : public T{ (public) virtual int readyCheck(); + void accIntegralOfChidt(void) { integralOfChidt += dt * chi;} + Molecule* myMolecules; Atom** myAtoms; @@ -396,6 +465,7 @@ template class NPTfm : public T{ (public) 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; @@ -407,6 +477,10 @@ template class NPTfm : public T{ (public) 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; }; @@ -427,6 +501,8 @@ template class NPTpr : public T{ (public) 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: @@ -453,6 +529,10 @@ template class NPTpr : public T{ (public) 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; }; @@ -485,7 +565,7 @@ template class ZConstraint : public T { virtual double getHFOfUnconsMols(Atom* atom, double totalForce); private: - int totNumOfMovingAtoms; + int totNumOfMovingAtoms; }; class PolicyByMass : public ForceSubtractionPolicy{