| 195 |
|
|
| 196 |
|
double tt2, tb2; |
| 197 |
|
double instaTemp, instaPress, instaVol; |
| 198 |
+ |
double press[3][3]; |
| 199 |
|
|
| 200 |
|
int Nparticles; |
| 201 |
|
|
| 252 |
|
|
| 253 |
|
double eta, oldEta, prevEta; |
| 254 |
|
}; |
| 254 |
– |
|
| 255 |
– |
|
| 256 |
– |
template<typename T> class NPTim : public T{ |
| 257 |
– |
|
| 258 |
– |
public: |
| 259 |
– |
|
| 260 |
– |
NPTim ( SimInfo *theInfo, ForceFields* the_ff); |
| 261 |
– |
virtual ~NPTim() {} |
| 262 |
– |
|
| 263 |
– |
virtual void integrateStep( int calcPot, int calcStress ){ |
| 264 |
– |
calcStress = 1; |
| 265 |
– |
T::integrateStep( calcPot, calcStress ); |
| 266 |
– |
accIntegralOfChidt(); |
| 267 |
– |
} |
| 268 |
– |
|
| 269 |
– |
virtual double getConservedQuantity(void); |
| 270 |
– |
|
| 271 |
– |
void setTauThermostat(double tt) {tauThermostat = tt; have_tau_thermostat=1;} |
| 272 |
– |
void setTauBarostat(double tb) {tauBarostat = tb; have_tau_barostat=1;} |
| 273 |
– |
void setTargetTemp(double tt) {targetTemp = tt; have_target_temp = 1;} |
| 274 |
– |
void setTargetPressure(double tp) {targetPressure = tp; have_target_pressure = 1;} |
| 275 |
– |
void setChiTolerance(double tol) {chiTolerance = tol;} |
| 276 |
– |
void setPosIterTolerance(double tol) {posIterTolerance = tol;} |
| 255 |
|
|
| 278 |
– |
protected: |
| 279 |
– |
|
| 280 |
– |
virtual void moveA( void ); |
| 281 |
– |
virtual void moveB( void ); |
| 282 |
– |
|
| 283 |
– |
virtual int readyCheck(); |
| 284 |
– |
|
| 285 |
– |
virtual void resetIntegrator( void ); |
| 286 |
– |
|
| 287 |
– |
void accIntegralOfChidt(void) { integralOfChidt += dt * chi;} |
| 288 |
– |
|
| 289 |
– |
Molecule* myMolecules; |
| 290 |
– |
Atom** myAtoms; |
| 291 |
– |
|
| 292 |
– |
// chi and eta are the propagated degrees of freedom |
| 293 |
– |
|
| 294 |
– |
double chi; |
| 295 |
– |
double eta; |
| 296 |
– |
double NkBT; |
| 297 |
– |
double integralOfChidt; |
| 298 |
– |
|
| 299 |
– |
// targetTemp, targetPressure, and tauBarostat must be set. |
| 300 |
– |
// One of qmass or tauThermostat must be set; |
| 301 |
– |
|
| 302 |
– |
double targetTemp; |
| 303 |
– |
double targetPressure; |
| 304 |
– |
double tauThermostat; |
| 305 |
– |
double tauBarostat; |
| 306 |
– |
|
| 307 |
– |
short int have_tau_thermostat, have_tau_barostat, have_target_temp; |
| 308 |
– |
short int have_target_pressure; |
| 309 |
– |
double chiTolerance; |
| 310 |
– |
short int have_chi_tolerance; |
| 311 |
– |
double posIterTolerance; |
| 312 |
– |
short int have_pos_iter_tolerance; |
| 313 |
– |
|
| 314 |
– |
}; |
| 315 |
– |
|
| 256 |
|
template<typename T> class NPTzm : public T{ |
| 257 |
|
|
| 258 |
|
public: |
| 309 |
|
NPTf ( SimInfo *theInfo, ForceFields* the_ff); |
| 310 |
|
virtual ~NPTf(); |
| 311 |
|
|
| 372 |
– |
virtual void integrateStep( int calcPot, int calcStress ){ |
| 373 |
– |
calcStress = 1; |
| 374 |
– |
T::integrateStep( calcPot, calcStress ); |
| 375 |
– |
} |
| 376 |
– |
|
| 312 |
|
virtual double getConservedQuantity(void); |
| 313 |
< |
|
| 379 |
< |
void setTauThermostat(double tt) {tauThermostat = tt; have_tau_thermostat=1;} |
| 380 |
< |
void setTauBarostat(double tb) {tauBarostat = tb; have_tau_barostat=1;} |
| 381 |
< |
void setTargetTemp(double tt) {targetTemp = tt; have_target_temp = 1;} |
| 382 |
< |
void setTargetPressure(double tp) {targetPressure = tp; have_target_pressure = 1;} |
| 383 |
< |
void setChiTolerance(double tol) {chiTolerance = tol;} |
| 384 |
< |
void setPosIterTolerance(double tol) {posIterTolerance = tol;} |
| 313 |
> |
virtual void resetIntegrator(void); |
| 314 |
|
|
| 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 void resetIntegrator( void ); |
| 320 |
> |
virtual bool etaConverged( void ); |
| 321 |
|
|
| 322 |
< |
virtual int readyCheck(); |
| 322 |
> |
virtual void scaleSimBox( void ); |
| 323 |
|
|
| 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 |
|
|
| 396 |
– |
// chi and eta are the propagated degrees of freedom |
| 397 |
– |
|
| 398 |
– |
double chi; |
| 329 |
|
double eta[3][3]; |
| 330 |
< |
double NkBT; |
| 331 |
< |
double fkBT; |
| 402 |
< |
|
| 403 |
< |
int Nparticles; |
| 404 |
< |
|
| 405 |
< |
double *oldPos; |
| 406 |
< |
double *oldVel; |
| 407 |
< |
double *oldJi; |
| 408 |
< |
|
| 409 |
< |
double integralOfChidt; |
| 410 |
< |
|
| 411 |
< |
// targetTemp, targetPressure, and tauBarostat must be set. |
| 412 |
< |
// One of qmass or tauThermostat must be set; |
| 413 |
< |
|
| 414 |
< |
double targetTemp; |
| 415 |
< |
double targetPressure; |
| 416 |
< |
double tauThermostat; |
| 417 |
< |
double tauBarostat; |
| 418 |
< |
|
| 419 |
< |
short int have_tau_thermostat, have_tau_barostat, have_target_temp; |
| 420 |
< |
short int have_target_pressure; |
| 421 |
< |
double chiTolerance; |
| 422 |
< |
short int have_chi_tolerance; |
| 423 |
< |
double posIterTolerance; |
| 424 |
< |
short int have_pos_iter_tolerance; |
| 425 |
< |
double etaTolerance; |
| 426 |
< |
short int have_eta_tolerance; |
| 330 |
> |
double oldEta[3][3]; |
| 331 |
> |
double prevEta[3][3]; |
| 332 |
|
}; |
| 333 |
|
|
| 334 |
|
template<typename T> class NPTxym : public T{ |
| 366 |
|
double eta; |
| 367 |
|
double etaX; |
| 368 |
|
double etaY; |
| 464 |
– |
double NkBT; |
| 465 |
– |
|
| 466 |
– |
// targetTemp, targetPressure, and tauBarostat must be set. |
| 467 |
– |
// One of qmass or tauThermostat must be set; |
| 468 |
– |
|
| 469 |
– |
double targetTemp; |
| 470 |
– |
double targetPressure; |
| 471 |
– |
double tauThermostat; |
| 472 |
– |
double tauBarostat; |
| 473 |
– |
|
| 474 |
– |
short int have_tau_thermostat, have_tau_barostat, have_target_temp; |
| 475 |
– |
short int have_target_pressure; |
| 476 |
– |
|
| 477 |
– |
}; |
| 478 |
– |
|
| 479 |
– |
|
| 480 |
– |
template<typename T> class NPTfm : public T{ |
| 481 |
– |
|
| 482 |
– |
public: |
| 483 |
– |
|
| 484 |
– |
NPTfm ( SimInfo *theInfo, ForceFields* the_ff); |
| 485 |
– |
virtual ~NPTfm() {}; |
| 486 |
– |
|
| 487 |
– |
virtual void integrateStep( int calcPot, int calcStress ){ |
| 488 |
– |
calcStress = 1; |
| 489 |
– |
T::integrateStep( calcPot, calcStress ); |
| 490 |
– |
accIntegralOfChidt(); |
| 491 |
– |
} |
| 492 |
– |
|
| 493 |
– |
virtual double getConservedQuantity(void); |
| 494 |
– |
|
| 495 |
– |
void setTauThermostat(double tt) {tauThermostat = tt; have_tau_thermostat=1;} |
| 496 |
– |
void setTauBarostat(double tb) {tauBarostat = tb; have_tau_barostat=1;} |
| 497 |
– |
void setTargetTemp(double tt) {targetTemp = tt; have_target_temp = 1;} |
| 498 |
– |
void setTargetPressure(double tp) {targetPressure = tp; have_target_pressure = 1;} |
| 499 |
– |
void setChiTolerance(double tol) {chiTolerance = tol;} |
| 500 |
– |
void setPosIterTolerance(double tol) {posIterTolerance = tol;} |
| 501 |
– |
|
| 502 |
– |
protected: |
| 503 |
– |
|
| 504 |
– |
virtual void moveA( void ); |
| 505 |
– |
virtual void moveB( void ); |
| 506 |
– |
|
| 507 |
– |
virtual void resetIntegrator( void ); |
| 508 |
– |
|
| 509 |
– |
virtual int readyCheck(); |
| 510 |
– |
|
| 511 |
– |
void accIntegralOfChidt(void) { integralOfChidt += dt * chi;} |
| 512 |
– |
|
| 513 |
– |
Molecule* myMolecules; |
| 514 |
– |
Atom** myAtoms; |
| 515 |
– |
|
| 516 |
– |
// chi and eta are the propagated degrees of freedom |
| 517 |
– |
|
| 518 |
– |
double chi; |
| 519 |
– |
double eta[3][3]; |
| 369 |
|
double NkBT; |
| 521 |
– |
double integralOfChidt; |
| 370 |
|
|
| 371 |
|
// targetTemp, targetPressure, and tauBarostat must be set. |
| 372 |
|
// One of qmass or tauThermostat must be set; |
| 378 |
|
|
| 379 |
|
short int have_tau_thermostat, have_tau_barostat, have_target_temp; |
| 380 |
|
short int have_target_pressure; |
| 533 |
– |
double chiTolerance; |
| 534 |
– |
short int have_chi_tolerance; |
| 535 |
– |
double posIterTolerance; |
| 536 |
– |
short int have_pos_iter_tolerance; |
| 381 |
|
|
| 382 |
|
}; |
| 383 |
|
|
| 540 |
– |
|
| 541 |
– |
template<typename T> class NPTpr : public T{ |
| 542 |
– |
|
| 543 |
– |
public: |
| 544 |
– |
|
| 545 |
– |
NPTpr ( SimInfo *theInfo, ForceFields* the_ff); |
| 546 |
– |
virtual ~NPTpr() {}; |
| 547 |
– |
|
| 548 |
– |
virtual void integrateStep( int calcPot, int calcStress ){ |
| 549 |
– |
calcStress = 1; |
| 550 |
– |
T::integrateStep( calcPot, calcStress ); |
| 551 |
– |
} |
| 552 |
– |
|
| 553 |
– |
void setTauThermostat(double tt) {tauThermostat = tt; have_tau_thermostat=1;} |
| 554 |
– |
void setTauBarostat(double tb) {tauBarostat = tb; have_tau_barostat=1;} |
| 555 |
– |
void setTargetTemp(double tt) {targetTemp = tt; have_target_temp = 1;} |
| 556 |
– |
void setTargetPressure(double tp) {targetPressure = tp; have_target_pressure = 1;} |
| 557 |
– |
void setChiTolerance(double tol) {chiTolerance = tol;} |
| 558 |
– |
void setPosIterTolerance(double tol) {posIterTolerance = tol;} |
| 559 |
– |
|
| 560 |
– |
protected: |
| 561 |
– |
|
| 562 |
– |
virtual void moveA( void ); |
| 563 |
– |
virtual void moveB( void ); |
| 564 |
– |
|
| 565 |
– |
virtual int readyCheck(); |
| 566 |
– |
|
| 567 |
– |
virtual void resetIntegrator( void ); |
| 568 |
– |
|
| 569 |
– |
// chi and eta are the propagated degrees of freedom |
| 570 |
– |
|
| 571 |
– |
double chi; |
| 572 |
– |
double eta[3][3]; |
| 573 |
– |
double NkBT; |
| 574 |
– |
|
| 575 |
– |
// targetTemp, targetPressure, and tauBarostat must be set. |
| 576 |
– |
// One of qmass or tauThermostat must be set; |
| 577 |
– |
|
| 578 |
– |
double targetTemp; |
| 579 |
– |
double targetPressure; |
| 580 |
– |
double tauThermostat; |
| 581 |
– |
double tauBarostat; |
| 582 |
– |
|
| 583 |
– |
short int have_tau_thermostat, have_tau_barostat, have_target_temp; |
| 584 |
– |
short int have_target_pressure; |
| 585 |
– |
double chiTolerance; |
| 586 |
– |
short int have_chi_tolerance; |
| 587 |
– |
double posIterTolerance; |
| 588 |
– |
short int have_pos_iter_tolerance; |
| 589 |
– |
|
| 590 |
– |
}; |
| 591 |
– |
|
| 592 |
– |
|
| 384 |
|
template<typename T> class ZConstraint : public T { |
| 385 |
|
|
| 386 |
|
public: |
| 395 |
|
virtual double getHFOfUnconsMols(Atom* atom, double totalForce) = 0; |
| 396 |
|
|
| 397 |
|
protected: |
| 398 |
< |
ZConstraint<T>* zconsIntegrator;; |
| 398 |
> |
ZConstraint<T>* zconsIntegrator; |
| 399 |
|
}; |
| 400 |
|
|
| 401 |
|
class PolicyByNumber : public ForceSubtractionPolicy{ |
| 448 |
|
virtual void update(); //which is called to indicate the molecules' migration |
| 449 |
|
#endif |
| 450 |
|
|
| 451 |
+ |
enum ZConsState {zcsMoving, zcsFixed}; |
| 452 |
+ |
|
| 453 |
+ |
vector<Molecule*> zconsMols; //z-constraint molecules array |
| 454 |
+ |
vector<ZConsState> states; //state of z-constraint molecules |
| 455 |
+ |
|
| 456 |
+ |
|
| 457 |
+ |
|
| 458 |
+ |
int totNumOfUnconsAtoms; //total number of uncontraint atoms |
| 459 |
+ |
double totalMassOfUncons; //total mas of unconstraint molecules |
| 460 |
+ |
|
| 461 |
+ |
|
| 462 |
|
protected: |
| 463 |
|
|
| 464 |
< |
enum ZConsState {zcsMoving, zcsFixed}; |
| 464 |
> |
|
| 465 |
|
|
| 466 |
|
virtual void calcForce( int calcPot, int calcStress ); |
| 467 |
|
virtual void thermalize(void); |
| 484 |
|
double zForceConst; //base force constant term |
| 485 |
|
//which is estimate by OOPSE |
| 486 |
|
|
| 487 |
< |
vector<Molecule*> zconsMols; //z-constraint molecules array |
| 487 |
> |
|
| 488 |
|
vector<double> massOfZConsMols; //mass of z-constraint molecule |
| 489 |
|
vector<double> kz; //force constant array |
| 490 |
< |
vector<ZConsState> states; //state of z-constraint molecules |
| 490 |
> |
|
| 491 |
|
vector<double> zPos; // |
| 492 |
|
|
| 493 |
|
|
| 494 |
|
vector<Molecule*> unconsMols; //unconstraint molecules array |
| 495 |
|
vector<double> massOfUnconsMols; //mass array of unconstraint molecules |
| 694 |
– |
double totalMassOfUncons; //total mas of unconstraint molecules |
| 496 |
|
|
| 497 |
+ |
|
| 498 |
|
vector<ZConsParaItem>* parameters; // |
| 499 |
|
|
| 500 |
|
vector<int> indexOfAllZConsMols; //index of All Z-Constraint Molecuels |
| 503 |
|
double* fz; |
| 504 |
|
double* curZPos; |
| 505 |
|
|
| 704 |
– |
int totNumOfUnconsAtoms; //total number of uncontraint atoms |
| 506 |
|
|
| 507 |
+ |
|
| 508 |
|
int whichDirection; //constraint direction |
| 509 |
|
|
| 510 |
|
private: |