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 767 by tim, Tue Sep 16 20:02:11 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 204 | Line 225 | template<typename T> class NPTim : public T{
225  
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  
211  NPTim ( SimInfo *theInfo, ForceFields* the_ff);
212  virtual ~NPTim() {}
213
214  virtual void integrateStep( int calcPot, int calcStress ){
215    calcStress = 1;
216    T::integrateStep( calcPot, calcStress );
217    accIntegralOfChidt();  
218  }
219
234    virtual double getConservedQuantity(void);
235 <
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;}
235 >  virtual void resetIntegrator(void);
236  
237   protected:
238  
239 <  virtual void moveA( void );
232 <  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;}
239 <  
240 <  Molecule* myMolecules;
241 <  Atom** myAtoms;
246 >  virtual void scaleSimBox( void );
247  
248 <  // chi and eta are the propagated degrees of freedom
249 <
250 <  double chi;
251 <  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() {};
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 <  virtual void integrateStep( int calcPot, int calcStress ){
275 <    calcStress = 1;
276 <    T::integrateStep( calcPot, calcStress );
277 <  }
278 <
279 <  void setTauThermostat(double tt) {tauThermostat = tt; have_tau_thermostat=1;}
280 <  void setTauBarostat(double tb) {tauBarostat = tb; have_tau_barostat=1;}
281 <  void setTargetTemp(double tt) {targetTemp = tt; have_target_temp = 1;}
282 <  void setTargetPressure(double tp) {targetPressure = tp; have_target_pressure = 1;}
283 <
284 < protected:
285 <
286 <  virtual void moveA( void );
287 <  virtual void moveB( void );
288 <
289 <  virtual int readyCheck();
290 <
291 <  virtual void resetIntegrator( void );
292 <
293 <  Molecule* myMolecules;
294 <  Atom** myAtoms;
295 <
296 <  // chi and eta are the propagated degrees of freedom
297 <
298 <  double chi;
299 <  double eta;
300 <  double etaZ;
301 <  double NkBT;
302 <
303 <  // targetTemp, targetPressure, and tauBarostat must be set.  
304 <  // One of qmass or tauThermostat must be set;
305 <
306 <  double targetTemp;
307 <  double targetPressure;
308 <  double tauThermostat;
309 <  double tauBarostat;
310 <
311 <  short int have_tau_thermostat, have_tau_barostat, have_target_temp;
312 <  short int have_target_pressure;
313 <
253 >  double eta, oldEta, prevEta;
254   };
255  
256   template<typename T> class NPTf : public T{
# Line 320 | Line 260 | template<typename T> class NPTf : public T{ (public)
260    NPTf ( SimInfo *theInfo, ForceFields* the_ff);
261    virtual ~NPTf();
262  
323  virtual void integrateStep( int calcPot, int calcStress ){
324    calcStress = 1;
325    T::integrateStep( calcPot, calcStress );
326  }
327  
263    virtual double getConservedQuantity(void);
264 +  virtual void resetIntegrator(void);
265  
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
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 +  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  
347  // chi and eta are the propagated degrees of freedom
348
349  double chi;
280    double eta[3][3];
281 <  double NkBT;
282 <  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 <
365 <  double targetTemp;
366 <  double targetPressure;
367 <  double tauThermostat;
368 <  double tauBarostat;
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;
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  
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:
434
435  NPTfm ( SimInfo *theInfo, ForceFields* the_ff);
436  virtual ~NPTfm() {};
437
438  virtual void integrateStep( int calcPot, int calcStress ){
439    calcStress = 1;
440    T::integrateStep( calcPot, calcStress );
441    accIntegralOfChidt();
442  }
443
292    virtual double getConservedQuantity(void);
293 <  
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;}
293 >  virtual void resetIntegrator(void);
294  
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  
464  Molecule* myMolecules;
465  Atom** myAtoms;
466
467  // chi and eta are the propagated degrees of freedom
468
469  double chi;
309    double eta[3][3];
310 <  double NkBT;
311 <  double integralOfChidt;
473 <
474 <  // targetTemp, targetPressure, and tauBarostat must be set.  
475 <  // One of qmass or tauThermostat must be set;
476 <
477 <  double targetTemp;
478 <  double targetPressure;
479 <  double tauThermostat;
480 <  double tauBarostat;
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 <
310 >  double oldEta[3][3];
311 >  double prevEta[3][3];
312   };
313  
314  
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
315   template<typename T> class ZConstraint : public T {
316    
317    public:
# Line 555 | 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 608 | 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 633 | 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
645  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 652 | Line 434 | template<typename T> class ZConstraint : public T {
434    double* fz;
435    double* curZPos;
436    
655  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