| 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 double p_convert = 1.63882576e8; //converts amu*fs^-2*Ang^-1 -> atm |
| 15 |
+ |
const int maxIteration = 300; |
| 16 |
+ |
const double tol = 1.0e-6; |
| 17 |
+ |
|
| 18 |
|
class Integrator : public BaseIntegrator { |
| 19 |
|
|
| 20 |
|
public: |
| 21 |
< |
Integrator( SimInfo &theInfo, ForceFields* the_ff ); |
| 21 |
> |
Integrator( SimInfo *theInfo, ForceFields* the_ff ); |
| 22 |
|
virtual ~Integrator(); |
| 23 |
|
void integrate( void ); |
| 24 |
|
|
| 25 |
|
|
| 26 |
|
protected: |
| 21 |
– |
|
| 27 |
|
|
| 28 |
|
virtual void integrateStep( int calcPot, int calcStress ); |
| 29 |
|
virtual void preMove( void ); |
| 31 |
|
virtual void moveB( void ); |
| 32 |
|
virtual void constrainA( void ); |
| 33 |
|
virtual void constrainB( void ); |
| 34 |
+ |
virtual int readyCheck( void ) { return 1; } |
| 35 |
|
|
| 30 |
– |
|
| 36 |
|
void checkConstraints( void ); |
| 37 |
|
void rotate( int axes1, int axes2, double angle, double j[3], |
| 38 |
|
double A[3][3] ); |
| 56 |
|
|
| 57 |
|
int* moving; // tells whether we are moving atom i |
| 58 |
|
int* moved; // tells whether we have moved atom i |
| 59 |
< |
double* prePos; // pre constrained positions |
| 59 |
> |
double* oldPos; // pre constrained positions |
| 60 |
|
|
| 61 |
|
short isFirst; /*boolean for the first time integrate is called */ |
| 62 |
|
|
| 63 |
|
double dt; |
| 64 |
|
double dt2; |
| 60 |
– |
const double eConvert = 4.184e-4; // converts kcal/mol -> amu*A^2/fs^2 |
| 65 |
|
|
| 62 |
– |
const int maxIteration = 300; |
| 63 |
– |
const double tol = 1.0e-6; |
| 64 |
– |
|
| 65 |
– |
|
| 66 |
– |
double* pos; |
| 67 |
– |
double* vel; |
| 68 |
– |
double* frc; |
| 69 |
– |
double* trq; |
| 70 |
– |
double* Amat; |
| 71 |
– |
|
| 72 |
– |
|
| 73 |
– |
|
| 66 |
|
Thermo *tStats; |
| 67 |
|
StatWriter* statOut; |
| 68 |
|
DumpWriter* dumpOut; |
| 69 |
|
|
| 70 |
|
}; |
| 71 |
|
|
| 72 |
+ |
class NVE : public Integrator{ |
| 73 |
|
|
| 74 |
+ |
public: |
| 75 |
+ |
NVE ( SimInfo *theInfo, ForceFields* the_ff ): |
| 76 |
+ |
Integrator( theInfo, the_ff ){} |
| 77 |
+ |
virtual ~NVE(){} |
| 78 |
+ |
|
| 79 |
+ |
|
| 80 |
+ |
|
| 81 |
+ |
}; |
| 82 |
+ |
|
| 83 |
|
class NVT : public Integrator{ |
| 84 |
|
|
| 85 |
< |
NVT ( void ); |
| 84 |
< |
virtual ~NVT(); |
| 85 |
> |
public: |
| 86 |
|
|
| 87 |
+ |
NVT ( SimInfo *theInfo, ForceFields* the_ff); |
| 88 |
+ |
virtual ~NVT() {} |
| 89 |
+ |
|
| 90 |
+ |
void setTauThermostat(double tt) {tauThermostat = tt; have_tau_thermostat=1;} |
| 91 |
+ |
void setTargetTemp(double tt) {targetTemp = tt; have_target_temp = 1;} |
| 92 |
+ |
|
| 93 |
|
protected: |
| 87 |
– |
virtual moveA( void ); |
| 88 |
– |
virtual moveB( void ); |
| 94 |
|
|
| 95 |
< |
}; |
| 95 |
> |
virtual void moveA( void ); |
| 96 |
> |
virtual void moveB( void ); |
| 97 |
|
|
| 98 |
+ |
virtual int readyCheck(); |
| 99 |
+ |
|
| 100 |
+ |
// chi is a propagated degree of freedom. |
| 101 |
+ |
|
| 102 |
+ |
double chi; |
| 103 |
+ |
|
| 104 |
+ |
// targetTemp must be set. tauThermostat must also be set; |
| 105 |
+ |
|
| 106 |
+ |
double targetTemp; |
| 107 |
+ |
double tauThermostat; |
| 108 |
|
|
| 109 |
+ |
short int have_tau_thermostat, have_target_temp; |
| 110 |
|
|
| 111 |
+ |
}; |
| 112 |
|
|
| 113 |
+ |
|
| 114 |
+ |
class NPTi : public Integrator{ |
| 115 |
+ |
|
| 116 |
+ |
public: |
| 117 |
+ |
|
| 118 |
+ |
NPTi ( SimInfo *theInfo, ForceFields* the_ff); |
| 119 |
+ |
virtual ~NPTi() {}; |
| 120 |
+ |
|
| 121 |
+ |
virtual void integrateStep( int calcPot, int calcStress ){ |
| 122 |
+ |
calcStress = 1; |
| 123 |
+ |
Integrator::integrateStep( calcPot, calcStress ); |
| 124 |
+ |
} |
| 125 |
+ |
|
| 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;} |
| 129 |
+ |
void setTargetPressure(double tp) {targetPressure = tp; have_target_pressure = 1;} |
| 130 |
+ |
|
| 131 |
+ |
protected: |
| 132 |
+ |
|
| 133 |
+ |
virtual void moveA( void ); |
| 134 |
+ |
virtual void moveB( void ); |
| 135 |
+ |
|
| 136 |
+ |
virtual int readyCheck(); |
| 137 |
+ |
|
| 138 |
+ |
// chi and eta are the propagated degrees of freedom |
| 139 |
+ |
|
| 140 |
+ |
double chi; |
| 141 |
+ |
double eta; |
| 142 |
+ |
double NkBT; |
| 143 |
+ |
|
| 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 NPTim : public Integrator{ |
| 158 |
+ |
|
| 159 |
+ |
public: |
| 160 |
+ |
|
| 161 |
+ |
NPTim ( SimInfo *theInfo, ForceFields* the_ff); |
| 162 |
+ |
virtual ~NPTim() {}; |
| 163 |
+ |
|
| 164 |
+ |
virtual void integrateStep( int calcPot, int calcStress ){ |
| 165 |
+ |
calcStress = 1; |
| 166 |
+ |
Integrator::integrateStep( calcPot, calcStress ); |
| 167 |
+ |
} |
| 168 |
+ |
|
| 169 |
+ |
void setTauThermostat(double tt) {tauThermostat = tt; have_tau_thermostat=1;} |
| 170 |
+ |
void setTauBarostat(double tb) {tauBarostat = tb; have_tau_barostat=1;} |
| 171 |
+ |
void setTargetTemp(double tt) {targetTemp = tt; have_target_temp = 1;} |
| 172 |
+ |
void setTargetPressure(double tp) {targetPressure = tp; have_target_pressure = 1;} |
| 173 |
+ |
|
| 174 |
+ |
protected: |
| 175 |
+ |
|
| 176 |
+ |
virtual void moveA( void ); |
| 177 |
+ |
virtual void moveB( void ); |
| 178 |
+ |
|
| 179 |
+ |
virtual int readyCheck(); |
| 180 |
+ |
|
| 181 |
+ |
// chi and eta are the propagated degrees of freedom |
| 182 |
+ |
|
| 183 |
+ |
double chi; |
| 184 |
+ |
double eta; |
| 185 |
+ |
double NkBT; |
| 186 |
+ |
|
| 187 |
+ |
// targetTemp, targetPressure, and tauBarostat must be set. |
| 188 |
+ |
// One of qmass or tauThermostat must be set; |
| 189 |
+ |
|
| 190 |
+ |
double targetTemp; |
| 191 |
+ |
double targetPressure; |
| 192 |
+ |
double tauThermostat; |
| 193 |
+ |
double tauBarostat; |
| 194 |
+ |
|
| 195 |
+ |
short int have_tau_thermostat, have_tau_barostat, have_target_temp; |
| 196 |
+ |
short int have_target_pressure; |
| 197 |
+ |
|
| 198 |
+ |
}; |
| 199 |
+ |
|
| 200 |
+ |
class NPTf : public Integrator{ |
| 201 |
+ |
|
| 202 |
+ |
public: |
| 203 |
+ |
|
| 204 |
+ |
NPTf ( SimInfo *theInfo, ForceFields* the_ff); |
| 205 |
+ |
virtual ~NPTf() {}; |
| 206 |
+ |
|
| 207 |
+ |
virtual void integrateStep( int calcPot, int calcStress ){ |
| 208 |
+ |
calcStress = 1; |
| 209 |
+ |
Integrator::integrateStep( calcPot, calcStress ); |
| 210 |
+ |
} |
| 211 |
+ |
|
| 212 |
+ |
void setTauThermostat(double tt) {tauThermostat = tt; have_tau_thermostat=1;} |
| 213 |
+ |
void setTauBarostat(double tb) {tauBarostat = tb; have_tau_barostat=1;} |
| 214 |
+ |
void setTargetTemp(double tt) {targetTemp = tt; have_target_temp = 1;} |
| 215 |
+ |
void setTargetPressure(double tp) {targetPressure = tp; have_target_pressure = 1;} |
| 216 |
+ |
|
| 217 |
+ |
protected: |
| 218 |
+ |
|
| 219 |
+ |
virtual void moveA( void ); |
| 220 |
+ |
virtual void moveB( void ); |
| 221 |
+ |
|
| 222 |
+ |
virtual int readyCheck(); |
| 223 |
+ |
|
| 224 |
+ |
// chi and eta are the propagated degrees of freedom |
| 225 |
+ |
|
| 226 |
+ |
double chi; |
| 227 |
+ |
double eta[3][3]; |
| 228 |
+ |
double NkBT; |
| 229 |
+ |
|
| 230 |
+ |
// targetTemp, targetPressure, and tauBarostat must be set. |
| 231 |
+ |
// One of qmass or tauThermostat must be set; |
| 232 |
+ |
|
| 233 |
+ |
double targetTemp; |
| 234 |
+ |
double targetPressure; |
| 235 |
+ |
double tauThermostat; |
| 236 |
+ |
double tauBarostat; |
| 237 |
+ |
|
| 238 |
+ |
short int have_tau_thermostat, have_tau_barostat, have_target_temp; |
| 239 |
+ |
short int have_target_pressure; |
| 240 |
+ |
|
| 241 |
+ |
}; |
| 242 |
+ |
|
| 243 |
+ |
class NPTfm : public Integrator{ |
| 244 |
+ |
|
| 245 |
+ |
public: |
| 246 |
+ |
|
| 247 |
+ |
NPTfm ( SimInfo *theInfo, ForceFields* the_ff); |
| 248 |
+ |
virtual ~NPTfm() {}; |
| 249 |
+ |
|
| 250 |
+ |
virtual void integrateStep( int calcPot, int calcStress ){ |
| 251 |
+ |
calcStress = 1; |
| 252 |
+ |
Integrator::integrateStep( calcPot, calcStress ); |
| 253 |
+ |
} |
| 254 |
+ |
|
| 255 |
+ |
void setTauThermostat(double tt) {tauThermostat = tt; have_tau_thermostat=1;} |
| 256 |
+ |
void setTauBarostat(double tb) {tauBarostat = tb; have_tau_barostat=1;} |
| 257 |
+ |
void setTargetTemp(double tt) {targetTemp = tt; have_target_temp = 1;} |
| 258 |
+ |
void setTargetPressure(double tp) {targetPressure = tp; have_target_pressure = 1;} |
| 259 |
+ |
|
| 260 |
+ |
protected: |
| 261 |
+ |
|
| 262 |
+ |
virtual void moveA( void ); |
| 263 |
+ |
virtual void moveB( void ); |
| 264 |
+ |
|
| 265 |
+ |
virtual int readyCheck(); |
| 266 |
+ |
|
| 267 |
+ |
// chi and eta are the propagated degrees of freedom |
| 268 |
+ |
|
| 269 |
+ |
double chi; |
| 270 |
+ |
double eta[3][3]; |
| 271 |
+ |
double NkBT; |
| 272 |
+ |
|
| 273 |
+ |
// targetTemp, targetPressure, and tauBarostat must be set. |
| 274 |
+ |
// One of qmass or tauThermostat must be set; |
| 275 |
+ |
|
| 276 |
+ |
double targetTemp; |
| 277 |
+ |
double targetPressure; |
| 278 |
+ |
double tauThermostat; |
| 279 |
+ |
double tauBarostat; |
| 280 |
+ |
|
| 281 |
+ |
short int have_tau_thermostat, have_tau_barostat, have_target_temp; |
| 282 |
+ |
short int have_target_pressure; |
| 283 |
+ |
|
| 284 |
+ |
}; |
| 285 |
+ |
|
| 286 |
|
#endif |