| 44 |
|
|
| 45 |
|
void checkConstraints( void ); |
| 46 |
|
void rotate( int axes1, int axes2, double angle, double j[3], |
| 47 |
< |
double A[3][3] ); |
| 48 |
< |
|
| 47 |
> |
double A[3][3] ); |
| 48 |
> |
|
| 49 |
|
ForceFields* myFF; |
| 50 |
|
|
| 51 |
|
SimInfo *info; // all the info we'll ever need |
| 56 |
|
int nMols; |
| 57 |
|
|
| 58 |
|
int isConstrained; // boolean to know whether the systems contains |
| 59 |
< |
// constraints. |
| 59 |
> |
// constraints. |
| 60 |
|
int nConstrained; // counter for number of constraints |
| 61 |
|
int *constrainedA; // the i of a constraint pair |
| 62 |
|
int *constrainedB; // the j of a constraint pair |
| 278 |
|
|
| 279 |
|
Molecule* myMolecules; |
| 280 |
|
Atom** myAtoms; |
| 281 |
+ |
|
| 282 |
+ |
// chi and eta are the propagated degrees of freedom |
| 283 |
+ |
|
| 284 |
+ |
double chi; |
| 285 |
+ |
double eta[3][3]; |
| 286 |
+ |
double NkBT; |
| 287 |
+ |
|
| 288 |
+ |
// targetTemp, targetPressure, and tauBarostat must be set. |
| 289 |
+ |
// One of qmass or tauThermostat must be set; |
| 290 |
+ |
|
| 291 |
+ |
double targetTemp; |
| 292 |
+ |
double targetPressure; |
| 293 |
+ |
double tauThermostat; |
| 294 |
+ |
double tauBarostat; |
| 295 |
+ |
|
| 296 |
+ |
short int have_tau_thermostat, have_tau_barostat, have_target_temp; |
| 297 |
+ |
short int have_target_pressure; |
| 298 |
+ |
|
| 299 |
+ |
}; |
| 300 |
+ |
|
| 301 |
+ |
|
| 302 |
+ |
template<typename T> class NPTpr : public T{ |
| 303 |
+ |
|
| 304 |
+ |
public: |
| 305 |
+ |
|
| 306 |
+ |
NPTpr ( SimInfo *theInfo, ForceFields* the_ff); |
| 307 |
+ |
virtual ~NPTpr() {}; |
| 308 |
+ |
|
| 309 |
+ |
virtual void integrateStep( int calcPot, int calcStress ){ |
| 310 |
+ |
calcStress = 1; |
| 311 |
+ |
T::integrateStep( calcPot, calcStress ); |
| 312 |
+ |
} |
| 313 |
+ |
|
| 314 |
+ |
void setTauThermostat(double tt) {tauThermostat = tt; have_tau_thermostat=1;} |
| 315 |
+ |
void setTauBarostat(double tb) {tauBarostat = tb; have_tau_barostat=1;} |
| 316 |
+ |
void setTargetTemp(double tt) {targetTemp = tt; have_target_temp = 1;} |
| 317 |
+ |
void setTargetPressure(double tp) {targetPressure = tp; have_target_pressure = 1;} |
| 318 |
|
|
| 319 |
+ |
protected: |
| 320 |
+ |
|
| 321 |
+ |
virtual void moveA( void ); |
| 322 |
+ |
virtual void moveB( void ); |
| 323 |
+ |
|
| 324 |
+ |
virtual int readyCheck(); |
| 325 |
+ |
|
| 326 |
|
// chi and eta are the propagated degrees of freedom |
| 327 |
|
|
| 328 |
|
double chi; |
| 342 |
|
|
| 343 |
|
}; |
| 344 |
|
|
| 345 |
+ |
|
| 346 |
|
template<typename T> class ZConstraint : public T { |
| 347 |
+ |
|
| 348 |
+ |
public: |
| 349 |
+ |
class ForceSubstractionPolicy{ |
| 350 |
+ |
public: |
| 351 |
+ |
ForceSubstractionPolicy(ZConstraint<T>* integrator) {zconsIntegrator = integrator;} |
| 352 |
+ |
|
| 353 |
+ |
virtual void update() = 0; |
| 354 |
+ |
virtual double getZFOfFixedZMols(Molecule* mol, Atom* atom, double totalForce) = 0; |
| 355 |
+ |
virtual double getZFOfMovingMols(Atom* atom, double totalForce) = 0; |
| 356 |
+ |
virtual double getHFOfFixedZMols(Molecule* mol, Atom* atom, double totalForce) = 0; |
| 357 |
+ |
virtual double getHFOfUnconsMols(Atom* atom, double totalForce) = 0; |
| 358 |
+ |
|
| 359 |
+ |
protected: |
| 360 |
+ |
ZConstraint<T>* zconsIntegrator;; |
| 361 |
+ |
}; |
| 362 |
+ |
|
| 363 |
+ |
class PolicyByNumber : ForceSubstractionPolicy{ |
| 364 |
+ |
public: |
| 365 |
+ |
PolicyByNumber(ZConstraint<T>* integrator) :ForceSubstractionPolicy(integrator) {} |
| 366 |
+ |
virtual void update(); |
| 367 |
+ |
virtual double getZFOfFixedZMols(Molecule* mol, Atom* atom, double totalForce) ; |
| 368 |
+ |
virtual double getZFOfMovingMols(Atom* atom, double totalForce) ; |
| 369 |
+ |
virtual double getHFOfFixedZMols(Molecule* mol, Atom* atom, double totalForce); |
| 370 |
+ |
virtual double getHFOfUnconsMols(Atom* atom, double totalForce); |
| 371 |
+ |
|
| 372 |
+ |
private: |
| 373 |
+ |
int totNumOfMovingAtoms; |
| 374 |
+ |
}; |
| 375 |
|
|
| 376 |
+ |
class PolicyByMass :ForceSubstractionPolicy{ |
| 377 |
+ |
public: |
| 378 |
+ |
PolicyByMass(ZConstraint<T>* integrator) :ForceSubstractionPolicy(integrator) {} |
| 379 |
+ |
|
| 380 |
+ |
virtual void update(); |
| 381 |
+ |
virtual double getZFOfFixedZMols(Molecule* mol, Atom* atom, double totalForce) ; |
| 382 |
+ |
virtual double getZFOfMovingMols(Atom* atom, double totalForce) ; |
| 383 |
+ |
virtual double getHFOfFixedZMols(Molecule* mol, Atom* atom, double totalForce); |
| 384 |
+ |
virtual double getHFOfUnconsMols(Atom* atom, double totalForce); |
| 385 |
+ |
|
| 386 |
+ |
private: |
| 387 |
+ |
double totMassOfMovingAtoms; |
| 388 |
+ |
}; |
| 389 |
+ |
|
| 390 |
|
public: |
| 391 |
|
|
| 392 |
|
ZConstraint( SimInfo *theInfo, ForceFields* the_ff); |
| 395 |
|
void setZConsTime(double time) {this->zconsTime = time;} |
| 396 |
|
void getZConsTime() {return zconsTime;} |
| 397 |
|
|
| 398 |
< |
void setIndexOfAllZConsMols(vector<int> index) {indexOfAllZConsMols = index;} |
| 399 |
< |
void getIndexOfAllZConsMols() {return indexOfAllZConsMols;} |
| 398 |
> |
void setIndexOfAllZConsMols(vector<int> index) {indexOfAllZConsMols = index;} |
| 399 |
> |
void getIndexOfAllZConsMols() {return indexOfAllZConsMols;} |
| 400 |
|
|
| 401 |
< |
void setZConsOutput(const char * fileName) {zconsOutput = fileName;} |
| 401 |
> |
void setZConsOutput(const char * fileName) {zconsOutput = fileName;} |
| 402 |
|
string getZConsOutput() {return zconsOutput;} |
| 403 |
|
|
| 404 |
|
virtual void integrate(); |
| 405 |
|
|
| 406 |
|
|
| 407 |
|
#ifdef IS_MPI |
| 408 |
< |
virtual void update(); //which is called to indicate the molecules' migration |
| 408 |
> |
virtual void update(); //which is called to indicate the molecules' migration |
| 409 |
|
#endif |
| 410 |
|
|
| 411 |
|
protected: |
| 412 |
|
|
| 413 |
< |
enum ZConsState {zcsMoving, zcsFixed}; |
| 327 |
< |
|
| 328 |
< |
|
| 413 |
> |
enum ZConsState {zcsMoving, zcsFixed}; |
| 414 |
|
|
| 415 |
|
virtual void calcForce( int calcPot, int calcStress ); |
| 416 |
|
virtual void thermalize(void); |
| 417 |
|
|
| 418 |
|
void zeroOutVel(); |
| 419 |
|
void doZconstraintForce(); |
| 420 |
+ |
void doHarmonic(); |
| 421 |
|
bool checkZConsState(); |
| 422 |
|
|
| 423 |
|
bool haveFixedZMols(); |
| 428 |
|
int isZConstraintMol(Molecule* mol); |
| 429 |
|
|
| 430 |
|
|
| 431 |
< |
double zconsTime; |
| 432 |
< |
double ztol; |
| 431 |
> |
double zconsTime; //sample time |
| 432 |
> |
double zconsTol; //tolerance of z-contratint |
| 433 |
> |
double zForceConst; //base force constant term |
| 434 |
> |
//which is estimate by OOPSE |
| 435 |
|
|
| 436 |
< |
vector<Molecule*> zconsMols; |
| 437 |
< |
vector<double> massOfZConsMols; |
| 438 |
< |
vector<double> zconsPos; |
| 439 |
< |
vector<double> kz; |
| 440 |
< |
vector<ZConsState> states; |
| 353 |
< |
vector<double> ZPos; |
| 436 |
> |
vector<Molecule*> zconsMols; //z-constraint molecules array |
| 437 |
> |
vector<double> massOfZConsMols; //mass of z-constraint molecule |
| 438 |
> |
vector<double> kz; //force constant array |
| 439 |
> |
vector<ZConsState> states; //state of z-constraint molecules |
| 440 |
> |
vector<double> zPos; // |
| 441 |
|
|
| 442 |
|
|
| 443 |
< |
vector<Molecule*> unconsMols; |
| 444 |
< |
vector<double> massOfUnconsMols; |
| 445 |
< |
double totalMassOfUncons; |
| 443 |
> |
vector<Molecule*> unconsMols; //unconstraint molecules array |
| 444 |
> |
vector<double> massOfUnconsMols; //mass array of unconstraint molecules |
| 445 |
> |
double totalMassOfUncons; //total mas of unconstraint molecules |
| 446 |
> |
|
| 447 |
> |
vector<ZConsParaItem>* parameters; // |
| 448 |
|
|
| 449 |
|
vector<int> indexOfAllZConsMols; //index of All Z-Constraint Molecuels |
| 450 |
|
|
| 451 |
|
int* indexOfZConsMols; //index of local Z-Constraint Molecules |
| 452 |
|
double* fz; |
| 453 |
+ |
double* curZPos; |
| 454 |
|
|
| 455 |
< |
int totNumOfUnconsAtoms; |
| 455 |
> |
int totNumOfUnconsAtoms; //total number of uncontraint atoms |
| 456 |
|
|
| 457 |
|
int whichDirection; //constraint direction |
| 458 |
|
|
| 459 |
|
private: |
| 460 |
|
|
| 461 |
< |
string zconsOutput; |
| 462 |
< |
ZConsWriter* fzOut; |
| 461 |
> |
string zconsOutput; //filename of zconstraint output |
| 462 |
> |
ZConsWriter* fzOut; //z-constraint writer |
| 463 |
|
|
| 464 |
+ |
double curZconsTime; |
| 465 |
|
|
| 466 |
+ |
double calcMovingMolsCOMVel(); |
| 467 |
+ |
double calcSysCOMVel(); |
| 468 |
+ |
double calcTotalForce(); |
| 469 |
+ |
|
| 470 |
+ |
ForceSubstractionPolicy* forcePolicy; //force substration policy |
| 471 |
+ |
friend class ForceSubstractionPolicy; |
| 472 |
+ |
|
| 473 |
|
}; |
| 474 |
|
|
| 475 |
|
#endif |