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 767 by tim, Tue Sep 16 20:02:11 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    
34    virtual void integrateStep( int calcPot, int calcStress );
# 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    
# Line 93 | Line 95 | template<typename T> class NVT : public T { (public)
95   public:
96  
97    NVT ( SimInfo *theInfo, ForceFields* the_ff);
98 <  virtual ~NVT() {}
98 >  virtual ~NVT();
99  
100    void setTauThermostat(double tt) {tauThermostat = tt; have_tau_thermostat=1;}
101    void setTargetTemp(double tt) {targetTemp = tt; have_target_temp = 1;}
102 +  void setChiTolerance(double tol) {chiTolerance = tol;}
103 +  virtual double  getConservedQuantity(void);
104  
105   protected:
106  
# Line 105 | Line 109 | template<typename T> class NVT : public T { (public)
109  
110    virtual int readyCheck();
111  
112 +  virtual void resetIntegrator( void );
113 +
114    // chi is a propagated degree of freedom.
115  
116    double chi;
117  
118 +  //integral of chi(t)dt
119 +  double integralOfChidt;
120 +
121    // targetTemp must be set.  tauThermostat must also be set;
122  
123    double targetTemp;
# Line 116 | Line 125 | template<typename T> class NVT : public T { (public)
125    
126    short int have_tau_thermostat, have_target_temp;
127  
128 +  double *oldVel;
129 +  double *oldJi;
130 +
131 +  double chiTolerance;
132 +  short int have_chi_tolerance;
133 +
134   };
135  
136  
# Line 125 | Line 140 | template<typename T> class NPTi : public T{ (public)
140   public:
141  
142    NPTi ( SimInfo *theInfo, ForceFields* the_ff);
143 <  virtual ~NPTi() {};
144 <
143 >  virtual ~NPTi();
144 >  
145    virtual void integrateStep( int calcPot, int calcStress ){
146      calcStress = 1;
147      T::integrateStep( calcPot, calcStress );
148 +    /* accIntegralOfChidt(); */
149    }
150  
151 +  virtual double getConservedQuantity(void);
152 +
153    void setTauThermostat(double tt) {tauThermostat = tt; have_tau_thermostat=1;}
154    void setTauBarostat(double tb) {tauBarostat = tb; have_tau_barostat=1;}
155    void setTargetTemp(double tt) {targetTemp = tt; have_target_temp = 1;}
156    void setTargetPressure(double tp) {targetPressure = tp; have_target_pressure = 1;}
157 +  void setChiTolerance(double tol) {chiTolerance = tol; have_chi_tolerance = 1;}
158 +  void setPosIterTolerance(double tol) {posIterTolerance = tol; have_pos_iter_tolerance = 1;}
159 +  void setEtaTolerance(double tol) {etaTolerance = tol; have_eta_tolerance = 1;}
160  
161   protected:
162  
# Line 144 | Line 165 | template<typename T> class NPTi : public T{ (public)
165  
166    virtual int readyCheck();
167  
168 +  virtual void resetIntegrator( void );
169 +
170 +  void accIntegralOfChidt(void) { integralOfChidt += dt * chi;}
171 +
172    // chi and eta are the propagated degrees of freedom
173  
174    double chi;
175    double eta;
176    double NkBT;
177 +  double fkBT;
178  
179 +  int Nparticles;
180 +
181 +  double integralOfChidt;
182 +
183    // targetTemp, targetPressure, and tauBarostat must be set.  
184    // One of qmass or tauThermostat must be set;
185  
# Line 161 | Line 191 | template<typename T> class NPTi : public T{ (public)
191    short int have_tau_thermostat, have_tau_barostat, have_target_temp;
192    short int have_target_pressure;
193  
194 +  double *oldPos;
195 +  double *oldVel;
196 +  double *oldJi;
197 +
198 +  double chiTolerance;
199 +  short int have_chi_tolerance;
200 +  double posIterTolerance;
201 +  short int have_pos_iter_tolerance;
202 +  double etaTolerance;
203 +  short int have_eta_tolerance;
204 +
205   };
206  
207   template<typename T> class NPTim : public T{
# Line 168 | Line 209 | template<typename T> class NPTim : public T{ (public)
209   public:
210  
211    NPTim ( SimInfo *theInfo, ForceFields* the_ff);
212 <  virtual ~NPTim() {};
212 >  virtual ~NPTim() {}
213 >
214 >  virtual void integrateStep( int calcPot, int calcStress ){
215 >    calcStress = 1;
216 >    T::integrateStep( calcPot, calcStress );
217 >    accIntegralOfChidt();  
218 >  }
219 >
220 >  virtual double getConservedQuantity(void);
221 >
222 >  void setTauThermostat(double tt) {tauThermostat = tt; have_tau_thermostat=1;}
223 >  void setTauBarostat(double tb) {tauBarostat = tb; have_tau_barostat=1;}
224 >  void setTargetTemp(double tt) {targetTemp = tt; have_target_temp = 1;}
225 >  void setTargetPressure(double tp) {targetPressure = tp; have_target_pressure = 1;}
226 >  void setChiTolerance(double tol) {chiTolerance = tol;}
227 >  void setPosIterTolerance(double tol) {posIterTolerance = tol;}
228 >
229 > protected:
230 >
231 >  virtual void moveA( void );
232 >  virtual void moveB( void );
233  
234 +  virtual int readyCheck();
235 +
236 +  virtual void resetIntegrator( void );
237 +
238 +  void accIntegralOfChidt(void) { integralOfChidt += dt * chi;}
239 +  
240 +  Molecule* myMolecules;
241 +  Atom** myAtoms;
242 +
243 +  // chi and eta are the propagated degrees of freedom
244 +
245 +  double chi;
246 +  double eta;
247 +  double NkBT;
248 +  double integralOfChidt;
249 +
250 +  // targetTemp, targetPressure, and tauBarostat must be set.  
251 +  // One of qmass or tauThermostat must be set;
252 +
253 +  double targetTemp;
254 +  double targetPressure;
255 +  double tauThermostat;
256 +  double tauBarostat;
257 +
258 +  short int have_tau_thermostat, have_tau_barostat, have_target_temp;
259 +  short int have_target_pressure;
260 +  double chiTolerance;
261 +  short int have_chi_tolerance;
262 +  double posIterTolerance;
263 +  short int have_pos_iter_tolerance;
264 +
265 + };
266 +
267 + template<typename T> class NPTzm : public T{
268 +
269 + public:
270 +
271 +  NPTzm ( SimInfo *theInfo, ForceFields* the_ff);
272 +  virtual ~NPTzm() {};
273 +
274    virtual void integrateStep( int calcPot, int calcStress ){
275      calcStress = 1;
276      T::integrateStep( calcPot, calcStress );
# Line 187 | Line 288 | template<typename T> class NPTim : public T{ (public)
288  
289    virtual int readyCheck();
290  
291 +  virtual void resetIntegrator( void );
292 +
293    Molecule* myMolecules;
294    Atom** myAtoms;
295  
# Line 194 | Line 297 | template<typename T> class NPTim : public T{ (public)
297  
298    double chi;
299    double eta;
300 +  double etaZ;
301    double NkBT;
302  
303    // targetTemp, targetPressure, and tauBarostat must be set.  
# Line 214 | Line 318 | template<typename T> class NPTf : public T{ (public)
318   public:
319  
320    NPTf ( SimInfo *theInfo, ForceFields* the_ff);
321 <  virtual ~NPTf() {};
321 >  virtual ~NPTf();
322  
323    virtual void integrateStep( int calcPot, int calcStress ){
324      calcStress = 1;
325      T::integrateStep( calcPot, calcStress );
326    }
327 +  
328 +  virtual double getConservedQuantity(void);
329  
330    void setTauThermostat(double tt) {tauThermostat = tt; have_tau_thermostat=1;}
331    void setTauBarostat(double tb) {tauBarostat = tb; have_tau_barostat=1;}
332    void setTargetTemp(double tt) {targetTemp = tt; have_target_temp = 1;}
333    void setTargetPressure(double tp) {targetPressure = tp; have_target_pressure = 1;}
334 +  void setChiTolerance(double tol) {chiTolerance = tol;}
335 +  void setPosIterTolerance(double tol) {posIterTolerance = tol;}
336  
337   protected:
338  
339    virtual void  moveA( void );
340    virtual void moveB( void );
341  
342 +  virtual void resetIntegrator( void );
343 +
344    virtual int readyCheck();
345  
346 +
347    // chi and eta are the propagated degrees of freedom
348  
349    double chi;
350    double eta[3][3];
351    double NkBT;
352 +  double fkBT;
353  
354 +  int Nparticles;
355 +
356 +  double *oldPos;
357 +  double *oldVel;
358 +  double *oldJi;
359 +
360 +  double integralOfChidt;
361 +  
362    // targetTemp, targetPressure, and tauBarostat must be set.  
363    // One of qmass or tauThermostat must be set;
364  
# Line 249 | Line 369 | template<typename T> class NPTf : public T{ (public)
369  
370    short int have_tau_thermostat, have_tau_barostat, have_target_temp;
371    short int have_target_pressure;
372 +  double chiTolerance;
373 +  short int have_chi_tolerance;
374 +  double posIterTolerance;
375 +  short int have_pos_iter_tolerance;
376 +  double etaTolerance;
377 +  short int have_eta_tolerance;
378 + };
379  
380 + template<typename T> class NPTxym : public T{
381 +
382 + public:
383 +
384 +  NPTxym ( SimInfo *theInfo, ForceFields* the_ff);
385 +  virtual ~NPTxym() {};
386 +
387 +  virtual void integrateStep( int calcPot, int calcStress ){
388 +    calcStress = 1;
389 +    T::integrateStep( calcPot, calcStress );
390 +  }
391 +
392 +  void setTauThermostat(double tt) {tauThermostat = tt; have_tau_thermostat=1;}
393 +  void setTauBarostat(double tb) {tauBarostat = tb; have_tau_barostat=1;}
394 +  void setTargetTemp(double tt) {targetTemp = tt; have_target_temp = 1;}
395 +  void setTargetPressure(double tp) {targetPressure = tp; have_target_pressure = 1;}
396 +
397 + protected:
398 +
399 +  virtual void moveA( void );
400 +  virtual void moveB( void );
401 +
402 +  virtual int readyCheck();
403 +
404 +  virtual void resetIntegrator( void );
405 +
406 +  Molecule* myMolecules;
407 +  Atom** myAtoms;
408 +
409 +  // chi and eta are the propagated degrees of freedom
410 +
411 +  double chi;
412 +  double eta;
413 +  double etaX;
414 +  double etaY;
415 +  double NkBT;
416 +
417 +  // targetTemp, targetPressure, and tauBarostat must be set.  
418 +  // One of qmass or tauThermostat must be set;
419 +
420 +  double targetTemp;
421 +  double targetPressure;
422 +  double tauThermostat;
423 +  double tauBarostat;
424 +
425 +  short int have_tau_thermostat, have_tau_barostat, have_target_temp;
426 +  short int have_target_pressure;
427 +
428   };
429  
430 +
431   template<typename T> class NPTfm : public T{
432  
433   public:
# Line 262 | Line 438 | template<typename T> class NPTfm : public T{ (public)
438    virtual void integrateStep( int calcPot, int calcStress ){
439      calcStress = 1;
440      T::integrateStep( calcPot, calcStress );
441 +    accIntegralOfChidt();
442    }
443  
444 +  virtual double getConservedQuantity(void);
445 +  
446    void setTauThermostat(double tt) {tauThermostat = tt; have_tau_thermostat=1;}
447    void setTauBarostat(double tb) {tauBarostat = tb; have_tau_barostat=1;}
448    void setTargetTemp(double tt) {targetTemp = tt; have_target_temp = 1;}
449    void setTargetPressure(double tp) {targetPressure = tp; have_target_pressure = 1;}
450 +  void setChiTolerance(double tol) {chiTolerance = tol;}
451 +  void setPosIterTolerance(double tol) {posIterTolerance = tol;}
452  
453   protected:
454  
455    virtual void  moveA( void );
456    virtual void moveB( void );
457  
458 +  virtual void resetIntegrator( void );
459 +
460    virtual int readyCheck();
461  
462 +  void accIntegralOfChidt(void) { integralOfChidt += dt * chi;}
463 +
464    Molecule* myMolecules;
465    Atom** myAtoms;
466  
# Line 284 | Line 469 | template<typename T> class NPTfm : public T{ (public)
469    double chi;
470    double eta[3][3];
471    double NkBT;
472 +  double integralOfChidt;
473  
474    // targetTemp, targetPressure, and tauBarostat must be set.  
475    // One of qmass or tauThermostat must be set;
# Line 295 | Line 481 | template<typename T> class NPTfm : public T{ (public)
481  
482    short int have_tau_thermostat, have_tau_barostat, have_target_temp;
483    short int have_target_pressure;
484 +  double chiTolerance;
485 +  short int have_chi_tolerance;
486 +  double posIterTolerance;
487 +  short int have_pos_iter_tolerance;
488  
489   };
490  
491 +
492 + template<typename T> class NPTpr : public T{
493 +
494 + public:
495 +
496 +  NPTpr ( SimInfo *theInfo, ForceFields* the_ff);
497 +  virtual ~NPTpr() {};
498 +
499 +  virtual void integrateStep( int calcPot, int calcStress ){
500 +    calcStress = 1;
501 +    T::integrateStep( calcPot, calcStress );
502 +  }
503 +
504 +  void setTauThermostat(double tt) {tauThermostat = tt; have_tau_thermostat=1;}
505 +  void setTauBarostat(double tb) {tauBarostat = tb; have_tau_barostat=1;}
506 +  void setTargetTemp(double tt) {targetTemp = tt; have_target_temp = 1;}
507 +  void setTargetPressure(double tp) {targetPressure = tp; have_target_pressure = 1;}
508 +  void setChiTolerance(double tol) {chiTolerance = tol;}
509 +  void setPosIterTolerance(double tol) {posIterTolerance = tol;}
510 +
511 + protected:
512 +
513 +  virtual void  moveA( void );
514 +  virtual void moveB( void );
515 +
516 +  virtual int readyCheck();
517 +
518 +  virtual void resetIntegrator( void );
519 +
520 +  // chi and eta are the propagated degrees of freedom
521 +
522 +  double chi;
523 +  double eta[3][3];
524 +  double NkBT;
525 +
526 +  // targetTemp, targetPressure, and tauBarostat must be set.  
527 +  // One of qmass or tauThermostat must be set;
528 +
529 +  double targetTemp;
530 +  double targetPressure;
531 +  double tauThermostat;
532 +  double tauBarostat;
533 +
534 +  short int have_tau_thermostat, have_tau_barostat, have_target_temp;
535 +  short int have_target_pressure;
536 +  double chiTolerance;
537 +  short int have_chi_tolerance;
538 +  double posIterTolerance;
539 +  short int have_pos_iter_tolerance;
540 +
541 + };
542 +
543 +
544   template<typename T> class ZConstraint : public T {
545    
546    public:
547 <  class ForceSubstractionPolicy{
547 >  class ForceSubtractionPolicy{
548      public:
549 <      ForceSubstractionPolicy(ZConstraint<T>* integrator) {zconsIntegrator = integrator;}
549 >      ForceSubtractionPolicy(ZConstraint<T>* integrator) {zconsIntegrator = integrator;}
550  
551        virtual void update() = 0;    
552        virtual double getZFOfFixedZMols(Molecule* mol, Atom* atom, double totalForce) = 0;
# Line 315 | Line 558 | template<typename T> class ZConstraint : public T {
558       ZConstraint<T>* zconsIntegrator;;
559    };
560  
561 <  class PolicyByNumber : ForceSubstractionPolicy{
561 >  class PolicyByNumber : public ForceSubtractionPolicy{
562 >
563      public:
564 <      PolicyByNumber(ZConstraint<T>* integrator) :ForceSubstractionPolicy(integrator) {}    
564 >      PolicyByNumber(ZConstraint<T>* integrator) :ForceSubtractionPolicy(integrator) {}    
565        virtual void update();    
566        virtual double getZFOfFixedZMols(Molecule* mol, Atom* atom, double totalForce) ;
567        virtual double getZFOfMovingMols(Atom* atom, double totalForce) ;
# Line 325 | Line 569 | template<typename T> class ZConstraint : public T {
569        virtual double getHFOfUnconsMols(Atom* atom, double totalForce);
570      
571      private:
572 <    int totNumOfMovingAtoms;
572 >      int totNumOfMovingAtoms;
573    };
574  
575 <  class PolicyByMass :ForceSubstractionPolicy{
575 >  class PolicyByMass : public ForceSubtractionPolicy{
576 >
577      public:
578 <      PolicyByMass(ZConstraint<T>* integrator) :ForceSubstractionPolicy(integrator) {}  
578 >      PolicyByMass(ZConstraint<T>* integrator) :ForceSubtractionPolicy(integrator) {}  
579        
580        virtual void update();    
581        virtual double getZFOfFixedZMols(Molecule* mol, Atom* atom, double totalForce) ;
# Line 422 | Line 667 | template<typename T> class ZConstraint : public T {
667    double calcSysCOMVel();
668    double calcTotalForce();
669    
670 <  ForceSubstractionPolicy* forcePolicy; //force substration policy
671 <  friend class ForceSubstractionPolicy;
670 >  ForceSubtractionPolicy* forcePolicy; //force subtraction policy
671 >  friend class ForceSubtractionPolicy;
672  
673   };
674  

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines