| 27 |
|
Integrator( SimInfo *theInfo, ForceFields* the_ff ); |
| 28 |
|
virtual ~Integrator(); |
| 29 |
|
void integrate( void ); |
| 30 |
+ |
virtual double getConservedQuantity(void); |
| 31 |
|
|
| 31 |
– |
|
| 32 |
|
protected: |
| 33 |
|
|
| 34 |
|
virtual void integrateStep( int calcPot, int calcStress ); |
| 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 |
|
|
| 95 |
|
public: |
| 96 |
|
|
| 97 |
|
NVT ( SimInfo *theInfo, ForceFields* the_ff); |
| 98 |
< |
virtual ~NVT() {} |
| 98 |
> |
virtual ~NVT(); |
| 99 |
|
|
| 100 |
|
void setTauThermostat(double tt) {tauThermostat = tt; have_tau_thermostat=1;} |
| 101 |
|
void setTargetTemp(double tt) {targetTemp = tt; have_target_temp = 1;} |
| 102 |
+ |
void setChiTolerance(double tol) {chiTolerance = tol;} |
| 103 |
+ |
virtual double getConservedQuantity(void); |
| 104 |
|
|
| 105 |
|
protected: |
| 106 |
|
|
| 109 |
|
|
| 110 |
|
virtual int readyCheck(); |
| 111 |
|
|
| 112 |
+ |
virtual void resetIntegrator( void ); |
| 113 |
+ |
|
| 114 |
|
// chi is a propagated degree of freedom. |
| 115 |
|
|
| 116 |
|
double chi; |
| 117 |
|
|
| 118 |
+ |
//integral of chi(t)dt |
| 119 |
+ |
double integralOfChidt; |
| 120 |
+ |
|
| 121 |
|
// targetTemp must be set. tauThermostat must also be set; |
| 122 |
|
|
| 123 |
|
double targetTemp; |
| 125 |
|
|
| 126 |
|
short int have_tau_thermostat, have_target_temp; |
| 127 |
|
|
| 128 |
+ |
double *oldVel; |
| 129 |
+ |
double *oldJi; |
| 130 |
+ |
|
| 131 |
+ |
double chiTolerance; |
| 132 |
+ |
short int have_chi_tolerance; |
| 133 |
+ |
|
| 134 |
|
}; |
| 135 |
|
|
| 136 |
|
|
| 140 |
|
public: |
| 141 |
|
|
| 142 |
|
NPTi ( SimInfo *theInfo, ForceFields* the_ff); |
| 143 |
< |
virtual ~NPTi() {}; |
| 144 |
< |
|
| 143 |
> |
virtual ~NPTi(); |
| 144 |
> |
|
| 145 |
|
virtual void integrateStep( int calcPot, int calcStress ){ |
| 146 |
|
calcStress = 1; |
| 147 |
|
T::integrateStep( calcPot, calcStress ); |
| 148 |
+ |
/* accIntegralOfChidt(); */ |
| 149 |
|
} |
| 150 |
|
|
| 151 |
+ |
virtual double getConservedQuantity(void); |
| 152 |
+ |
|
| 153 |
|
void setTauThermostat(double tt) {tauThermostat = tt; have_tau_thermostat=1;} |
| 154 |
|
void setTauBarostat(double tb) {tauBarostat = tb; have_tau_barostat=1;} |
| 155 |
|
void setTargetTemp(double tt) {targetTemp = tt; have_target_temp = 1;} |
| 156 |
|
void setTargetPressure(double tp) {targetPressure = tp; have_target_pressure = 1;} |
| 157 |
+ |
void setChiTolerance(double tol) {chiTolerance = tol; have_chi_tolerance = 1;} |
| 158 |
+ |
void setPosIterTolerance(double tol) {posIterTolerance = tol; have_pos_iter_tolerance = 1;} |
| 159 |
+ |
void setEtaTolerance(double tol) {etaTolerance = tol; have_eta_tolerance = 1;} |
| 160 |
|
|
| 161 |
|
protected: |
| 162 |
|
|
| 165 |
|
|
| 166 |
|
virtual int readyCheck(); |
| 167 |
|
|
| 168 |
+ |
virtual void resetIntegrator( void ); |
| 169 |
+ |
|
| 170 |
+ |
void accIntegralOfChidt(void) { integralOfChidt += dt * chi;} |
| 171 |
+ |
|
| 172 |
|
// chi and eta are the propagated degrees of freedom |
| 173 |
|
|
| 174 |
|
double chi; |
| 175 |
|
double eta; |
| 176 |
|
double NkBT; |
| 177 |
+ |
double fkBT; |
| 178 |
|
|
| 179 |
+ |
int Nparticles; |
| 180 |
+ |
|
| 181 |
+ |
double integralOfChidt; |
| 182 |
+ |
|
| 183 |
|
// targetTemp, targetPressure, and tauBarostat must be set. |
| 184 |
|
// One of qmass or tauThermostat must be set; |
| 185 |
|
|
| 191 |
|
short int have_tau_thermostat, have_tau_barostat, have_target_temp; |
| 192 |
|
short int have_target_pressure; |
| 193 |
|
|
| 194 |
+ |
double *oldPos; |
| 195 |
+ |
double *oldVel; |
| 196 |
+ |
double *oldJi; |
| 197 |
+ |
|
| 198 |
+ |
double chiTolerance; |
| 199 |
+ |
short int have_chi_tolerance; |
| 200 |
+ |
double posIterTolerance; |
| 201 |
+ |
short int have_pos_iter_tolerance; |
| 202 |
+ |
double etaTolerance; |
| 203 |
+ |
short int have_eta_tolerance; |
| 204 |
+ |
|
| 205 |
|
}; |
| 206 |
|
|
| 207 |
|
template<typename T> class NPTim : public T{ |
| 209 |
|
public: |
| 210 |
|
|
| 211 |
|
NPTim ( SimInfo *theInfo, ForceFields* the_ff); |
| 212 |
< |
virtual ~NPTim() {}; |
| 212 |
> |
virtual ~NPTim() {} |
| 213 |
> |
|
| 214 |
> |
virtual void integrateStep( int calcPot, int calcStress ){ |
| 215 |
> |
calcStress = 1; |
| 216 |
> |
T::integrateStep( calcPot, calcStress ); |
| 217 |
> |
accIntegralOfChidt(); |
| 218 |
> |
} |
| 219 |
> |
|
| 220 |
> |
virtual double getConservedQuantity(void); |
| 221 |
> |
|
| 222 |
> |
void setTauThermostat(double tt) {tauThermostat = tt; have_tau_thermostat=1;} |
| 223 |
> |
void setTauBarostat(double tb) {tauBarostat = tb; have_tau_barostat=1;} |
| 224 |
> |
void setTargetTemp(double tt) {targetTemp = tt; have_target_temp = 1;} |
| 225 |
> |
void setTargetPressure(double tp) {targetPressure = tp; have_target_pressure = 1;} |
| 226 |
> |
void setChiTolerance(double tol) {chiTolerance = tol;} |
| 227 |
> |
void setPosIterTolerance(double tol) {posIterTolerance = tol;} |
| 228 |
|
|
| 229 |
+ |
protected: |
| 230 |
+ |
|
| 231 |
+ |
virtual void moveA( void ); |
| 232 |
+ |
virtual void moveB( void ); |
| 233 |
+ |
|
| 234 |
+ |
virtual int readyCheck(); |
| 235 |
+ |
|
| 236 |
+ |
virtual void resetIntegrator( void ); |
| 237 |
+ |
|
| 238 |
+ |
void accIntegralOfChidt(void) { integralOfChidt += dt * chi;} |
| 239 |
+ |
|
| 240 |
+ |
Molecule* myMolecules; |
| 241 |
+ |
Atom** myAtoms; |
| 242 |
+ |
|
| 243 |
+ |
// chi and eta are the propagated degrees of freedom |
| 244 |
+ |
|
| 245 |
+ |
double chi; |
| 246 |
+ |
double eta; |
| 247 |
+ |
double NkBT; |
| 248 |
+ |
double integralOfChidt; |
| 249 |
+ |
|
| 250 |
+ |
// targetTemp, targetPressure, and tauBarostat must be set. |
| 251 |
+ |
// One of qmass or tauThermostat must be set; |
| 252 |
+ |
|
| 253 |
+ |
double targetTemp; |
| 254 |
+ |
double targetPressure; |
| 255 |
+ |
double tauThermostat; |
| 256 |
+ |
double tauBarostat; |
| 257 |
+ |
|
| 258 |
+ |
short int have_tau_thermostat, have_tau_barostat, have_target_temp; |
| 259 |
+ |
short int have_target_pressure; |
| 260 |
+ |
double chiTolerance; |
| 261 |
+ |
short int have_chi_tolerance; |
| 262 |
+ |
double posIterTolerance; |
| 263 |
+ |
short int have_pos_iter_tolerance; |
| 264 |
+ |
|
| 265 |
+ |
}; |
| 266 |
+ |
|
| 267 |
+ |
template<typename T> class NPTzm : public T{ |
| 268 |
+ |
|
| 269 |
+ |
public: |
| 270 |
+ |
|
| 271 |
+ |
NPTzm ( SimInfo *theInfo, ForceFields* the_ff); |
| 272 |
+ |
virtual ~NPTzm() {}; |
| 273 |
+ |
|
| 274 |
|
virtual void integrateStep( int calcPot, int calcStress ){ |
| 275 |
|
calcStress = 1; |
| 276 |
|
T::integrateStep( calcPot, calcStress ); |
| 288 |
|
|
| 289 |
|
virtual int readyCheck(); |
| 290 |
|
|
| 291 |
+ |
virtual void resetIntegrator( void ); |
| 292 |
+ |
|
| 293 |
|
Molecule* myMolecules; |
| 294 |
|
Atom** myAtoms; |
| 295 |
|
|
| 297 |
|
|
| 298 |
|
double chi; |
| 299 |
|
double eta; |
| 300 |
+ |
double etaZ; |
| 301 |
|
double NkBT; |
| 302 |
|
|
| 303 |
|
// targetTemp, targetPressure, and tauBarostat must be set. |
| 318 |
|
public: |
| 319 |
|
|
| 320 |
|
NPTf ( SimInfo *theInfo, ForceFields* the_ff); |
| 321 |
< |
virtual ~NPTf() {}; |
| 321 |
> |
virtual ~NPTf(); |
| 322 |
|
|
| 323 |
|
virtual void integrateStep( int calcPot, int calcStress ){ |
| 324 |
|
calcStress = 1; |
| 325 |
|
T::integrateStep( calcPot, calcStress ); |
| 326 |
|
} |
| 327 |
+ |
|
| 328 |
+ |
virtual double getConservedQuantity(void); |
| 329 |
|
|
| 330 |
|
void setTauThermostat(double tt) {tauThermostat = tt; have_tau_thermostat=1;} |
| 331 |
|
void setTauBarostat(double tb) {tauBarostat = tb; have_tau_barostat=1;} |
| 332 |
|
void setTargetTemp(double tt) {targetTemp = tt; have_target_temp = 1;} |
| 333 |
|
void setTargetPressure(double tp) {targetPressure = tp; have_target_pressure = 1;} |
| 334 |
+ |
void setChiTolerance(double tol) {chiTolerance = tol;} |
| 335 |
+ |
void setPosIterTolerance(double tol) {posIterTolerance = tol;} |
| 336 |
|
|
| 337 |
|
protected: |
| 338 |
|
|
| 339 |
|
virtual void moveA( void ); |
| 340 |
|
virtual void moveB( void ); |
| 341 |
|
|
| 342 |
+ |
virtual void resetIntegrator( void ); |
| 343 |
+ |
|
| 344 |
|
virtual int readyCheck(); |
| 345 |
|
|
| 346 |
+ |
|
| 347 |
|
// chi and eta are the propagated degrees of freedom |
| 348 |
|
|
| 349 |
|
double chi; |
| 350 |
|
double eta[3][3]; |
| 351 |
+ |
double NkBT; |
| 352 |
+ |
double fkBT; |
| 353 |
+ |
|
| 354 |
+ |
int Nparticles; |
| 355 |
+ |
|
| 356 |
+ |
double *oldPos; |
| 357 |
+ |
double *oldVel; |
| 358 |
+ |
double *oldJi; |
| 359 |
+ |
|
| 360 |
+ |
double integralOfChidt; |
| 361 |
+ |
|
| 362 |
+ |
// targetTemp, targetPressure, and tauBarostat must be set. |
| 363 |
+ |
// One of qmass or tauThermostat must be set; |
| 364 |
+ |
|
| 365 |
+ |
double targetTemp; |
| 366 |
+ |
double targetPressure; |
| 367 |
+ |
double tauThermostat; |
| 368 |
+ |
double tauBarostat; |
| 369 |
+ |
|
| 370 |
+ |
short int have_tau_thermostat, have_tau_barostat, have_target_temp; |
| 371 |
+ |
short int have_target_pressure; |
| 372 |
+ |
double chiTolerance; |
| 373 |
+ |
short int have_chi_tolerance; |
| 374 |
+ |
double posIterTolerance; |
| 375 |
+ |
short int have_pos_iter_tolerance; |
| 376 |
+ |
double etaTolerance; |
| 377 |
+ |
short int have_eta_tolerance; |
| 378 |
+ |
}; |
| 379 |
+ |
|
| 380 |
+ |
template<typename T> class NPTxym : public T{ |
| 381 |
+ |
|
| 382 |
+ |
public: |
| 383 |
+ |
|
| 384 |
+ |
NPTxym ( SimInfo *theInfo, ForceFields* the_ff); |
| 385 |
+ |
virtual ~NPTxym() {}; |
| 386 |
+ |
|
| 387 |
+ |
virtual void integrateStep( int calcPot, int calcStress ){ |
| 388 |
+ |
calcStress = 1; |
| 389 |
+ |
T::integrateStep( calcPot, calcStress ); |
| 390 |
+ |
} |
| 391 |
+ |
|
| 392 |
+ |
void setTauThermostat(double tt) {tauThermostat = tt; have_tau_thermostat=1;} |
| 393 |
+ |
void setTauBarostat(double tb) {tauBarostat = tb; have_tau_barostat=1;} |
| 394 |
+ |
void setTargetTemp(double tt) {targetTemp = tt; have_target_temp = 1;} |
| 395 |
+ |
void setTargetPressure(double tp) {targetPressure = tp; have_target_pressure = 1;} |
| 396 |
+ |
|
| 397 |
+ |
protected: |
| 398 |
+ |
|
| 399 |
+ |
virtual void moveA( void ); |
| 400 |
+ |
virtual void moveB( void ); |
| 401 |
+ |
|
| 402 |
+ |
virtual int readyCheck(); |
| 403 |
+ |
|
| 404 |
+ |
virtual void resetIntegrator( void ); |
| 405 |
+ |
|
| 406 |
+ |
Molecule* myMolecules; |
| 407 |
+ |
Atom** myAtoms; |
| 408 |
+ |
|
| 409 |
+ |
// chi and eta are the propagated degrees of freedom |
| 410 |
+ |
|
| 411 |
+ |
double chi; |
| 412 |
+ |
double eta; |
| 413 |
+ |
double etaX; |
| 414 |
+ |
double etaY; |
| 415 |
|
double NkBT; |
| 416 |
|
|
| 417 |
|
// targetTemp, targetPressure, and tauBarostat must be set. |
| 427 |
|
|
| 428 |
|
}; |
| 429 |
|
|
| 430 |
+ |
|
| 431 |
|
template<typename T> class NPTfm : public T{ |
| 432 |
|
|
| 433 |
|
public: |
| 438 |
|
virtual void integrateStep( int calcPot, int calcStress ){ |
| 439 |
|
calcStress = 1; |
| 440 |
|
T::integrateStep( calcPot, calcStress ); |
| 441 |
+ |
accIntegralOfChidt(); |
| 442 |
|
} |
| 443 |
|
|
| 444 |
+ |
virtual double getConservedQuantity(void); |
| 445 |
+ |
|
| 446 |
|
void setTauThermostat(double tt) {tauThermostat = tt; have_tau_thermostat=1;} |
| 447 |
|
void setTauBarostat(double tb) {tauBarostat = tb; have_tau_barostat=1;} |
| 448 |
|
void setTargetTemp(double tt) {targetTemp = tt; have_target_temp = 1;} |
| 449 |
|
void setTargetPressure(double tp) {targetPressure = tp; have_target_pressure = 1;} |
| 450 |
+ |
void setChiTolerance(double tol) {chiTolerance = tol;} |
| 451 |
+ |
void setPosIterTolerance(double tol) {posIterTolerance = tol;} |
| 452 |
|
|
| 453 |
|
protected: |
| 454 |
|
|
| 455 |
|
virtual void moveA( void ); |
| 456 |
|
virtual void moveB( void ); |
| 457 |
|
|
| 458 |
+ |
virtual void resetIntegrator( void ); |
| 459 |
+ |
|
| 460 |
|
virtual int readyCheck(); |
| 461 |
|
|
| 462 |
+ |
void accIntegralOfChidt(void) { integralOfChidt += dt * chi;} |
| 463 |
+ |
|
| 464 |
|
Molecule* myMolecules; |
| 465 |
|
Atom** myAtoms; |
| 466 |
|
|
| 469 |
|
double chi; |
| 470 |
|
double eta[3][3]; |
| 471 |
|
double NkBT; |
| 472 |
+ |
double integralOfChidt; |
| 473 |
|
|
| 474 |
|
// targetTemp, targetPressure, and tauBarostat must be set. |
| 475 |
|
// One of qmass or tauThermostat must be set; |
| 481 |
|
|
| 482 |
|
short int have_tau_thermostat, have_tau_barostat, have_target_temp; |
| 483 |
|
short int have_target_pressure; |
| 484 |
+ |
double chiTolerance; |
| 485 |
+ |
short int have_chi_tolerance; |
| 486 |
+ |
double posIterTolerance; |
| 487 |
+ |
short int have_pos_iter_tolerance; |
| 488 |
|
|
| 489 |
|
}; |
| 490 |
|
|
| 505 |
|
void setTauBarostat(double tb) {tauBarostat = tb; have_tau_barostat=1;} |
| 506 |
|
void setTargetTemp(double tt) {targetTemp = tt; have_target_temp = 1;} |
| 507 |
|
void setTargetPressure(double tp) {targetPressure = tp; have_target_pressure = 1;} |
| 508 |
+ |
void setChiTolerance(double tol) {chiTolerance = tol;} |
| 509 |
+ |
void setPosIterTolerance(double tol) {posIterTolerance = tol;} |
| 510 |
|
|
| 511 |
|
protected: |
| 512 |
|
|
| 515 |
|
|
| 516 |
|
virtual int readyCheck(); |
| 517 |
|
|
| 518 |
+ |
virtual void resetIntegrator( void ); |
| 519 |
+ |
|
| 520 |
|
// chi and eta are the propagated degrees of freedom |
| 521 |
|
|
| 522 |
|
double chi; |
| 533 |
|
|
| 534 |
|
short int have_tau_thermostat, have_tau_barostat, have_target_temp; |
| 535 |
|
short int have_target_pressure; |
| 536 |
+ |
double chiTolerance; |
| 537 |
+ |
short int have_chi_tolerance; |
| 538 |
+ |
double posIterTolerance; |
| 539 |
+ |
short int have_pos_iter_tolerance; |
| 540 |
|
|
| 541 |
|
}; |
| 542 |
|
|
| 544 |
|
template<typename T> class ZConstraint : public T { |
| 545 |
|
|
| 546 |
|
public: |
| 547 |
< |
class ForceSubstractionPolicy{ |
| 547 |
> |
class ForceSubtractionPolicy{ |
| 548 |
|
public: |
| 549 |
< |
ForceSubstractionPolicy(ZConstraint<T>* integrator) {zconsIntegrator = integrator;} |
| 549 |
> |
ForceSubtractionPolicy(ZConstraint<T>* integrator) {zconsIntegrator = integrator;} |
| 550 |
|
|
| 551 |
|
virtual void update() = 0; |
| 552 |
|
virtual double getZFOfFixedZMols(Molecule* mol, Atom* atom, double totalForce) = 0; |
| 558 |
|
ZConstraint<T>* zconsIntegrator;; |
| 559 |
|
}; |
| 560 |
|
|
| 561 |
< |
class PolicyByNumber : ForceSubstractionPolicy{ |
| 561 |
> |
class PolicyByNumber : public ForceSubtractionPolicy{ |
| 562 |
> |
|
| 563 |
|
public: |
| 564 |
< |
PolicyByNumber(ZConstraint<T>* integrator) :ForceSubstractionPolicy(integrator) {} |
| 564 |
> |
PolicyByNumber(ZConstraint<T>* integrator) :ForceSubtractionPolicy(integrator) {} |
| 565 |
|
virtual void update(); |
| 566 |
|
virtual double getZFOfFixedZMols(Molecule* mol, Atom* atom, double totalForce) ; |
| 567 |
|
virtual double getZFOfMovingMols(Atom* atom, double totalForce) ; |
| 569 |
|
virtual double getHFOfUnconsMols(Atom* atom, double totalForce); |
| 570 |
|
|
| 571 |
|
private: |
| 572 |
< |
int totNumOfMovingAtoms; |
| 572 |
> |
int totNumOfMovingAtoms; |
| 573 |
|
}; |
| 574 |
|
|
| 575 |
< |
class PolicyByMass :ForceSubstractionPolicy{ |
| 575 |
> |
class PolicyByMass : public ForceSubtractionPolicy{ |
| 576 |
> |
|
| 577 |
|
public: |
| 578 |
< |
PolicyByMass(ZConstraint<T>* integrator) :ForceSubstractionPolicy(integrator) {} |
| 578 |
> |
PolicyByMass(ZConstraint<T>* integrator) :ForceSubtractionPolicy(integrator) {} |
| 579 |
|
|
| 580 |
|
virtual void update(); |
| 581 |
|
virtual double getZFOfFixedZMols(Molecule* mol, Atom* atom, double totalForce) ; |
| 667 |
|
double calcSysCOMVel(); |
| 668 |
|
double calcTotalForce(); |
| 669 |
|
|
| 670 |
< |
ForceSubstractionPolicy* forcePolicy; //force substration policy |
| 671 |
< |
friend class ForceSubstractionPolicy; |
| 670 |
> |
ForceSubtractionPolicy* forcePolicy; //force subtraction policy |
| 671 |
> |
friend class ForceSubtractionPolicy; |
| 672 |
|
|
| 673 |
|
}; |
| 674 |
|
|