38 |
|
virtual void constrainA( 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 |
|
void checkConstraints( void ); |
48 |
|
void rotate( int axes1, int axes2, double angle, double j[3], |
49 |
< |
double A[3][3] ); |
50 |
< |
|
46 |
< |
|
49 |
> |
double A[3][3] ); |
50 |
> |
|
51 |
|
ForceFields* myFF; |
52 |
|
|
53 |
|
SimInfo *info; // all the info we'll ever need |
58 |
|
int nMols; |
59 |
|
|
60 |
|
int isConstrained; // boolean to know whether the systems contains |
61 |
< |
// constraints. |
61 |
> |
// constraints. |
62 |
|
int nConstrained; // counter for number of constraints |
63 |
|
int *constrainedA; // the i of a constraint pair |
64 |
|
int *constrainedB; // the j of a constraint pair |
106 |
|
virtual void moveB( void ); |
107 |
|
|
108 |
|
virtual int readyCheck(); |
109 |
+ |
|
110 |
+ |
virtual void resetIntegrator( void ); |
111 |
|
|
112 |
|
// chi is a propagated degree of freedom. |
113 |
|
|
148 |
|
|
149 |
|
virtual int readyCheck(); |
150 |
|
|
151 |
+ |
virtual void resetIntegrator( void ); |
152 |
+ |
|
153 |
|
// chi and eta are the propagated degrees of freedom |
154 |
|
|
155 |
|
double chi; |
193 |
|
|
194 |
|
virtual int readyCheck(); |
195 |
|
|
196 |
+ |
virtual void resetIntegrator( void ); |
197 |
+ |
|
198 |
|
Molecule* myMolecules; |
199 |
|
Atom** myAtoms; |
200 |
|
|
239 |
|
virtual void moveA( void ); |
240 |
|
virtual void moveB( void ); |
241 |
|
|
242 |
+ |
virtual void resetIntegrator( void ); |
243 |
+ |
|
244 |
|
virtual int readyCheck(); |
245 |
|
|
246 |
|
// chi and eta are the propagated degrees of freedom |
284 |
|
virtual void moveA( void ); |
285 |
|
virtual void moveB( void ); |
286 |
|
|
287 |
+ |
virtual void resetIntegrator( void ); |
288 |
+ |
|
289 |
|
virtual int readyCheck(); |
290 |
|
|
291 |
|
Molecule* myMolecules; |
310 |
|
|
311 |
|
}; |
312 |
|
|
299 |
– |
template<typename T> class ZConstraint : public T { |
313 |
|
|
314 |
+ |
template<typename T> class NPTpr : public T{ |
315 |
+ |
|
316 |
|
public: |
317 |
|
|
318 |
< |
ZConstraint( SimInfo *theInfo, ForceFields* the_ff); |
319 |
< |
~ZConstraint(); |
318 |
> |
NPTpr ( SimInfo *theInfo, ForceFields* the_ff); |
319 |
> |
virtual ~NPTpr() {}; |
320 |
|
|
321 |
< |
virtual void integrateStep( int calcPot, int calcStress ); |
322 |
< |
|
321 |
> |
virtual void integrateStep( int calcPot, int calcStress ){ |
322 |
> |
calcStress = 1; |
323 |
> |
T::integrateStep( calcPot, calcStress ); |
324 |
> |
} |
325 |
> |
|
326 |
> |
void setTauThermostat(double tt) {tauThermostat = tt; have_tau_thermostat=1;} |
327 |
> |
void setTauBarostat(double tb) {tauBarostat = tb; have_tau_barostat=1;} |
328 |
> |
void setTargetTemp(double tt) {targetTemp = tt; have_target_temp = 1;} |
329 |
> |
void setTargetPressure(double tp) {targetPressure = tp; have_target_pressure = 1;} |
330 |
> |
|
331 |
> |
protected: |
332 |
> |
|
333 |
> |
virtual void moveA( void ); |
334 |
> |
virtual void moveB( void ); |
335 |
> |
|
336 |
> |
virtual int readyCheck(); |
337 |
> |
|
338 |
> |
virtual void resetIntegrator( void ); |
339 |
> |
|
340 |
> |
// chi and eta are the propagated degrees of freedom |
341 |
> |
|
342 |
> |
double chi; |
343 |
> |
double eta[3][3]; |
344 |
> |
double NkBT; |
345 |
> |
|
346 |
> |
// targetTemp, targetPressure, and tauBarostat must be set. |
347 |
> |
// One of qmass or tauThermostat must be set; |
348 |
> |
|
349 |
> |
double targetTemp; |
350 |
> |
double targetPressure; |
351 |
> |
double tauThermostat; |
352 |
> |
double tauBarostat; |
353 |
> |
|
354 |
> |
short int have_tau_thermostat, have_tau_barostat, have_target_temp; |
355 |
> |
short int have_target_pressure; |
356 |
> |
|
357 |
> |
}; |
358 |
> |
|
359 |
> |
|
360 |
> |
template<typename T> class ZConstraint : public T { |
361 |
|
|
362 |
+ |
public: |
363 |
+ |
class ForceSubtractionPolicy{ |
364 |
+ |
public: |
365 |
+ |
ForceSubtractionPolicy(ZConstraint<T>* integrator) {zconsIntegrator = integrator;} |
366 |
+ |
|
367 |
+ |
virtual void update() = 0; |
368 |
+ |
virtual double getZFOfFixedZMols(Molecule* mol, Atom* atom, double totalForce) = 0; |
369 |
+ |
virtual double getZFOfMovingMols(Atom* atom, double totalForce) = 0; |
370 |
+ |
virtual double getHFOfFixedZMols(Molecule* mol, Atom* atom, double totalForce) = 0; |
371 |
+ |
virtual double getHFOfUnconsMols(Atom* atom, double totalForce) = 0; |
372 |
+ |
|
373 |
+ |
protected: |
374 |
+ |
ZConstraint<T>* zconsIntegrator;; |
375 |
+ |
}; |
376 |
+ |
|
377 |
+ |
class PolicyByNumber : public ForceSubtractionPolicy{ |
378 |
+ |
|
379 |
+ |
public: |
380 |
+ |
PolicyByNumber(ZConstraint<T>* integrator) :ForceSubtractionPolicy(integrator) {} |
381 |
+ |
virtual void update(); |
382 |
+ |
virtual double getZFOfFixedZMols(Molecule* mol, Atom* atom, double totalForce) ; |
383 |
+ |
virtual double getZFOfMovingMols(Atom* atom, double totalForce) ; |
384 |
+ |
virtual double getHFOfFixedZMols(Molecule* mol, Atom* atom, double totalForce); |
385 |
+ |
virtual double getHFOfUnconsMols(Atom* atom, double totalForce); |
386 |
+ |
|
387 |
+ |
private: |
388 |
+ |
int totNumOfMovingAtoms; |
389 |
+ |
}; |
390 |
+ |
|
391 |
+ |
class PolicyByMass : public ForceSubtractionPolicy{ |
392 |
+ |
|
393 |
+ |
public: |
394 |
+ |
PolicyByMass(ZConstraint<T>* integrator) :ForceSubtractionPolicy(integrator) {} |
395 |
+ |
|
396 |
+ |
virtual void update(); |
397 |
+ |
virtual double getZFOfFixedZMols(Molecule* mol, Atom* atom, double totalForce) ; |
398 |
+ |
virtual double getZFOfMovingMols(Atom* atom, double totalForce) ; |
399 |
+ |
virtual double getHFOfFixedZMols(Molecule* mol, Atom* atom, double totalForce); |
400 |
+ |
virtual double getHFOfUnconsMols(Atom* atom, double totalForce); |
401 |
+ |
|
402 |
+ |
private: |
403 |
+ |
double totMassOfMovingAtoms; |
404 |
+ |
}; |
405 |
+ |
|
406 |
+ |
public: |
407 |
+ |
|
408 |
+ |
ZConstraint( SimInfo *theInfo, ForceFields* the_ff); |
409 |
+ |
~ZConstraint(); |
410 |
+ |
|
411 |
|
void setZConsTime(double time) {this->zconsTime = time;} |
412 |
|
void getZConsTime() {return zconsTime;} |
413 |
|
|
414 |
< |
void setIndexOfAllZConsMols(vector<int> index) {indexOfAllZConsMols = index;} |
415 |
< |
void getIndexOfAllZConsMols() {return indexOfAllZConsMols;} |
414 |
> |
void setIndexOfAllZConsMols(vector<int> index) {indexOfAllZConsMols = index;} |
415 |
> |
void getIndexOfAllZConsMols() {return indexOfAllZConsMols;} |
416 |
|
|
417 |
< |
void setZConsOutput(const char * fileName) {zconsOutput = fileName;} |
417 |
> |
void setZConsOutput(const char * fileName) {zconsOutput = fileName;} |
418 |
|
string getZConsOutput() {return zconsOutput;} |
419 |
+ |
|
420 |
+ |
virtual void integrate(); |
421 |
+ |
|
422 |
|
|
423 |
|
#ifdef IS_MPI |
424 |
< |
virtual void update(); //which is called to indicate the molecules' migration |
424 |
> |
virtual void update(); //which is called to indicate the molecules' migration |
425 |
|
#endif |
426 |
|
|
427 |
|
protected: |
428 |
|
|
429 |
< |
double zconsTime; |
429 |
> |
enum ZConsState {zcsMoving, zcsFixed}; |
430 |
> |
|
431 |
> |
virtual void calcForce( int calcPot, int calcStress ); |
432 |
> |
virtual void thermalize(void); |
433 |
|
|
434 |
< |
void resetZ(void); |
434 |
> |
void zeroOutVel(); |
435 |
> |
void doZconstraintForce(); |
436 |
> |
void doHarmonic(); |
437 |
> |
bool checkZConsState(); |
438 |
> |
|
439 |
> |
bool haveFixedZMols(); |
440 |
> |
bool haveMovingZMols(); |
441 |
> |
|
442 |
> |
double calcZSys(); |
443 |
> |
|
444 |
> |
int isZConstraintMol(Molecule* mol); |
445 |
> |
|
446 |
> |
|
447 |
> |
double zconsTime; //sample time |
448 |
> |
double zconsTol; //tolerance of z-contratint |
449 |
> |
double zForceConst; //base force constant term |
450 |
> |
//which is estimate by OOPSE |
451 |
|
|
452 |
< |
vector<Molecule*> zconsMols; |
453 |
< |
vector<double> massOfZConsMols; |
452 |
> |
vector<Molecule*> zconsMols; //z-constraint molecules array |
453 |
> |
vector<double> massOfZConsMols; //mass of z-constraint molecule |
454 |
> |
vector<double> kz; //force constant array |
455 |
> |
vector<ZConsState> states; //state of z-constraint molecules |
456 |
> |
vector<double> zPos; // |
457 |
|
|
458 |
< |
vector<Molecule*> unconsMols; |
459 |
< |
vector<double> massOfUnconsMols; |
460 |
< |
double totalMassOfUncons; |
458 |
> |
|
459 |
> |
vector<Molecule*> unconsMols; //unconstraint molecules array |
460 |
> |
vector<double> massOfUnconsMols; //mass array of unconstraint molecules |
461 |
> |
double totalMassOfUncons; //total mas of unconstraint molecules |
462 |
|
|
463 |
< |
vector<double> allRefZ; |
336 |
< |
vector<double> refZ; |
463 |
> |
vector<ZConsParaItem>* parameters; // |
464 |
|
|
465 |
|
vector<int> indexOfAllZConsMols; //index of All Z-Constraint Molecuels |
466 |
< |
int* indexOfZConsMols; //index of local Z-Constraint Molecules |
467 |
< |
|
466 |
> |
|
467 |
> |
int* indexOfZConsMols; //index of local Z-Constraint Molecules |
468 |
|
double* fz; |
469 |
+ |
double* curZPos; |
470 |
|
|
471 |
+ |
int totNumOfUnconsAtoms; //total number of uncontraint atoms |
472 |
+ |
|
473 |
+ |
int whichDirection; //constraint direction |
474 |
+ |
|
475 |
|
private: |
476 |
+ |
|
477 |
+ |
string zconsOutput; //filename of zconstraint output |
478 |
+ |
ZConsWriter* fzOut; //z-constraint writer |
479 |
|
|
480 |
< |
int isZConstraintMol(Molecule* mol); |
481 |
< |
string zconsOutput; |
482 |
< |
ZConsWriter* fzOut; |
480 |
> |
double curZconsTime; |
481 |
> |
|
482 |
> |
double calcMovingMolsCOMVel(); |
483 |
> |
double calcSysCOMVel(); |
484 |
> |
double calcTotalForce(); |
485 |
> |
|
486 |
> |
ForceSubtractionPolicy* forcePolicy; //force subtraction policy |
487 |
> |
friend class ForceSubtractionPolicy; |
488 |
> |
|
489 |
|
}; |
490 |
|
|
491 |
|
#endif |