ViewVC Help
View File | Revision Log | Show Annotations | View Changeset | Root Listing
root/group/trunk/OOPSE/libmdtools/Integrator.hpp
(Generate patch)

Comparing trunk/OOPSE/libmdtools/Integrator.hpp (file contents):
Revision 701 by tim, Wed Aug 20 14:34:04 2003 UTC vs.
Revision 778 by mmeineke, Fri Sep 19 20:00:27 2003 UTC

# Line 27 | Line 27 | template<typename T = BaseIntegrator> class Integrator
27    Integrator( SimInfo *theInfo, ForceFields* the_ff );
28    virtual ~Integrator();
29    void integrate( void );
30 +  virtual double  getConservedQuantity(void);
31  
31
32   protected:
33 <  
33 >
34    virtual void integrateStep( int calcPot, int calcStress );
35    virtual void preMove( void );
36    virtual void moveA( void );
# Line 39 | Line 39 | template<typename T = BaseIntegrator> class Integrator
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 +  virtual void rotationPropagation( DirectionalAtom* dAtom, double ji[3] );
48 +
49    void checkConstraints( void );
50    void rotate( int axes1, int axes2, double angle, double j[3],
51           double A[3][3] );
# Line 93 | Line 97 | template<typename T> class NVT : public T { (public)
97   public:
98  
99    NVT ( SimInfo *theInfo, ForceFields* the_ff);
100 <  virtual ~NVT() {}
100 >  virtual ~NVT();
101  
102    void setTauThermostat(double tt) {tauThermostat = tt; have_tau_thermostat=1;}
103    void setTargetTemp(double tt) {targetTemp = tt; have_target_temp = 1;}
104 +  void setChiTolerance(double tol) {chiTolerance = tol;}
105 +  virtual double  getConservedQuantity(void);
106  
107   protected:
108  
# Line 105 | Line 111 | template<typename T> class NVT : public T { (public)
111  
112    virtual int readyCheck();
113  
114 +  virtual void resetIntegrator( void );
115 +
116    // chi is a propagated degree of freedom.
117  
118    double chi;
119  
120 +  //integral of chi(t)dt
121 +  double integralOfChidt;
122 +
123    // targetTemp must be set.  tauThermostat must also be set;
124  
125    double targetTemp;
# Line 116 | Line 127 | template<typename T> class NVT : public T { (public)
127    
128    short int have_tau_thermostat, have_target_temp;
129  
130 +  double *oldVel;
131 +  double *oldJi;
132 +
133 +  double chiTolerance;
134 +  short int have_chi_tolerance;
135 +
136   };
137  
138  
139  
140 < template<typename T> class NPTi : public T{
140 > template<typename T> class NPT : public T{
141  
142   public:
143  
144 <  NPTi ( SimInfo *theInfo, ForceFields* the_ff);
145 <  virtual ~NPTi() {};
146 <
144 >  NPT ( SimInfo *theInfo, ForceFields* the_ff);
145 >  virtual ~NPT();
146 >  
147    virtual void integrateStep( int calcPot, int calcStress ){
148      calcStress = 1;
149      T::integrateStep( calcPot, calcStress );
150    }
151  
152 +  virtual double getConservedQuantity(void) = 0;
153 +
154    void setTauThermostat(double tt) {tauThermostat = tt; have_tau_thermostat=1;}
155    void setTauBarostat(double tb) {tauBarostat = tb; have_tau_barostat=1;}
156    void setTargetTemp(double tt) {targetTemp = tt; have_target_temp = 1;}
157    void setTargetPressure(double tp) {targetPressure = tp; have_target_pressure = 1;}
158 +  void setChiTolerance(double tol) {chiTolerance = tol; have_chi_tolerance = 1;}
159 +  void setPosIterTolerance(double tol) {posIterTolerance = tol; have_pos_iter_tolerance = 1;}
160 +  void setEtaTolerance(double tol) {etaTolerance = tol; have_eta_tolerance = 1;}
161  
162   protected:
163  
# Line 144 | Line 166 | template<typename T> class NPTi : public T{ (protected
166  
167    virtual int readyCheck();
168  
169 +  virtual void resetIntegrator( void );
170 +
171 +  virtual void getVelScaleA( double sc[3], double vel[3] ) = 0;
172 +  virtual void getVelScaleB( double sc[3], int index ) = 0;
173 +  virtual void getPosScale(double pos[3], double COM[3],
174 +                           int index, double sc[3]) = 0;
175 +
176 +  virtual bool chiConverged( void );
177 +  virtual bool etaConverged( void ) = 0;
178 +  
179 +  virtual void evolveChiA( void );
180 +  virtual void evolveEtaA( void ) = 0;
181 +  virtual void evolveChiB( void );
182 +  virtual void evolveEtaB( void ) = 0;
183 +
184 +  virtual void scaleSimBox( void ) = 0;
185 +
186 +  void accIntegralOfChidt(void) { integralOfChidt += dt * chi;}
187 +
188    // chi and eta are the propagated degrees of freedom
189  
190 +  double oldChi;
191 +  double prevChi;
192    double chi;
150  double eta;
193    double NkBT;
194 +  double fkBT;
195  
196 +  double tt2, tb2;
197 +  double instaTemp, instaPress, instaVol;
198 +
199 +  int Nparticles;
200 +
201 +  double integralOfChidt;
202 +
203    // targetTemp, targetPressure, and tauBarostat must be set.  
204    // One of qmass or tauThermostat must be set;
205  
# Line 161 | Line 211 | template<typename T> class NPTi : public T{ (protected
211    short int have_tau_thermostat, have_tau_barostat, have_target_temp;
212    short int have_target_pressure;
213  
214 +  double *oldPos;
215 +  double *oldVel;
216 +  double *oldJi;
217 +
218 +  double chiTolerance;
219 +  short int have_chi_tolerance;
220 +  double posIterTolerance;
221 +  short int have_pos_iter_tolerance;
222 +  double etaTolerance;
223 +  short int have_eta_tolerance;
224 +
225   };
226  
227 + template<typename T> class NPTi : public T{
228 +  
229 + public:
230 +  NPTi( SimInfo *theInfo, ForceFields* the_ff);
231 +  ~NPTi();
232 +
233 +  virtual double getConservedQuantity(void);
234 +  virtual void resetIntegrator(void);
235 +
236 + protected:
237 +
238 +
239 +
240 +  virtual void evolveEtaA(void);
241 +  virtual void evolveEtaB(void);
242 +
243 +  virtual bool etaConverged( void );
244 +
245 +  virtual void scaleSimBox( void );
246 +
247 +  virtual void getVelScaleA( double sc[3], double vel[3] );
248 +  virtual void getVelScaleB( double sc[3], int index );
249 +  virtual void getPosScale(double pos[3], double COM[3],
250 +                           int index, double sc[3]);
251 +
252 +  double eta, oldEta, prevEta;
253 + };
254 +
255 +
256   template<typename T> class NPTim : public T{
257  
258   public:
259  
260    NPTim ( SimInfo *theInfo, ForceFields* the_ff);
261 <  virtual ~NPTim() {};
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;}
277  
278   protected:
279  
# Line 186 | Line 281 | template<typename T> class NPTim : public T{ (protecte
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 +
316 + template<typename T> class NPTzm : public T{
317 +
318 + public:
319 +
320 +  NPTzm ( SimInfo *theInfo, ForceFields* the_ff);
321 +  virtual ~NPTzm() {};
322 +
323 +  virtual void integrateStep( int calcPot, int calcStress ){
324 +    calcStress = 1;
325 +    T::integrateStep( calcPot, calcStress );
326 +  }
327 +
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 +
333 + protected:
334 +
335 +  virtual void moveA( void );
336 +  virtual void moveB( void );
337 +
338 +  virtual int readyCheck();
339 +
340 +  virtual void resetIntegrator( void );
341  
342    Molecule* myMolecules;
343    Atom** myAtoms;
# Line 194 | Line 346 | template<typename T> class NPTim : public T{ (protecte
346  
347    double chi;
348    double eta;
349 +  double etaZ;
350    double NkBT;
351  
352    // targetTemp, targetPressure, and tauBarostat must be set.  
# Line 214 | Line 367 | template<typename T> class NPTf : public T{ (public)
367   public:
368  
369    NPTf ( SimInfo *theInfo, ForceFields* the_ff);
370 <  virtual ~NPTf() {};
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;
399    double eta[3][3];
400    double NkBT;
401 +  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  
# Line 249 | Line 418 | template<typename T> class NPTf : public T{ (public)
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 +
477   };
478  
479 +
480   template<typename T> class NPTfm : public T{
481  
482   public:
# Line 262 | Line 487 | template<typename T> class NPTfm : public T{ (public)
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;
# Line 284 | Line 518 | template<typename T> class NPTfm : public T{ (public)
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;
# Line 295 | Line 530 | template<typename T> class NPTfm : public T{ (public)
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 +
593   template<typename T> class ZConstraint : public T {
594    
595    public:
596 <  class ForceSubstractionPolicy{
596 >  class ForceSubtractionPolicy{
597      public:
598 <      ForceSubstractionPolicy(ZConstraint<T>* integrator) {zconsIntegrator = integrator;}
598 >      ForceSubtractionPolicy(ZConstraint<T>* integrator) {zconsIntegrator = integrator;}
599  
600        virtual void update() = 0;    
601        virtual double getZFOfFixedZMols(Molecule* mol, Atom* atom, double totalForce) = 0;
# Line 315 | Line 607 | template<typename T> class ZConstraint : public T {
607       ZConstraint<T>* zconsIntegrator;;
608    };
609  
610 <  class PolicyByNumber : ForceSubstractionPolicy{
610 >  class PolicyByNumber : public ForceSubtractionPolicy{
611 >
612      public:
613 <      PolicyByNumber(ZConstraint<T>* integrator) :ForceSubstractionPolicy(integrator) {}    
613 >      PolicyByNumber(ZConstraint<T>* integrator) :ForceSubtractionPolicy(integrator) {}    
614        virtual void update();    
615        virtual double getZFOfFixedZMols(Molecule* mol, Atom* atom, double totalForce) ;
616        virtual double getZFOfMovingMols(Atom* atom, double totalForce) ;
# Line 325 | Line 618 | template<typename T> class ZConstraint : public T {
618        virtual double getHFOfUnconsMols(Atom* atom, double totalForce);
619      
620      private:
621 <    int totNumOfMovingAtoms;
621 >      int totNumOfMovingAtoms;
622    };
623  
624 <  class PolicyByMass :ForceSubstractionPolicy{
624 >  class PolicyByMass : public ForceSubtractionPolicy{
625 >
626      public:
627 <      PolicyByMass(ZConstraint<T>* integrator) :ForceSubstractionPolicy(integrator) {}  
627 >      PolicyByMass(ZConstraint<T>* integrator) :ForceSubtractionPolicy(integrator) {}  
628        
629        virtual void update();    
630        virtual double getZFOfFixedZMols(Molecule* mol, Atom* atom, double totalForce) ;
# Line 422 | Line 716 | template<typename T> class ZConstraint : public T {
716    double calcSysCOMVel();
717    double calcTotalForce();
718    
719 <  ForceSubstractionPolicy* forcePolicy; //force substration policy
720 <  friend class ForceSubstractionPolicy;
719 >  ForceSubtractionPolicy* forcePolicy; //force subtraction policy
720 >  friend class ForceSubtractionPolicy;
721  
722   };
723  

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines