| 9 |
|
#include "Thermo.hpp" |
| 10 |
|
#include "ReadWrite.hpp" |
| 11 |
|
|
| 12 |
+ |
const double kB = 8.31451e-7;// boltzmann constant amu*Ang^2*fs^-2/K |
| 13 |
+ |
const double eConvert = 4.184e-4; // converts kcal/mol -> amu*A^2/fs^2 |
| 14 |
+ |
const int maxIteration = 300; |
| 15 |
+ |
const double tol = 1.0e-6; |
| 16 |
+ |
|
| 17 |
|
class Integrator : public BaseIntegrator { |
| 18 |
|
|
| 19 |
|
public: |
| 20 |
< |
Integrator( SimInfo &theInfo, ForceFields* the_ff ); |
| 20 |
> |
Integrator( SimInfo *theInfo, ForceFields* the_ff ); |
| 21 |
|
virtual ~Integrator(); |
| 22 |
|
void integrate( void ); |
| 23 |
|
|
| 34 |
|
|
| 35 |
|
void checkConstraints( void ); |
| 36 |
|
void rotate( int axes1, int axes2, double angle, double j[3], |
| 37 |
< |
double A[3][3] ); |
| 37 |
> |
double A[9] ); |
| 38 |
|
|
| 39 |
|
|
| 40 |
|
ForceFields* myFF; |
| 55 |
|
|
| 56 |
|
int* moving; // tells whether we are moving atom i |
| 57 |
|
int* moved; // tells whether we have moved atom i |
| 58 |
< |
double* prePos; // pre constrained positions |
| 58 |
> |
double* oldPos; // pre constrained positions |
| 59 |
|
|
| 60 |
|
short isFirst; /*boolean for the first time integrate is called */ |
| 61 |
|
|
| 62 |
|
double dt; |
| 63 |
|
double dt2; |
| 64 |
|
|
| 60 |
– |
const double kB = 8.31451e-7; // boltzmann constant in amu*Ang^2*fs^-2/K |
| 61 |
– |
const double eConvert = 4.184e-4; // converts kcal/mol -> amu*A^2/fs^2 |
| 62 |
– |
const int maxIteration = 300; |
| 63 |
– |
const double tol = 1.0e-6; |
| 64 |
– |
|
| 65 |
|
double* pos; |
| 66 |
|
double* vel; |
| 67 |
|
double* frc; |
| 76 |
|
|
| 77 |
|
class NVE : public Integrator{ |
| 78 |
|
|
| 79 |
< |
NVE ( void ): |
| 79 |
> |
public: |
| 80 |
> |
NVE ( SimInfo *theInfo, ForceFields* the_ff ): |
| 81 |
|
Integrator( theInfo, the_ff ){} |
| 82 |
|
virtual ~NVE(){} |
| 83 |
|
|
| 89 |
|
|
| 90 |
|
public: |
| 91 |
|
|
| 92 |
< |
NVT ( SimInfo &theInfo, ForceFields* the_ff) : |
| 93 |
< |
Integrator( theInfo, the_ff ); |
| 93 |
< |
virtual ~NVT(); |
| 92 |
> |
NVT ( SimInfo *theInfo, ForceFields* the_ff); |
| 93 |
> |
virtual ~NVT() {} |
| 94 |
|
|
| 95 |
– |
void setQmass(double q) {qmass = q; have_qmass = 1;} |
| 95 |
|
void setTauThermostat(double tt) {tauThermostat = tt; have_tau_thermostat=1;} |
| 96 |
|
void setTargetTemp(double tt) {targetTemp = tt; have_target_temp = 1;} |
| 97 |
|
|
| 98 |
|
protected: |
| 99 |
|
|
| 100 |
< |
virtual moveA( void ); |
| 101 |
< |
virtual moveB( void ); |
| 100 |
> |
virtual void moveA( void ); |
| 101 |
> |
virtual void moveB( void ); |
| 102 |
|
|
| 103 |
< |
int readyCheck(); |
| 103 |
> |
virtual int readyCheck(); |
| 104 |
|
|
| 105 |
< |
Atom** atoms; |
| 105 |
> |
// chi is a propagated degree of freedom. |
| 106 |
|
|
| 107 |
< |
// zeta is a propagated degree of freedom. |
| 107 |
> |
double chi; |
| 108 |
|
|
| 109 |
< |
double zeta; |
| 109 |
> |
// targetTemp must be set. tauThermostat must also be set; |
| 110 |
|
|
| 112 |
– |
// targetTemp must be set. One of qmass or tauThermostat must be set; |
| 113 |
– |
|
| 114 |
– |
double qmass; |
| 111 |
|
double targetTemp; |
| 112 |
|
double tauThermostat; |
| 113 |
+ |
|
| 114 |
+ |
short int have_tau_thermostat, have_target_temp; |
| 115 |
|
|
| 118 |
– |
short int have_tau_thermostat, have_target_temp, have_qmass; |
| 119 |
– |
|
| 116 |
|
}; |
| 117 |
|
|
| 118 |
|
|
| 119 |
< |
class NPT : public Integrator{ |
| 119 |
> |
class NPTi : public Integrator{ |
| 120 |
|
|
| 121 |
|
public: |
| 122 |
|
|
| 123 |
< |
NPT ( SimInfo &theInfo, ForceFields* the_ff) : |
| 124 |
< |
Integrator( theInfo, the_ff ); |
| 129 |
< |
virtual ~NPT(); |
| 123 |
> |
NPTi ( SimInfo *theInfo, ForceFields* the_ff); |
| 124 |
> |
virtual ~NPTi() {}; |
| 125 |
|
|
| 131 |
– |
void setQmass(double q) {qmass = q; have_qmass = 1;} |
| 126 |
|
void setTauThermostat(double tt) {tauThermostat = tt; have_tau_thermostat=1;} |
| 127 |
|
void setTauBarostat(double tb) {tauBarostat = tb; have_tau_barostat=1;} |
| 128 |
|
void setTargetTemp(double tt) {targetTemp = tt; have_target_temp = 1;} |
| 130 |
|
|
| 131 |
|
protected: |
| 132 |
|
|
| 133 |
< |
virtual moveA( void ); |
| 134 |
< |
virtual moveB( void ); |
| 133 |
> |
virtual void moveA( void ); |
| 134 |
> |
virtual void moveB( void ); |
| 135 |
|
|
| 136 |
< |
int readyCheck(); |
| 136 |
> |
virtual int readyCheck(); |
| 137 |
|
|
| 138 |
< |
Atom** atoms; |
| 138 |
> |
// chi and eta are the propagated degrees of freedom |
| 139 |
|
|
| 140 |
< |
// zeta and epsilonDot are the propagated degrees of freedom. |
| 140 |
> |
double chi; |
| 141 |
> |
double eta; |
| 142 |
> |
double NkBT; |
| 143 |
|
|
| 144 |
< |
double zeta; |
| 145 |
< |
double epsilonDot; |
| 144 |
> |
// targetTemp, targetPressure, and tauBarostat must be set. |
| 145 |
> |
// One of qmass or tauThermostat must be set; |
| 146 |
|
|
| 147 |
+ |
double targetTemp; |
| 148 |
+ |
double targetPressure; |
| 149 |
+ |
double tauThermostat; |
| 150 |
+ |
double tauBarostat; |
| 151 |
+ |
|
| 152 |
+ |
short int have_tau_thermostat, have_tau_barostat, have_target_temp; |
| 153 |
+ |
short int have_target_pressure; |
| 154 |
+ |
|
| 155 |
+ |
}; |
| 156 |
+ |
|
| 157 |
+ |
class NPTf : public Integrator{ |
| 158 |
+ |
|
| 159 |
+ |
public: |
| 160 |
+ |
|
| 161 |
+ |
NPTf ( SimInfo *theInfo, ForceFields* the_ff); |
| 162 |
+ |
virtual ~NPTf() {}; |
| 163 |
+ |
|
| 164 |
+ |
void setTauThermostat(double tt) {tauThermostat = tt; have_tau_thermostat=1;} |
| 165 |
+ |
void setTauBarostat(double tb) {tauBarostat = tb; have_tau_barostat=1;} |
| 166 |
+ |
void setTargetTemp(double tt) {targetTemp = tt; have_target_temp = 1;} |
| 167 |
+ |
void setTargetPressure(double tp) {targetPressure = tp; have_target_pressure = 1;} |
| 168 |
+ |
|
| 169 |
+ |
protected: |
| 170 |
+ |
|
| 171 |
+ |
virtual void moveA( void ); |
| 172 |
+ |
virtual void moveB( void ); |
| 173 |
+ |
|
| 174 |
+ |
virtual int readyCheck(); |
| 175 |
+ |
|
| 176 |
+ |
// chi and eta are the propagated degrees of freedom |
| 177 |
+ |
|
| 178 |
+ |
double chi; |
| 179 |
+ |
double eta[9]; |
| 180 |
+ |
double NkBT; |
| 181 |
+ |
|
| 182 |
|
// targetTemp, targetPressure, and tauBarostat must be set. |
| 183 |
|
// One of qmass or tauThermostat must be set; |
| 184 |
|
|
| 154 |
– |
double qmass; |
| 185 |
|
double targetTemp; |
| 186 |
|
double targetPressure; |
| 187 |
|
double tauThermostat; |
| 188 |
|
double tauBarostat; |
| 189 |
|
|
| 190 |
|
short int have_tau_thermostat, have_tau_barostat, have_target_temp; |
| 191 |
< |
short int have_target_pressure, have_qmass; |
| 191 |
> |
short int have_target_pressure; |
| 192 |
|
|
| 193 |
|
}; |
| 194 |
|
|