--- trunk/OOPSE/libmdtools/Integrator.hpp 2003/05/30 19:07:45 540 +++ trunk/OOPSE/libmdtools/Integrator.hpp 2003/07/14 15:04:55 596 @@ -9,24 +9,30 @@ class Integrator : public BaseIntegrator { #include "Thermo.hpp" #include "ReadWrite.hpp" +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 +const int maxIteration = 300; +const double tol = 1.0e-6; + class Integrator : public BaseIntegrator { public: - Symplectic( SimInfo &theInfo, ForceFields* the_ff ); - virtual ~Symplectic(); + Integrator( SimInfo *theInfo, ForceFields* the_ff ); + virtual ~Integrator(); void integrate( void ); protected: - virtual void integrateStep( int calcPot, int calcStress ); + virtual void preMove( void ); virtual void moveA( void ); virtual void moveB( void ); virtual void constrainA( void ); virtual void constrainB( void ); + virtual int readyCheck( void ) { return 1; } - void checkConstraints( void ); void rotate( int axes1, int axes2, double angle, double j[3], double A[3][3] ); @@ -36,20 +42,32 @@ class Integrator : public BaseIntegrator { (protected) SimInfo *info; // all the info we'll ever need int nAtoms; /* the number of atoms */ + int oldAtoms; Atom **atoms; /* array of atom pointers */ Molecule* molecules; int nMols; - int isConstrained; /*boolean to know whether the systems contains - constraints. */ - int nConstrained; /*counter for number of constraints */ - int *constrainedI; /* the i of a constraint pair */ - int *constrainedJ; /* the j of a constraint pair */ - double *constrainedDsqr; /* the square of the constraint distance */ + int isConstrained; // boolean to know whether the systems contains + // constraints. + int nConstrained; // counter for number of constraints + int *constrainedA; // the i of a constraint pair + int *constrainedB; // the j of a constraint pair + double *constrainedDsqr; // the square of the constraint distance + + int* moving; // tells whether we are moving atom i + int* moved; // tells whether we have moved atom i + double* oldPos; // pre constrained positions + short isFirst; /*boolean for the first time integrate is called */ double dt; + double dt2; + double* pos; + double* vel; + double* frc; + double* trq; + double* Amat; Thermo *tStats; StatWriter* statOut; @@ -57,19 +75,218 @@ class Integrator : public BaseIntegrator { (protected) }; +class NVE : public Integrator{ +public: + NVE ( SimInfo *theInfo, ForceFields* the_ff ): + Integrator( theInfo, the_ff ){} + virtual ~NVE(){} + + + +}; + class NVT : public Integrator{ - NVT ( void ); - virtual ~NVT(); +public: + NVT ( SimInfo *theInfo, ForceFields* the_ff); + virtual ~NVT() {} + + void setTauThermostat(double tt) {tauThermostat = tt; have_tau_thermostat=1;} + void setTargetTemp(double tt) {targetTemp = tt; have_target_temp = 1;} + protected: - virtual moveA( void ); - virtual moveB( void ); -}; + virtual void moveA( void ); + virtual void moveB( void ); + virtual int readyCheck(); + + // chi is a propagated degree of freedom. + + double chi; + + // targetTemp must be set. tauThermostat must also be set; + + double targetTemp; + double tauThermostat; + short int have_tau_thermostat, have_target_temp; +}; + +class NPTi : public Integrator{ + +public: + + NPTi ( SimInfo *theInfo, ForceFields* the_ff); + virtual ~NPTi() {}; + + virtual void integrateStep( int calcPot, int calcStress ){ + calcStress = 1; + Integrator::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(); + + // chi and eta are the propagated degrees of freedom + + double chi; + double eta; + 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; + +}; + +class NPTim : public Integrator{ + +public: + + NPTim ( SimInfo *theInfo, ForceFields* the_ff); + virtual ~NPTim() {}; + + virtual void integrateStep( int calcPot, int calcStress ){ + calcStress = 1; + Integrator::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(); + + // chi and eta are the propagated degrees of freedom + + double chi; + double eta; + 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; + +}; + +class NPTf : public Integrator{ + +public: + + NPTf ( SimInfo *theInfo, ForceFields* the_ff); + virtual ~NPTf() {}; + + virtual void integrateStep( int calcPot, int calcStress ){ + calcStress = 1; + Integrator::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(); + + // 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; + +}; + +class NPTfm : public Integrator{ + +public: + + NPTfm ( SimInfo *theInfo, ForceFields* the_ff); + virtual ~NPTfm() {}; + + virtual void integrateStep( int calcPot, int calcStress ){ + calcStress = 1; + Integrator::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(); + + // 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; + +}; + #endif