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 763 by tim, Mon Sep 15 16:52:02 2003 UTC vs.
Revision 812 by mmeineke, Wed Oct 22 21:17:32 2003 UTC

# Line 30 | Line 30 | template<typename T = BaseIntegrator> class Integrator
30    virtual double  getConservedQuantity(void);
31  
32   protected:
33 <  
33 >
34    virtual void integrateStep( int calcPot, int calcStress );
35    virtual void preMove( void );
36    virtual void moveA( void );
# Line 44 | Line 44 | template<typename T = BaseIntegrator> class Integrator
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 135 | Line 137 | template<typename T> class NPTi : public T{
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();
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 );
148    /* accIntegralOfChidt(); */
150    }
151  
152 <  virtual double getConservedQuantity(void);
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;}
# Line 167 | 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;
175  double eta;
193    double NkBT;
194    double fkBT;
195  
196 +  double tt2, tb2;
197 +  double instaTemp, instaPress, instaVol;
198 +  double press[3][3];
199 +
200    int Nparticles;
201  
202    double integralOfChidt;
# Line 202 | Line 223 | template<typename T> class NPTi : public T{ (protected
223    double etaTolerance;
224    short int have_eta_tolerance;
225  
205  double volume;
206
226   };
227  
228 < template<typename T> class NPTim : public T{
229 <
228 > template<typename T> class NPTi : public T{
229 >  
230   public:
231 +  NPTi( SimInfo *theInfo, ForceFields* the_ff);
232 +  ~NPTi();
233  
213  NPTim ( SimInfo *theInfo, ForceFields* the_ff);
214  virtual ~NPTim() {}
215
216  virtual void integrateStep( int calcPot, int calcStress ){
217    calcStress = 1;
218    T::integrateStep( calcPot, calcStress );
219    accIntegralOfChidt();  
220  }
221
234    virtual double getConservedQuantity(void);
235 <
224 <  void setTauThermostat(double tt) {tauThermostat = tt; have_tau_thermostat=1;}
225 <  void setTauBarostat(double tb) {tauBarostat = tb; have_tau_barostat=1;}
226 <  void setTargetTemp(double tt) {targetTemp = tt; have_target_temp = 1;}
227 <  void setTargetPressure(double tp) {targetPressure = tp; have_target_pressure = 1;}
228 <  void setChiTolerance(double tol) {chiTolerance = tol;}
229 <  void setPosIterTolerance(double tol) {posIterTolerance = tol;}
235 >  virtual void resetIntegrator(void);
236  
237   protected:
238  
239 <  virtual void moveA( void );
234 <  virtual void moveB( void );
239 >
240  
241 <  virtual int readyCheck();
241 >  virtual void evolveEtaA(void);
242 >  virtual void evolveEtaB(void);
243  
244 <  virtual void resetIntegrator( void );
244 >  virtual bool etaConverged( void );
245  
246 <  void accIntegralOfChidt(void) { integralOfChidt += dt * chi;}
241 <  
242 <  Molecule* myMolecules;
243 <  Atom** myAtoms;
246 >  virtual void scaleSimBox( void );
247  
248 <  // chi and eta are the propagated degrees of freedom
248 >  virtual void getVelScaleA( double sc[3], double vel[3] );
249 >  virtual void getVelScaleB( double sc[3], int index );
250 >  virtual void getPosScale(double pos[3], double COM[3],
251 >                           int index, double sc[3]);
252  
253 <  double chi;
248 <  double eta;
249 <  double NkBT;
250 <  double integralOfChidt;
251 <
252 <  // targetTemp, targetPressure, and tauBarostat must be set.  
253 <  // One of qmass or tauThermostat must be set;
254 <
255 <  double targetTemp;
256 <  double targetPressure;
257 <  double tauThermostat;
258 <  double tauBarostat;
259 <
260 <  short int have_tau_thermostat, have_tau_barostat, have_target_temp;
261 <  short int have_target_pressure;
262 <  double chiTolerance;
263 <  short int have_chi_tolerance;
264 <  double posIterTolerance;
265 <  short int have_pos_iter_tolerance;
266 <
253 >  double eta, oldEta, prevEta;
254   };
255  
256 < template<typename T> class NPTzm : public T{
256 > template<typename T> class NPTf : public T{
257  
258   public:
259  
260 <  NPTzm ( SimInfo *theInfo, ForceFields* the_ff);
261 <  virtual ~NPTzm() {};
275 <
276 <  virtual void integrateStep( int calcPot, int calcStress ){
277 <    calcStress = 1;
278 <    T::integrateStep( calcPot, calcStress );
279 <  }
260 >  NPTf ( SimInfo *theInfo, ForceFields* the_ff);
261 >  virtual ~NPTf();
262  
263 <  void setTauThermostat(double tt) {tauThermostat = tt; have_tau_thermostat=1;}
264 <  void setTauBarostat(double tb) {tauBarostat = tb; have_tau_barostat=1;}
283 <  void setTargetTemp(double tt) {targetTemp = tt; have_target_temp = 1;}
284 <  void setTargetPressure(double tp) {targetPressure = tp; have_target_pressure = 1;}
263 >  virtual double getConservedQuantity(void);
264 >  virtual void resetIntegrator(void);
265  
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 <  Molecule* myMolecules;
276 <  Atom** myAtoms;
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 <  // chi and eta are the propagated degrees of freedom
281 <
282 <  double chi;
301 <  double eta;
302 <  double etaZ;
303 <  double NkBT;
304 <
305 <  // targetTemp, targetPressure, and tauBarostat must be set.  
306 <  // One of qmass or tauThermostat must be set;
307 <
308 <  double targetTemp;
309 <  double targetPressure;
310 <  double tauThermostat;
311 <  double tauBarostat;
312 <
313 <  short int have_tau_thermostat, have_tau_barostat, have_target_temp;
314 <  short int have_target_pressure;
315 <
280 >  double eta[3][3];
281 >  double oldEta[3][3];
282 >  double prevEta[3][3];
283   };
284  
285 < template<typename T> class NPTf : public T{
285 > template<typename T> class NPTxyz : public T{
286  
287   public:
288  
289 <  NPTf ( SimInfo *theInfo, ForceFields* the_ff);
290 <  virtual ~NPTf() {};
289 >  NPTxyz ( SimInfo *theInfo, ForceFields* the_ff);
290 >  virtual ~NPTxyz();
291  
325  virtual void integrateStep( int calcPot, int calcStress ){
326    calcStress = 1;
327    T::integrateStep( calcPot, calcStress );
328    accIntegralOfChidt();
329  }
330  
292    virtual double getConservedQuantity(void);
293 +  virtual void resetIntegrator(void);
294  
333  void setTauThermostat(double tt) {tauThermostat = tt; have_tau_thermostat=1;}
334  void setTauBarostat(double tb) {tauBarostat = tb; have_tau_barostat=1;}
335  void setTargetTemp(double tt) {targetTemp = tt; have_target_temp = 1;}
336  void setTargetPressure(double tp) {targetPressure = tp; have_target_pressure = 1;}
337  void setChiTolerance(double tol) {chiTolerance = tol;}
338  void setPosIterTolerance(double tol) {posIterTolerance = tol;}
339
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 void resetIntegrator( void );
300 >  virtual bool etaConverged( void );
301  
302 <  virtual int readyCheck();
302 >  virtual void scaleSimBox( void );
303  
304 <  void accIntegralOfChidt(void) { integralOfChidt += dt * chi;}
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  
351  // chi and eta are the propagated degrees of freedom
352
353  double chi;
309    double eta[3][3];
310 <  double NkBT;
311 <
357 <  double integralOfChidt;
358 <  
359 <  // targetTemp, targetPressure, and tauBarostat must be set.  
360 <  // One of qmass or tauThermostat must be set;
361 <
362 <  double targetTemp;
363 <  double targetPressure;
364 <  double tauThermostat;
365 <  double tauBarostat;
366 <
367 <  short int have_tau_thermostat, have_tau_barostat, have_target_temp;
368 <  short int have_target_pressure;
369 <  double chiTolerance;
370 <  short int have_chi_tolerance;
371 <  double posIterTolerance;
372 <  short int have_pos_iter_tolerance;
373 <
310 >  double oldEta[3][3];
311 >  double prevEta[3][3];
312   };
313  
376 template<typename T> class NPTxym : public T{
314  
378 public:
379
380  NPTxym ( SimInfo *theInfo, ForceFields* the_ff);
381  virtual ~NPTxym() {};
382
383  virtual void integrateStep( int calcPot, int calcStress ){
384    calcStress = 1;
385    T::integrateStep( calcPot, calcStress );
386  }
387
388  void setTauThermostat(double tt) {tauThermostat = tt; have_tau_thermostat=1;}
389  void setTauBarostat(double tb) {tauBarostat = tb; have_tau_barostat=1;}
390  void setTargetTemp(double tt) {targetTemp = tt; have_target_temp = 1;}
391  void setTargetPressure(double tp) {targetPressure = tp; have_target_pressure = 1;}
392
393 protected:
394
395  virtual void moveA( void );
396  virtual void moveB( void );
397
398  virtual int readyCheck();
399
400  virtual void resetIntegrator( void );
401
402  Molecule* myMolecules;
403  Atom** myAtoms;
404
405  // chi and eta are the propagated degrees of freedom
406
407  double chi;
408  double eta;
409  double etaX;
410  double etaY;
411  double NkBT;
412
413  // targetTemp, targetPressure, and tauBarostat must be set.  
414  // One of qmass or tauThermostat must be set;
415
416  double targetTemp;
417  double targetPressure;
418  double tauThermostat;
419  double tauBarostat;
420
421  short int have_tau_thermostat, have_tau_barostat, have_target_temp;
422  short int have_target_pressure;
423
424 };
425
426
427 template<typename T> class NPTfm : public T{
428
429 public:
430
431  NPTfm ( SimInfo *theInfo, ForceFields* the_ff);
432  virtual ~NPTfm() {};
433
434  virtual void integrateStep( int calcPot, int calcStress ){
435    calcStress = 1;
436    T::integrateStep( calcPot, calcStress );
437    accIntegralOfChidt();
438  }
439
440  virtual double getConservedQuantity(void);
441  
442  void setTauThermostat(double tt) {tauThermostat = tt; have_tau_thermostat=1;}
443  void setTauBarostat(double tb) {tauBarostat = tb; have_tau_barostat=1;}
444  void setTargetTemp(double tt) {targetTemp = tt; have_target_temp = 1;}
445  void setTargetPressure(double tp) {targetPressure = tp; have_target_pressure = 1;}
446  void setChiTolerance(double tol) {chiTolerance = tol;}
447  void setPosIterTolerance(double tol) {posIterTolerance = tol;}
448
449 protected:
450
451  virtual void  moveA( void );
452  virtual void moveB( void );
453
454  virtual void resetIntegrator( void );
455
456  virtual int readyCheck();
457
458  void accIntegralOfChidt(void) { integralOfChidt += dt * chi;}
459
460  Molecule* myMolecules;
461  Atom** myAtoms;
462
463  // chi and eta are the propagated degrees of freedom
464
465  double chi;
466  double eta[3][3];
467  double NkBT;
468  double integralOfChidt;
469
470  // targetTemp, targetPressure, and tauBarostat must be set.  
471  // One of qmass or tauThermostat must be set;
472
473  double targetTemp;
474  double targetPressure;
475  double tauThermostat;
476  double tauBarostat;
477
478  short int have_tau_thermostat, have_tau_barostat, have_target_temp;
479  short int have_target_pressure;
480  double chiTolerance;
481  short int have_chi_tolerance;
482  double posIterTolerance;
483  short int have_pos_iter_tolerance;
484
485 };
486
487
488 template<typename T> class NPTpr : public T{
489
490 public:
491
492  NPTpr ( SimInfo *theInfo, ForceFields* the_ff);
493  virtual ~NPTpr() {};
494
495  virtual void integrateStep( int calcPot, int calcStress ){
496    calcStress = 1;
497    T::integrateStep( calcPot, calcStress );
498  }
499
500  void setTauThermostat(double tt) {tauThermostat = tt; have_tau_thermostat=1;}
501  void setTauBarostat(double tb) {tauBarostat = tb; have_tau_barostat=1;}
502  void setTargetTemp(double tt) {targetTemp = tt; have_target_temp = 1;}
503  void setTargetPressure(double tp) {targetPressure = tp; have_target_pressure = 1;}
504  void setChiTolerance(double tol) {chiTolerance = tol;}
505  void setPosIterTolerance(double tol) {posIterTolerance = tol;}
506
507 protected:
508
509  virtual void  moveA( void );
510  virtual void moveB( void );
511
512  virtual int readyCheck();
513
514  virtual void resetIntegrator( void );
515
516  // chi and eta are the propagated degrees of freedom
517
518  double chi;
519  double eta[3][3];
520  double NkBT;
521
522  // targetTemp, targetPressure, and tauBarostat must be set.  
523  // One of qmass or tauThermostat must be set;
524
525  double targetTemp;
526  double targetPressure;
527  double tauThermostat;
528  double tauBarostat;
529
530  short int have_tau_thermostat, have_tau_barostat, have_target_temp;
531  short int have_target_pressure;
532  double chiTolerance;
533  short int have_chi_tolerance;
534  double posIterTolerance;
535  short int have_pos_iter_tolerance;
536
537 };
538
539
315   template<typename T> class ZConstraint : public T {
316    
317    public:
# Line 551 | Line 326 | template<typename T> class ZConstraint : public T {
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{
# Line 604 | Line 379 | template<typename T> class ZConstraint : public T {
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);
# Line 629 | Line 415 | template<typename T> class ZConstraint : public T {
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
641  double totalMassOfUncons;                //total mas of unconstraint molecules
427  
428 +
429    vector<ZConsParaItem>* parameters; //
430    
431    vector<int> indexOfAllZConsMols;     //index of All Z-Constraint Molecuels
# Line 648 | Line 434 | template<typename T> class ZConstraint : public T {
434    double* fz;
435    double* curZPos;
436    
651  int totNumOfUnconsAtoms;              //total number of uncontraint atoms
437  
438 +
439    int whichDirection;                           //constraint direction
440    
441   private:

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines