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 755 by mmeineke, Tue Sep 9 20:35:25 2003 UTC vs.
Revision 812 by mmeineke, Wed Oct 22 21:17:32 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 +  double press[3][3];
199 +
200 +  int Nparticles;
201 +
202 +  double integralOfChidt;
203 +
204    // targetTemp, targetPressure, and tauBarostat must be set.  
205    // One of qmass or tauThermostat must be set;
206  
# Line 167 | Line 212 | template<typename T> class NPTi : public T{ (protected
212    short int have_tau_thermostat, have_tau_barostat, have_target_temp;
213    short int have_target_pressure;
214  
215 < };
215 >  double *oldPos;
216 >  double *oldVel;
217 >  double *oldJi;
218  
219 < template<typename T> class NPTim : public T{
219 >  double chiTolerance;
220 >  short int have_chi_tolerance;
221 >  double posIterTolerance;
222 >  short int have_pos_iter_tolerance;
223 >  double etaTolerance;
224 >  short int have_eta_tolerance;
225  
226 + };
227 +
228 + template<typename T> class NPTi : public T{
229 +  
230   public:
231 +  NPTi( SimInfo *theInfo, ForceFields* the_ff);
232 +  ~NPTi();
233  
234 <  NPTim ( SimInfo *theInfo, ForceFields* the_ff);
235 <  virtual ~NPTim() {};
234 >  virtual double getConservedQuantity(void);
235 >  virtual void resetIntegrator(void);
236  
179  virtual void integrateStep( int calcPot, int calcStress ){
180    calcStress = 1;
181    T::integrateStep( calcPot, calcStress );
182  }
183
184  void setTauThermostat(double tt) {tauThermostat = tt; have_tau_thermostat=1;}
185  void setTauBarostat(double tb) {tauBarostat = tb; have_tau_barostat=1;}
186  void setTargetTemp(double tt) {targetTemp = tt; have_target_temp = 1;}
187  void setTargetPressure(double tp) {targetPressure = tp; have_target_pressure = 1;}
188
237   protected:
238  
239 <  virtual void moveA( void );
192 <  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 <  Molecule* myMolecules;
199 <  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;
204 <  double eta;
205 <  double NkBT;
206 <
207 <  // targetTemp, targetPressure, and tauBarostat must be set.  
208 <  // One of qmass or tauThermostat must be set;
209 <
210 <  double targetTemp;
211 <  double targetPressure;
212 <  double tauThermostat;
213 <  double tauBarostat;
214 <
215 <  short int have_tau_thermostat, have_tau_barostat, have_target_temp;
216 <  short int have_target_pressure;
217 <
253 >  double eta, oldEta, prevEta;
254   };
255  
220 template<typename T> class NPTzm : public T{
221
222 public:
223
224  NPTzm ( SimInfo *theInfo, ForceFields* the_ff);
225  virtual ~NPTzm() {};
226
227  virtual void integrateStep( int calcPot, int calcStress ){
228    calcStress = 1;
229    T::integrateStep( calcPot, calcStress );
230  }
231
232  void setTauThermostat(double tt) {tauThermostat = tt; have_tau_thermostat=1;}
233  void setTauBarostat(double tb) {tauBarostat = tb; have_tau_barostat=1;}
234  void setTargetTemp(double tt) {targetTemp = tt; have_target_temp = 1;}
235  void setTargetPressure(double tp) {targetPressure = tp; have_target_pressure = 1;}
236
237 protected:
238
239  virtual void moveA( void );
240  virtual void moveB( void );
241
242  virtual int readyCheck();
243
244  virtual void resetIntegrator( void );
245
246  Molecule* myMolecules;
247  Atom** myAtoms;
248
249  // chi and eta are the propagated degrees of freedom
250
251  double chi;
252  double eta;
253  double etaZ;
254  double NkBT;
255
256  // targetTemp, targetPressure, and tauBarostat must be set.  
257  // One of qmass or tauThermostat must be set;
258
259  double targetTemp;
260  double targetPressure;
261  double tauThermostat;
262  double tauBarostat;
263
264  short int have_tau_thermostat, have_tau_barostat, have_target_temp;
265  short int have_target_pressure;
266
267 };
268
256   template<typename T> class NPTf : public T{
257  
258   public:
259  
260    NPTf ( SimInfo *theInfo, ForceFields* the_ff);
261 <  virtual ~NPTf() {};
261 >  virtual ~NPTf();
262  
263 <  virtual void integrateStep( int calcPot, int calcStress ){
264 <    calcStress = 1;
278 <    T::integrateStep( calcPot, calcStress );
279 <  }
263 >  virtual double getConservedQuantity(void);
264 >  virtual void resetIntegrator(void);
265  
281  void setTauThermostat(double tt) {tauThermostat = tt; have_tau_thermostat=1;}
282  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;}
285
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 void resetIntegrator( void );
271 >  virtual bool etaConverged( void );
272  
273 <  virtual int readyCheck();
273 >  virtual void scaleSimBox( void );
274  
275 <  // chi and eta are the propagated degrees of freedom
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  
297  double chi;
280    double eta[3][3];
281 <  double NkBT;
282 <
301 <  // targetTemp, targetPressure, and tauBarostat must be set.  
302 <  // One of qmass or tauThermostat must be set;
303 <
304 <  double targetTemp;
305 <  double targetPressure;
306 <  double tauThermostat;
307 <  double tauBarostat;
308 <
309 <  short int have_tau_thermostat, have_tau_barostat, have_target_temp;
310 <  short int have_target_pressure;
311 <
281 >  double oldEta[3][3];
282 >  double prevEta[3][3];
283   };
284  
285 < template<typename T> class NPTxym : public T{
285 > template<typename T> class NPTxyz : public T{
286  
287   public:
288  
289 <  NPTxym ( SimInfo *theInfo, ForceFields* the_ff);
290 <  virtual ~NPTxym() {};
289 >  NPTxyz ( SimInfo *theInfo, ForceFields* the_ff);
290 >  virtual ~NPTxyz();
291  
292 <  virtual void integrateStep( int calcPot, int calcStress ){
293 <    calcStress = 1;
323 <    T::integrateStep( calcPot, calcStress );
324 <  }
292 >  virtual double getConservedQuantity(void);
293 >  virtual void resetIntegrator(void);
294  
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
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 int readyCheck();
300 >  virtual bool etaConverged( void );
301  
302 <  virtual void resetIntegrator( void );
302 >  virtual void scaleSimBox( void );
303  
304 <  Molecule* myMolecules;
305 <  Atom** myAtoms;
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  
343  // chi and eta are the propagated degrees of freedom
344
345  double chi;
346  double eta;
347  double etaX;
348  double etaY;
349  double NkBT;
350
351  // targetTemp, targetPressure, and tauBarostat must be set.  
352  // One of qmass or tauThermostat must be set;
353
354  double targetTemp;
355  double targetPressure;
356  double tauThermostat;
357  double tauBarostat;
358
359  short int have_tau_thermostat, have_tau_barostat, have_target_temp;
360  short int have_target_pressure;
361
362 };
363
364
365 template<typename T> class NPTfm : public T{
366
367 public:
368
369  NPTfm ( SimInfo *theInfo, ForceFields* the_ff);
370  virtual ~NPTfm() {};
371
372  virtual void integrateStep( int calcPot, int calcStress ){
373    calcStress = 1;
374    T::integrateStep( calcPot, calcStress );
375  }
376
377  void setTauThermostat(double tt) {tauThermostat = tt; have_tau_thermostat=1;}
378  void setTauBarostat(double tb) {tauBarostat = tb; have_tau_barostat=1;}
379  void setTargetTemp(double tt) {targetTemp = tt; have_target_temp = 1;}
380  void setTargetPressure(double tp) {targetPressure = tp; have_target_pressure = 1;}
381
382 protected:
383
384  virtual void  moveA( void );
385  virtual void moveB( void );
386
387  virtual void resetIntegrator( void );
388
389  virtual int readyCheck();
390
391  Molecule* myMolecules;
392  Atom** myAtoms;
393
394  // chi and eta are the propagated degrees of freedom
395
396  double chi;
309    double eta[3][3];
310 <  double NkBT;
311 <
400 <  // targetTemp, targetPressure, and tauBarostat must be set.  
401 <  // One of qmass or tauThermostat must be set;
402 <
403 <  double targetTemp;
404 <  double targetPressure;
405 <  double tauThermostat;
406 <  double tauBarostat;
407 <
408 <  short int have_tau_thermostat, have_tau_barostat, have_target_temp;
409 <  short int have_target_pressure;
410 <
310 >  double oldEta[3][3];
311 >  double prevEta[3][3];
312   };
313  
314  
414 template<typename T> class NPTpr : public T{
415
416 public:
417
418  NPTpr ( SimInfo *theInfo, ForceFields* the_ff);
419  virtual ~NPTpr() {};
420
421  virtual void integrateStep( int calcPot, int calcStress ){
422    calcStress = 1;
423    T::integrateStep( calcPot, calcStress );
424  }
425
426  void setTauThermostat(double tt) {tauThermostat = tt; have_tau_thermostat=1;}
427  void setTauBarostat(double tb) {tauBarostat = tb; have_tau_barostat=1;}
428  void setTargetTemp(double tt) {targetTemp = tt; have_target_temp = 1;}
429  void setTargetPressure(double tp) {targetPressure = tp; have_target_pressure = 1;}
430
431 protected:
432
433  virtual void  moveA( void );
434  virtual void moveB( void );
435
436  virtual int readyCheck();
437
438  virtual void resetIntegrator( void );
439
440  // chi and eta are the propagated degrees of freedom
441
442  double chi;
443  double eta[3][3];
444  double NkBT;
445
446  // targetTemp, targetPressure, and tauBarostat must be set.  
447  // One of qmass or tauThermostat must be set;
448
449  double targetTemp;
450  double targetPressure;
451  double tauThermostat;
452  double tauBarostat;
453
454  short int have_tau_thermostat, have_tau_barostat, have_target_temp;
455  short int have_target_pressure;
456
457 };
458
459
315   template<typename T> class ZConstraint : public T {
316    
317    public:
# Line 471 | 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 485 | Line 340 | template<typename T> class ZConstraint : public T {
340        virtual double getHFOfUnconsMols(Atom* atom, double totalForce);
341      
342      private:
343 <    int totNumOfMovingAtoms;
343 >      int totNumOfMovingAtoms;
344    };
345  
346    class PolicyByMass : public ForceSubtractionPolicy{
# Line 524 | 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 549 | 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
561  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 568 | Line 434 | template<typename T> class ZConstraint : public T {
434    double* fz;
435    double* curZPos;
436    
571  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