| 27 |
|
Integrator( SimInfo *theInfo, ForceFields* the_ff ); |
| 28 |
|
virtual ~Integrator(); |
| 29 |
|
void integrate( void ); |
| 30 |
+ |
virtual double getConservedQuantity(void); |
| 31 |
|
|
| 31 |
– |
|
| 32 |
|
protected: |
| 33 |
< |
|
| 33 |
> |
|
| 34 |
|
virtual void integrateStep( int calcPot, int calcStress ); |
| 35 |
|
virtual void preMove( void ); |
| 36 |
|
virtual void moveA( void ); |
| 39 |
|
virtual void constrainB( void ); |
| 40 |
|
virtual int readyCheck( void ) { return 1; } |
| 41 |
|
|
| 42 |
+ |
virtual void resetIntegrator( void ) { } |
| 43 |
+ |
|
| 44 |
|
virtual void calcForce( int calcPot, int calcStress ); |
| 45 |
|
virtual void thermalize(); |
| 46 |
|
|
| 47 |
+ |
virtual void rotationPropagation( DirectionalAtom* dAtom, double ji[3] ); |
| 48 |
+ |
|
| 49 |
|
void checkConstraints( void ); |
| 50 |
|
void rotate( int axes1, int axes2, double angle, double j[3], |
| 51 |
|
double A[3][3] ); |
| 97 |
|
public: |
| 98 |
|
|
| 99 |
|
NVT ( SimInfo *theInfo, ForceFields* the_ff); |
| 100 |
< |
virtual ~NVT() {} |
| 100 |
> |
virtual ~NVT(); |
| 101 |
|
|
| 102 |
|
void setTauThermostat(double tt) {tauThermostat = tt; have_tau_thermostat=1;} |
| 103 |
|
void setTargetTemp(double tt) {targetTemp = tt; have_target_temp = 1;} |
| 104 |
+ |
void setChiTolerance(double tol) {chiTolerance = tol;} |
| 105 |
+ |
virtual double getConservedQuantity(void); |
| 106 |
|
|
| 107 |
|
protected: |
| 108 |
|
|
| 111 |
|
|
| 112 |
|
virtual int readyCheck(); |
| 113 |
|
|
| 114 |
+ |
virtual void resetIntegrator( void ); |
| 115 |
+ |
|
| 116 |
|
// chi is a propagated degree of freedom. |
| 117 |
|
|
| 118 |
|
double chi; |
| 119 |
|
|
| 120 |
+ |
//integral of chi(t)dt |
| 121 |
+ |
double integralOfChidt; |
| 122 |
+ |
|
| 123 |
|
// targetTemp must be set. tauThermostat must also be set; |
| 124 |
|
|
| 125 |
|
double targetTemp; |
| 127 |
|
|
| 128 |
|
short int have_tau_thermostat, have_target_temp; |
| 129 |
|
|
| 130 |
+ |
double *oldVel; |
| 131 |
+ |
double *oldJi; |
| 132 |
+ |
|
| 133 |
+ |
double chiTolerance; |
| 134 |
+ |
short int have_chi_tolerance; |
| 135 |
+ |
|
| 136 |
|
}; |
| 137 |
|
|
| 138 |
|
|
| 139 |
|
|
| 140 |
< |
template<typename T> class NPTi : public T{ |
| 140 |
> |
template<typename T> class NPT : public T{ |
| 141 |
|
|
| 142 |
|
public: |
| 143 |
|
|
| 144 |
< |
NPTi ( SimInfo *theInfo, ForceFields* the_ff); |
| 145 |
< |
virtual ~NPTi() {}; |
| 146 |
< |
|
| 144 |
> |
NPT ( SimInfo *theInfo, ForceFields* the_ff); |
| 145 |
> |
virtual ~NPT(); |
| 146 |
> |
|
| 147 |
|
virtual void integrateStep( int calcPot, int calcStress ){ |
| 148 |
|
calcStress = 1; |
| 149 |
|
T::integrateStep( calcPot, calcStress ); |
| 150 |
|
} |
| 151 |
|
|
| 152 |
+ |
virtual double getConservedQuantity(void) = 0; |
| 153 |
+ |
|
| 154 |
|
void setTauThermostat(double tt) {tauThermostat = tt; have_tau_thermostat=1;} |
| 155 |
|
void setTauBarostat(double tb) {tauBarostat = tb; have_tau_barostat=1;} |
| 156 |
|
void setTargetTemp(double tt) {targetTemp = tt; have_target_temp = 1;} |
| 157 |
|
void setTargetPressure(double tp) {targetPressure = tp; have_target_pressure = 1;} |
| 158 |
+ |
void setChiTolerance(double tol) {chiTolerance = tol; have_chi_tolerance = 1;} |
| 159 |
+ |
void setPosIterTolerance(double tol) {posIterTolerance = tol; have_pos_iter_tolerance = 1;} |
| 160 |
+ |
void setEtaTolerance(double tol) {etaTolerance = tol; have_eta_tolerance = 1;} |
| 161 |
|
|
| 162 |
|
protected: |
| 163 |
|
|
| 166 |
|
|
| 167 |
|
virtual int readyCheck(); |
| 168 |
|
|
| 169 |
+ |
virtual void resetIntegrator( void ); |
| 170 |
+ |
|
| 171 |
+ |
virtual void getVelScaleA( double sc[3], double vel[3] ) = 0; |
| 172 |
+ |
virtual void getVelScaleB( double sc[3], int index ) = 0; |
| 173 |
+ |
virtual void getPosScale(double pos[3], double COM[3], |
| 174 |
+ |
int index, double sc[3]) = 0; |
| 175 |
+ |
|
| 176 |
+ |
virtual bool chiConverged( void ); |
| 177 |
+ |
virtual bool etaConverged( void ) = 0; |
| 178 |
+ |
|
| 179 |
+ |
virtual void evolveChiA( void ); |
| 180 |
+ |
virtual void evolveEtaA( void ) = 0; |
| 181 |
+ |
virtual void evolveChiB( void ); |
| 182 |
+ |
virtual void evolveEtaB( void ) = 0; |
| 183 |
+ |
|
| 184 |
+ |
virtual void scaleSimBox( void ) = 0; |
| 185 |
+ |
|
| 186 |
+ |
void accIntegralOfChidt(void) { integralOfChidt += dt * chi;} |
| 187 |
+ |
|
| 188 |
|
// chi and eta are the propagated degrees of freedom |
| 189 |
|
|
| 190 |
+ |
double oldChi; |
| 191 |
+ |
double prevChi; |
| 192 |
|
double chi; |
| 150 |
– |
double eta; |
| 193 |
|
double NkBT; |
| 194 |
+ |
double fkBT; |
| 195 |
|
|
| 196 |
+ |
double tt2, tb2; |
| 197 |
+ |
double instaTemp, instaPress, instaVol; |
| 198 |
+ |
double press[3][3]; |
| 199 |
+ |
|
| 200 |
+ |
int Nparticles; |
| 201 |
+ |
|
| 202 |
+ |
double integralOfChidt; |
| 203 |
+ |
|
| 204 |
|
// targetTemp, targetPressure, and tauBarostat must be set. |
| 205 |
|
// One of qmass or tauThermostat must be set; |
| 206 |
|
|
| 212 |
|
short int have_tau_thermostat, have_tau_barostat, have_target_temp; |
| 213 |
|
short int have_target_pressure; |
| 214 |
|
|
| 215 |
+ |
double *oldPos; |
| 216 |
+ |
double *oldVel; |
| 217 |
+ |
double *oldJi; |
| 218 |
+ |
|
| 219 |
+ |
double chiTolerance; |
| 220 |
+ |
short int have_chi_tolerance; |
| 221 |
+ |
double posIterTolerance; |
| 222 |
+ |
short int have_pos_iter_tolerance; |
| 223 |
+ |
double etaTolerance; |
| 224 |
+ |
short int have_eta_tolerance; |
| 225 |
+ |
|
| 226 |
|
}; |
| 227 |
|
|
| 228 |
< |
template<typename T> class NPTim : public T{ |
| 228 |
> |
template<typename T> class NPTi : public T{ |
| 229 |
> |
|
| 230 |
> |
public: |
| 231 |
> |
NPTi( SimInfo *theInfo, ForceFields* the_ff); |
| 232 |
> |
~NPTi(); |
| 233 |
|
|
| 234 |
+ |
virtual double getConservedQuantity(void); |
| 235 |
+ |
virtual void resetIntegrator(void); |
| 236 |
+ |
|
| 237 |
+ |
protected: |
| 238 |
+ |
|
| 239 |
+ |
|
| 240 |
+ |
|
| 241 |
+ |
virtual void evolveEtaA(void); |
| 242 |
+ |
virtual void evolveEtaB(void); |
| 243 |
+ |
|
| 244 |
+ |
virtual bool etaConverged( void ); |
| 245 |
+ |
|
| 246 |
+ |
virtual void scaleSimBox( void ); |
| 247 |
+ |
|
| 248 |
+ |
virtual void getVelScaleA( double sc[3], double vel[3] ); |
| 249 |
+ |
virtual void getVelScaleB( double sc[3], int index ); |
| 250 |
+ |
virtual void getPosScale(double pos[3], double COM[3], |
| 251 |
+ |
int index, double sc[3]); |
| 252 |
+ |
|
| 253 |
+ |
double eta, oldEta, prevEta; |
| 254 |
+ |
}; |
| 255 |
+ |
|
| 256 |
+ |
template<typename T> class NPTzm : public T{ |
| 257 |
+ |
|
| 258 |
|
public: |
| 259 |
|
|
| 260 |
< |
NPTim ( SimInfo *theInfo, ForceFields* the_ff); |
| 261 |
< |
virtual ~NPTim() {}; |
| 260 |
> |
NPTzm ( SimInfo *theInfo, ForceFields* the_ff); |
| 261 |
> |
virtual ~NPTzm() {}; |
| 262 |
|
|
| 263 |
|
virtual void integrateStep( int calcPot, int calcStress ){ |
| 264 |
|
calcStress = 1; |
| 277 |
|
|
| 278 |
|
virtual int readyCheck(); |
| 279 |
|
|
| 280 |
+ |
virtual void resetIntegrator( void ); |
| 281 |
+ |
|
| 282 |
|
Molecule* myMolecules; |
| 283 |
|
Atom** myAtoms; |
| 284 |
|
|
| 286 |
|
|
| 287 |
|
double chi; |
| 288 |
|
double eta; |
| 289 |
+ |
double etaZ; |
| 290 |
|
double NkBT; |
| 291 |
|
|
| 292 |
|
// targetTemp, targetPressure, and tauBarostat must be set. |
| 307 |
|
public: |
| 308 |
|
|
| 309 |
|
NPTf ( SimInfo *theInfo, ForceFields* the_ff); |
| 310 |
< |
virtual ~NPTf() {}; |
| 310 |
> |
virtual ~NPTf(); |
| 311 |
|
|
| 312 |
< |
virtual void integrateStep( int calcPot, int calcStress ){ |
| 313 |
< |
calcStress = 1; |
| 221 |
< |
T::integrateStep( calcPot, calcStress ); |
| 222 |
< |
} |
| 312 |
> |
virtual double getConservedQuantity(void); |
| 313 |
> |
virtual void resetIntegrator(void); |
| 314 |
|
|
| 224 |
– |
void setTauThermostat(double tt) {tauThermostat = tt; have_tau_thermostat=1;} |
| 225 |
– |
void setTauBarostat(double tb) {tauBarostat = tb; have_tau_barostat=1;} |
| 226 |
– |
void setTargetTemp(double tt) {targetTemp = tt; have_target_temp = 1;} |
| 227 |
– |
void setTargetPressure(double tp) {targetPressure = tp; have_target_pressure = 1;} |
| 228 |
– |
|
| 315 |
|
protected: |
| 316 |
|
|
| 317 |
< |
virtual void moveA( void ); |
| 318 |
< |
virtual void moveB( void ); |
| 317 |
> |
virtual void evolveEtaA(void); |
| 318 |
> |
virtual void evolveEtaB(void); |
| 319 |
|
|
| 320 |
< |
virtual int readyCheck(); |
| 320 |
> |
virtual bool etaConverged( void ); |
| 321 |
|
|
| 322 |
< |
// chi and eta are the propagated degrees of freedom |
| 322 |
> |
virtual void scaleSimBox( void ); |
| 323 |
|
|
| 324 |
< |
double chi; |
| 325 |
< |
double eta[3][3]; |
| 326 |
< |
double NkBT; |
| 327 |
< |
|
| 242 |
< |
// targetTemp, targetPressure, and tauBarostat must be set. |
| 243 |
< |
// One of qmass or tauThermostat must be set; |
| 244 |
< |
|
| 245 |
< |
double targetTemp; |
| 246 |
< |
double targetPressure; |
| 247 |
< |
double tauThermostat; |
| 248 |
< |
double tauBarostat; |
| 249 |
< |
|
| 250 |
< |
short int have_tau_thermostat, have_tau_barostat, have_target_temp; |
| 251 |
< |
short int have_target_pressure; |
| 324 |
> |
virtual void getVelScaleA( double sc[3], double vel[3] ); |
| 325 |
> |
virtual void getVelScaleB( double sc[3], int index ); |
| 326 |
> |
virtual void getPosScale(double pos[3], double COM[3], |
| 327 |
> |
int index, double sc[3]); |
| 328 |
|
|
| 329 |
+ |
double eta[3][3]; |
| 330 |
+ |
double oldEta[3][3]; |
| 331 |
+ |
double prevEta[3][3]; |
| 332 |
|
}; |
| 333 |
|
|
| 334 |
< |
template<typename T> class NPTfm : public T{ |
| 334 |
> |
template<typename T> class NPTxym : public T{ |
| 335 |
|
|
| 336 |
|
public: |
| 337 |
|
|
| 338 |
< |
NPTfm ( SimInfo *theInfo, ForceFields* the_ff); |
| 339 |
< |
virtual ~NPTfm() {}; |
| 338 |
> |
NPTxym ( SimInfo *theInfo, ForceFields* the_ff); |
| 339 |
> |
virtual ~NPTxym() {}; |
| 340 |
|
|
| 341 |
|
virtual void integrateStep( int calcPot, int calcStress ){ |
| 342 |
|
calcStress = 1; |
| 350 |
|
|
| 351 |
|
protected: |
| 352 |
|
|
| 353 |
< |
virtual void moveA( void ); |
| 353 |
> |
virtual void moveA( void ); |
| 354 |
|
virtual void moveB( void ); |
| 355 |
|
|
| 356 |
|
virtual int readyCheck(); |
| 357 |
|
|
| 358 |
+ |
virtual void resetIntegrator( void ); |
| 359 |
+ |
|
| 360 |
|
Molecule* myMolecules; |
| 361 |
|
Atom** myAtoms; |
| 362 |
|
|
| 363 |
|
// chi and eta are the propagated degrees of freedom |
| 364 |
|
|
| 365 |
|
double chi; |
| 366 |
< |
double eta[3][3]; |
| 366 |
> |
double eta; |
| 367 |
> |
double etaX; |
| 368 |
> |
double etaY; |
| 369 |
|
double NkBT; |
| 370 |
|
|
| 371 |
|
// targetTemp, targetPressure, and tauBarostat must be set. |
| 384 |
|
template<typename T> class ZConstraint : public T { |
| 385 |
|
|
| 386 |
|
public: |
| 387 |
< |
class ForceSubstractionPolicy{ |
| 387 |
> |
class ForceSubtractionPolicy{ |
| 388 |
|
public: |
| 389 |
< |
ForceSubstractionPolicy(ZConstraint<T>* integrator) {zconsIntegrator = integrator;} |
| 389 |
> |
ForceSubtractionPolicy(ZConstraint<T>* integrator) {zconsIntegrator = integrator;} |
| 390 |
|
|
| 391 |
|
virtual void update() = 0; |
| 392 |
|
virtual double getZFOfFixedZMols(Molecule* mol, Atom* atom, double totalForce) = 0; |
| 398 |
|
ZConstraint<T>* zconsIntegrator;; |
| 399 |
|
}; |
| 400 |
|
|
| 401 |
< |
class PolicyByNumber : ForceSubstractionPolicy{ |
| 401 |
> |
class PolicyByNumber : public ForceSubtractionPolicy{ |
| 402 |
> |
|
| 403 |
|
public: |
| 404 |
< |
PolicyByNumber(ZConstraint<T>* integrator) :ForceSubstractionPolicy(integrator) {} |
| 404 |
> |
PolicyByNumber(ZConstraint<T>* integrator) :ForceSubtractionPolicy(integrator) {} |
| 405 |
|
virtual void update(); |
| 406 |
|
virtual double getZFOfFixedZMols(Molecule* mol, Atom* atom, double totalForce) ; |
| 407 |
|
virtual double getZFOfMovingMols(Atom* atom, double totalForce) ; |
| 409 |
|
virtual double getHFOfUnconsMols(Atom* atom, double totalForce); |
| 410 |
|
|
| 411 |
|
private: |
| 412 |
< |
int totNumOfMovingAtoms; |
| 412 |
> |
int totNumOfMovingAtoms; |
| 413 |
|
}; |
| 414 |
|
|
| 415 |
< |
class PolicyByMass :ForceSubstractionPolicy{ |
| 415 |
> |
class PolicyByMass : public ForceSubtractionPolicy{ |
| 416 |
> |
|
| 417 |
|
public: |
| 418 |
< |
PolicyByMass(ZConstraint<T>* integrator) :ForceSubstractionPolicy(integrator) {} |
| 418 |
> |
PolicyByMass(ZConstraint<T>* integrator) :ForceSubtractionPolicy(integrator) {} |
| 419 |
|
|
| 420 |
|
virtual void update(); |
| 421 |
|
virtual double getZFOfFixedZMols(Molecule* mol, Atom* atom, double totalForce) ; |
| 507 |
|
double calcSysCOMVel(); |
| 508 |
|
double calcTotalForce(); |
| 509 |
|
|
| 510 |
< |
ForceSubstractionPolicy* forcePolicy; //force substration policy |
| 511 |
< |
friend class ForceSubstractionPolicy; |
| 510 |
> |
ForceSubtractionPolicy* forcePolicy; //force subtraction policy |
| 511 |
> |
friend class ForceSubtractionPolicy; |
| 512 |
|
|
| 513 |
|
}; |
| 514 |
|
|