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 747 by gezelter, Fri Sep 5 21:28:52 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 40 | Line 40 | template<typename T = BaseIntegrator> class Integrator
40    virtual int  readyCheck( void ) { return 1; }
41  
42    virtual void resetIntegrator( void ) { }
43 <
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 95 | 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 113 | Line 117 | template<typename T> class NVT : public T { (public)
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 120 | 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 150 | Line 168 | template<typename T> class NPTi : public T{ (protected
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;
156  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 166 | Line 210 | template<typename T> class NPTi : public T{ (protected
210  
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 195 | Line 284 | template<typename T> class NPTim : public T{ (protecte
284  
285    virtual void resetIntegrator( void );
286  
287 +  void accIntegralOfChidt(void) { integralOfChidt += dt * chi;}
288 +  
289    Molecule* myMolecules;
290    Atom** myAtoms;
291  
# Line 203 | Line 294 | template<typename T> class NPTim : public T{ (protecte
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;
# Line 214 | Line 306 | template<typename T> class NPTim : public T{ (protecte
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;
344 +
345 +  // chi and eta are the propagated degrees of freedom
346 +
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() {};
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  
# Line 243 | Line 392 | template<typename T> class NPTf : public T{ (protected
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 +
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.  
# Line 262 | Line 476 | template<typename T> class NPTfm : public T{
476  
477   };
478  
479 +
480   template<typename T> class NPTfm : public T{
481  
482   public:
# Line 272 | 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  
# Line 288 | Line 508 | template<typename T> class NPTfm : public T{ (public)
508  
509    virtual int readyCheck();
510  
511 +  void accIntegralOfChidt(void) { integralOfChidt += dt * chi;}
512 +
513    Molecule* myMolecules;
514    Atom** myAtoms;
515  
# Line 296 | 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 307 | 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  
# Line 327 | Line 554 | template<typename T> class NPTpr : public T{ (public)
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  
# Line 353 | Line 582 | template<typename T> class NPTpr : public T{ (public)
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  
# Line 385 | 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 : public ForceSubtractionPolicy{

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines