195 |
|
|
196 |
|
double tt2, tb2; |
197 |
|
double instaTemp, instaPress, instaVol; |
198 |
+ |
double press[3][3]; |
199 |
|
|
200 |
|
int Nparticles; |
201 |
|
|
253 |
|
double eta, oldEta, prevEta; |
254 |
|
}; |
255 |
|
|
256 |
< |
|
256 |
< |
template<typename T> class NPTim : public T{ |
256 |
> |
template<typename T> class NPTf : public T{ |
257 |
|
|
258 |
|
public: |
259 |
– |
|
260 |
– |
NPTim ( SimInfo *theInfo, ForceFields* the_ff); |
261 |
– |
virtual ~NPTim() {} |
259 |
|
|
260 |
< |
virtual void integrateStep( int calcPot, int calcStress ){ |
261 |
< |
calcStress = 1; |
265 |
< |
T::integrateStep( calcPot, calcStress ); |
266 |
< |
accIntegralOfChidt(); |
267 |
< |
} |
260 |
> |
NPTf ( SimInfo *theInfo, ForceFields* the_ff); |
261 |
> |
virtual ~NPTf(); |
262 |
|
|
263 |
|
virtual double getConservedQuantity(void); |
264 |
+ |
virtual void resetIntegrator(void); |
265 |
|
|
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;} |
277 |
– |
|
266 |
|
protected: |
267 |
|
|
268 |
< |
virtual void moveA( void ); |
269 |
< |
virtual void moveB( void ); |
268 |
> |
virtual void evolveEtaA(void); |
269 |
> |
virtual void evolveEtaB(void); |
270 |
|
|
271 |
< |
virtual int readyCheck(); |
271 |
> |
virtual bool etaConverged( void ); |
272 |
|
|
273 |
< |
virtual void resetIntegrator( void ); |
273 |
> |
virtual void scaleSimBox( void ); |
274 |
|
|
275 |
< |
void accIntegralOfChidt(void) { integralOfChidt += dt * chi;} |
276 |
< |
|
277 |
< |
Molecule* myMolecules; |
278 |
< |
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; |
275 |
> |
virtual void getVelScaleA( double sc[3], double vel[3] ); |
276 |
> |
virtual void getVelScaleB( double sc[3], int index ); |
277 |
> |
virtual void getPosScale(double pos[3], double COM[3], |
278 |
> |
int index, double sc[3]); |
279 |
|
|
280 |
< |
short int have_tau_thermostat, have_tau_barostat, have_target_temp; |
281 |
< |
short int have_target_pressure; |
282 |
< |
double chiTolerance; |
310 |
< |
short int have_chi_tolerance; |
311 |
< |
double posIterTolerance; |
312 |
< |
short int have_pos_iter_tolerance; |
313 |
< |
|
280 |
> |
double eta[3][3]; |
281 |
> |
double oldEta[3][3]; |
282 |
> |
double prevEta[3][3]; |
283 |
|
}; |
284 |
|
|
285 |
< |
template<typename T> class NPTzm : public T{ |
285 |
> |
template<typename T> class NPTxyz : public T{ |
286 |
|
|
287 |
|
public: |
288 |
|
|
289 |
< |
NPTzm ( SimInfo *theInfo, ForceFields* the_ff); |
290 |
< |
virtual ~NPTzm() {}; |
289 |
> |
NPTxyz ( SimInfo *theInfo, ForceFields* the_ff); |
290 |
> |
virtual ~NPTxyz(); |
291 |
|
|
292 |
< |
virtual void integrateStep( int calcPot, int calcStress ){ |
293 |
< |
calcStress = 1; |
325 |
< |
T::integrateStep( calcPot, calcStress ); |
326 |
< |
} |
292 |
> |
virtual double getConservedQuantity(void); |
293 |
> |
virtual void resetIntegrator(void); |
294 |
|
|
328 |
– |
void setTauThermostat(double tt) {tauThermostat = tt; have_tau_thermostat=1;} |
329 |
– |
void setTauBarostat(double tb) {tauBarostat = tb; have_tau_barostat=1;} |
330 |
– |
void setTargetTemp(double tt) {targetTemp = tt; have_target_temp = 1;} |
331 |
– |
void setTargetPressure(double tp) {targetPressure = tp; have_target_pressure = 1;} |
332 |
– |
|
295 |
|
protected: |
296 |
|
|
297 |
< |
virtual void moveA( void ); |
298 |
< |
virtual void moveB( void ); |
297 |
> |
virtual void evolveEtaA(void); |
298 |
> |
virtual void evolveEtaB(void); |
299 |
|
|
300 |
< |
virtual int readyCheck(); |
300 |
> |
virtual bool etaConverged( void ); |
301 |
|
|
302 |
< |
virtual void resetIntegrator( void ); |
341 |
< |
|
342 |
< |
Molecule* myMolecules; |
343 |
< |
Atom** myAtoms; |
302 |
> |
virtual void scaleSimBox( void ); |
303 |
|
|
304 |
< |
// chi and eta are the propagated degrees of freedom |
304 |
> |
virtual void getVelScaleA( double sc[3], double vel[3] ); |
305 |
> |
virtual void getVelScaleB( double sc[3], int index ); |
306 |
> |
virtual void getPosScale(double pos[3], double COM[3], |
307 |
> |
int index, double sc[3]); |
308 |
|
|
347 |
– |
double chi; |
348 |
– |
double eta; |
349 |
– |
double etaZ; |
350 |
– |
double NkBT; |
351 |
– |
|
352 |
– |
// targetTemp, targetPressure, and tauBarostat must be set. |
353 |
– |
// One of qmass or tauThermostat must be set; |
354 |
– |
|
355 |
– |
double targetTemp; |
356 |
– |
double targetPressure; |
357 |
– |
double tauThermostat; |
358 |
– |
double tauBarostat; |
359 |
– |
|
360 |
– |
short int have_tau_thermostat, have_tau_barostat, have_target_temp; |
361 |
– |
short int have_target_pressure; |
362 |
– |
|
363 |
– |
}; |
364 |
– |
|
365 |
– |
template<typename T> class NPTf : public T{ |
366 |
– |
|
367 |
– |
public: |
368 |
– |
|
369 |
– |
NPTf ( SimInfo *theInfo, ForceFields* the_ff); |
370 |
– |
virtual ~NPTf(); |
371 |
– |
|
372 |
– |
virtual void integrateStep( int calcPot, int calcStress ){ |
373 |
– |
calcStress = 1; |
374 |
– |
T::integrateStep( calcPot, calcStress ); |
375 |
– |
} |
376 |
– |
|
377 |
– |
virtual double getConservedQuantity(void); |
378 |
– |
|
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;} |
385 |
– |
|
386 |
– |
protected: |
387 |
– |
|
388 |
– |
virtual void moveA( void ); |
389 |
– |
virtual void moveB( void ); |
390 |
– |
|
391 |
– |
virtual void resetIntegrator( void ); |
392 |
– |
|
393 |
– |
virtual int readyCheck(); |
394 |
– |
|
395 |
– |
|
396 |
– |
// chi and eta are the propagated degrees of freedom |
397 |
– |
|
398 |
– |
double chi; |
309 |
|
double eta[3][3]; |
310 |
< |
double NkBT; |
311 |
< |
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; |
427 |
< |
}; |
428 |
< |
|
429 |
< |
template<typename T> class NPTxym : public T{ |
430 |
< |
|
431 |
< |
public: |
432 |
< |
|
433 |
< |
NPTxym ( SimInfo *theInfo, ForceFields* the_ff); |
434 |
< |
virtual ~NPTxym() {}; |
435 |
< |
|
436 |
< |
virtual void integrateStep( int calcPot, int calcStress ){ |
437 |
< |
calcStress = 1; |
438 |
< |
T::integrateStep( calcPot, calcStress ); |
439 |
< |
} |
440 |
< |
|
441 |
< |
void setTauThermostat(double tt) {tauThermostat = tt; have_tau_thermostat=1;} |
442 |
< |
void setTauBarostat(double tb) {tauBarostat = tb; have_tau_barostat=1;} |
443 |
< |
void setTargetTemp(double tt) {targetTemp = tt; have_target_temp = 1;} |
444 |
< |
void setTargetPressure(double tp) {targetPressure = tp; have_target_pressure = 1;} |
445 |
< |
|
446 |
< |
protected: |
447 |
< |
|
448 |
< |
virtual void moveA( void ); |
449 |
< |
virtual void moveB( void ); |
450 |
< |
|
451 |
< |
virtual int readyCheck(); |
452 |
< |
|
453 |
< |
virtual void resetIntegrator( void ); |
454 |
< |
|
455 |
< |
Molecule* myMolecules; |
456 |
< |
Atom** myAtoms; |
457 |
< |
|
458 |
< |
// chi and eta are the propagated degrees of freedom |
459 |
< |
|
460 |
< |
double chi; |
461 |
< |
double eta; |
462 |
< |
double etaX; |
463 |
< |
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 |
< |
|
310 |
> |
double oldEta[3][3]; |
311 |
> |
double prevEta[3][3]; |
312 |
|
}; |
313 |
|
|
314 |
|
|
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]; |
520 |
– |
double NkBT; |
521 |
– |
double integralOfChidt; |
522 |
– |
|
523 |
– |
// targetTemp, targetPressure, and tauBarostat must be set. |
524 |
– |
// One of qmass or tauThermostat must be set; |
525 |
– |
|
526 |
– |
double targetTemp; |
527 |
– |
double targetPressure; |
528 |
– |
double tauThermostat; |
529 |
– |
double tauBarostat; |
530 |
– |
|
531 |
– |
short int have_tau_thermostat, have_tau_barostat, have_target_temp; |
532 |
– |
short int have_target_pressure; |
533 |
– |
double chiTolerance; |
534 |
– |
short int have_chi_tolerance; |
535 |
– |
double posIterTolerance; |
536 |
– |
short int have_pos_iter_tolerance; |
537 |
– |
|
538 |
– |
}; |
539 |
– |
|
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 |
– |
|
315 |
|
template<typename T> class ZConstraint : public T { |
316 |
|
|
317 |
|
public: |
326 |
|
virtual double getHFOfUnconsMols(Atom* atom, double totalForce) = 0; |
327 |
|
|
328 |
|
protected: |
329 |
< |
ZConstraint<T>* zconsIntegrator;; |
329 |
> |
ZConstraint<T>* zconsIntegrator; |
330 |
|
}; |
331 |
|
|
332 |
|
class PolicyByNumber : public ForceSubtractionPolicy{ |
379 |
|
virtual void update(); //which is called to indicate the molecules' migration |
380 |
|
#endif |
381 |
|
|
382 |
+ |
enum ZConsState {zcsMoving, zcsFixed}; |
383 |
+ |
|
384 |
+ |
vector<Molecule*> zconsMols; //z-constraint molecules array |
385 |
+ |
vector<ZConsState> states; //state of z-constraint molecules |
386 |
+ |
|
387 |
+ |
|
388 |
+ |
|
389 |
+ |
int totNumOfUnconsAtoms; //total number of uncontraint atoms |
390 |
+ |
double totalMassOfUncons; //total mas of unconstraint molecules |
391 |
+ |
|
392 |
+ |
|
393 |
|
protected: |
394 |
|
|
395 |
< |
enum ZConsState {zcsMoving, zcsFixed}; |
395 |
> |
|
396 |
|
|
397 |
|
virtual void calcForce( int calcPot, int calcStress ); |
398 |
|
virtual void thermalize(void); |
415 |
|
double zForceConst; //base force constant term |
416 |
|
//which is estimate by OOPSE |
417 |
|
|
418 |
< |
vector<Molecule*> zconsMols; //z-constraint molecules array |
418 |
> |
|
419 |
|
vector<double> massOfZConsMols; //mass of z-constraint molecule |
420 |
|
vector<double> kz; //force constant array |
421 |
< |
vector<ZConsState> states; //state of z-constraint molecules |
421 |
> |
|
422 |
|
vector<double> zPos; // |
423 |
|
|
424 |
|
|
425 |
|
vector<Molecule*> unconsMols; //unconstraint molecules array |
426 |
|
vector<double> massOfUnconsMols; //mass array of unconstraint molecules |
694 |
– |
double totalMassOfUncons; //total mas of unconstraint molecules |
427 |
|
|
428 |
+ |
|
429 |
|
vector<ZConsParaItem>* parameters; // |
430 |
|
|
431 |
|
vector<int> indexOfAllZConsMols; //index of All Z-Constraint Molecuels |
434 |
|
double* fz; |
435 |
|
double* curZPos; |
436 |
|
|
704 |
– |
int totNumOfUnconsAtoms; //total number of uncontraint atoms |
437 |
|
|
438 |
+ |
|
439 |
|
int whichDirection; //constraint direction |
440 |
|
|
441 |
|
private: |