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 812 by mmeineke, Wed Oct 22 21:17:32 2003 UTC vs.
Revision 837 by tim, Wed Oct 29 00:19:10 2003 UTC

# Line 28 | Line 28 | template<typename T = BaseIntegrator> class Integrator
28    virtual ~Integrator();
29    void integrate( void );
30    virtual double  getConservedQuantity(void);
31 +  virtual string getAdditionalParameters(void);
32  
33   protected:
34  
# Line 40 | Line 41 | template<typename T = BaseIntegrator> class Integrator
41    virtual int  readyCheck( void ) { return 1; }
42  
43    virtual void resetIntegrator( void ) { }
44 <
45 <  virtual void calcForce( int calcPot, int calcStress );  
44 >
45 >  virtual void calcForce( int calcPot, int calcStress );
46    virtual void thermalize();
47 <  
47 >
48    virtual void rotationPropagation( DirectionalAtom* dAtom, double ji[3] );
49  
50    void checkConstraints( void );
51 <  void rotate( int axes1, int axes2, double angle, double j[3],
51 >  void rotate( int axes1, int axes2, double angle, double j[3],
52           double A[3][3] );
53 <        
53 >
54    ForceFields* myFF;
55  
56    SimInfo *info; // all the info we'll ever need
# Line 61 | Line 62 | template<typename T = BaseIntegrator> class Integrator
62  
63    int isConstrained; // boolean to know whether the systems contains
64           // constraints.
65 <  int nConstrained;  // counter for number of constraints
66 <  int *constrainedA; // the i of a constraint pair
67 <  int *constrainedB; // the j of a constraint pair
68 <  double *constrainedDsqr; // the square of the constraint distance
69 <  
65 >  int nConstrained;  // counter for number of constraints
66 >  int *constrainedA; // the i of a constraint pair
67 >  int *constrainedB; // the j of a constraint pair
68 >  double *constrainedDsqr; // the square of the constraint distance
69 >
70    int* moving; // tells whether we are moving atom i
71    int* moved;  // tells whether we have moved atom i
72 <  double* oldPos; // pre constrained positions
72 >  double* oldPos; // pre constrained positions
73  
74    short isFirst; /*boolean for the first time integrate is called */
75 <  
75 >
76    double dt;
77    double dt2;
78  
79    Thermo *tStats;
80    StatWriter*  statOut;
81    DumpWriter*  dumpOut;
82 <  
82 >
83   };
84  
85   typedef Integrator<BaseIntegrator> RealIntegrator;
# Line 88 | Line 89 | template<typename T> class NVE : public T { (public)
89   public:
90    NVE ( SimInfo *theInfo, ForceFields* the_ff ):
91      T( theInfo, the_ff ){}
92 <  virtual ~NVE(){}  
92 >  virtual ~NVE(){}
93   };
94  
95  
# Line 103 | Line 104 | template<typename T> class NVT : public T { (public)
104    void setTargetTemp(double tt) {targetTemp = tt; have_target_temp = 1;}
105    void setChiTolerance(double tol) {chiTolerance = tol;}
106    virtual double  getConservedQuantity(void);
107 +  virtual string getAdditionalParameters(void);
108  
109   protected:
110  
# Line 124 | Line 126 | template<typename T> class NVT : public T { (public)
126  
127    double targetTemp;
128    double tauThermostat;
129 <  
129 >
130    short int have_tau_thermostat, have_target_temp;
131  
132    double *oldVel;
# Line 143 | Line 145 | template<typename T> class NPT : public T{ (public)
145  
146    NPT ( SimInfo *theInfo, ForceFields* the_ff);
147    virtual ~NPT();
148 <  
148 >
149    virtual void integrateStep( int calcPot, int calcStress ){
150      calcStress = 1;
151      T::integrateStep( calcPot, calcStress );
152    }
153  
154    virtual double getConservedQuantity(void) = 0;
155 <
155 >  virtual string getAdditionalParameters(void) = 0;
156    void setTauThermostat(double tt) {tauThermostat = tt; have_tau_thermostat=1;}
157    void setTauBarostat(double tb) {tauBarostat = tb; have_tau_barostat=1;}
158    void setTargetTemp(double tt) {targetTemp = tt; have_target_temp = 1;}
# Line 170 | Line 172 | template<typename T> class NPT : public T{ (public)
172  
173    virtual void getVelScaleA( double sc[3], double vel[3] ) = 0;
174    virtual void getVelScaleB( double sc[3], int index ) = 0;
175 <  virtual void getPosScale(double pos[3], double COM[3],
175 >  virtual void getPosScale(double pos[3], double COM[3],
176                             int index, double sc[3]) = 0;
177  
178    virtual bool chiConverged( void );
179    virtual bool etaConverged( void ) = 0;
180 <  
180 >
181    virtual void evolveChiA( void );
182    virtual void evolveEtaA( void ) = 0;
183    virtual void evolveChiB( void );
# Line 201 | Line 203 | template<typename T> class NPT : public T{ (public)
203  
204    double integralOfChidt;
205  
206 <  // targetTemp, targetPressure, and tauBarostat must be set.  
206 >  // targetTemp, targetPressure, and tauBarostat must be set.
207    // One of qmass or tauThermostat must be set;
208  
209    double targetTemp;
# Line 226 | Line 228 | template<typename T> class NPTi : public T{
228   };
229  
230   template<typename T> class NPTi : public T{
231 <  
231 >
232   public:
233    NPTi( SimInfo *theInfo, ForceFields* the_ff);
234    ~NPTi();
235  
236    virtual double getConservedQuantity(void);
237    virtual void resetIntegrator(void);
238 <
238 >  virtual string getAdditionalParameters(void);
239   protected:
240  
239
241  
242 +
243    virtual void evolveEtaA(void);
244    virtual void evolveEtaB(void);
245  
# Line 247 | Line 249 | template<typename T> class NPTi : public T{
249  
250    virtual void getVelScaleA( double sc[3], double vel[3] );
251    virtual void getVelScaleB( double sc[3], int index );
252 <  virtual void getPosScale(double pos[3], double COM[3],
252 >  virtual void getPosScale(double pos[3], double COM[3],
253                             int index, double sc[3]);
254  
255    double eta, oldEta, prevEta;
# Line 261 | Line 263 | template<typename T> class NPTf : public T{ (public)
263    virtual ~NPTf();
264  
265    virtual double getConservedQuantity(void);
266 +  virtual string getAdditionalParameters(void);
267    virtual void resetIntegrator(void);
268  
269   protected:
# Line 274 | Line 277 | template<typename T> class NPTf : public T{ (public)
277  
278    virtual void getVelScaleA( double sc[3], double vel[3] );
279    virtual void getVelScaleB( double sc[3], int index );
280 <  virtual void getPosScale(double pos[3], double COM[3],
280 >  virtual void getPosScale(double pos[3], double COM[3],
281                             int index, double sc[3]);
282  
283    double eta[3][3];
# Line 290 | Line 293 | template<typename T> class NPTxyz : public T{ (public)
293    virtual ~NPTxyz();
294  
295    virtual double getConservedQuantity(void);
296 +  virtual string getAdditionalParameters(void);
297    virtual void resetIntegrator(void);
298  
299   protected:
# Line 303 | Line 307 | template<typename T> class NPTxyz : public T{ (public)
307  
308    virtual void getVelScaleA( double sc[3], double vel[3] );
309    virtual void getVelScaleB( double sc[3], int index );
310 <  virtual void getPosScale(double pos[3], double COM[3],
310 >  virtual void getPosScale(double pos[3], double COM[3],
311                             int index, double sc[3]);
312  
313    double eta[3][3];
# Line 313 | Line 317 | template<typename T> class ZConstraint : public T {
317  
318  
319   template<typename T> class ZConstraint : public T {
320 <  
321 <  public:
320 >
321 >  public:
322    class ForceSubtractionPolicy{
323      public:
324        ForceSubtractionPolicy(ZConstraint<T>* integrator) {zconsIntegrator = integrator;}
325  
326 <      virtual void update() = 0;    
326 >      virtual void update() = 0;
327        virtual double getZFOfFixedZMols(Molecule* mol, Atom* atom, double totalForce) = 0;
328        virtual double getZFOfMovingMols(Atom* atom, double totalForce) = 0;
329        virtual double getHFOfFixedZMols(Molecule* mol, Atom* atom, double totalForce) = 0;
330        virtual double getHFOfUnconsMols(Atom* atom, double totalForce) = 0;
331 <    
331 >
332     protected:
333       ZConstraint<T>* zconsIntegrator;
334    };
# Line 332 | Line 336 | template<typename T> class ZConstraint : public T {
336    class PolicyByNumber : public ForceSubtractionPolicy{
337  
338      public:
339 <      PolicyByNumber(ZConstraint<T>* integrator) :ForceSubtractionPolicy(integrator) {}    
340 <      virtual void update();    
339 >      PolicyByNumber(ZConstraint<T>* integrator) :ForceSubtractionPolicy(integrator) {}
340 >      virtual void update();
341        virtual double getZFOfFixedZMols(Molecule* mol, Atom* atom, double totalForce) ;
342        virtual double getZFOfMovingMols(Atom* atom, double totalForce) ;
343        virtual double getHFOfFixedZMols(Molecule* mol, Atom* atom, double totalForce);
344        virtual double getHFOfUnconsMols(Atom* atom, double totalForce);
345 <    
345 >
346      private:
347        int totNumOfMovingAtoms;
348    };
# Line 346 | Line 350 | template<typename T> class ZConstraint : public T {
350    class PolicyByMass : public ForceSubtractionPolicy{
351  
352      public:
353 <      PolicyByMass(ZConstraint<T>* integrator) :ForceSubtractionPolicy(integrator) {}  
354 <      
355 <      virtual void update();    
353 >      PolicyByMass(ZConstraint<T>* integrator) :ForceSubtractionPolicy(integrator) {}
354 >
355 >      virtual void update();
356        virtual double getZFOfFixedZMols(Molecule* mol, Atom* atom, double totalForce) ;
357        virtual double getZFOfMovingMols(Atom* atom, double totalForce) ;
358        virtual double getHFOfFixedZMols(Molecule* mol, Atom* atom, double totalForce);
# Line 362 | Line 366 | template<typename T> class ZConstraint : public T {
366  
367    ZConstraint( SimInfo *theInfo, ForceFields* the_ff);
368    ~ZConstraint();
369 <    
369 >
370    void setZConsTime(double time)                  {this->zconsTime = time;}
371    void getZConsTime()                             {return zconsTime;}
372 <  
372 >
373    void setIndexOfAllZConsMols(vector<int> index) {indexOfAllZConsMols = index;}
374    void getIndexOfAllZConsMols()                  {return indexOfAllZConsMols;}
375 <  
375 >
376    void setZConsOutput(const char * fileName)          {zconsOutput = fileName;}
377    string getZConsOutput()                         {return zconsOutput;}
378 <  
378 >
379    virtual void integrate();
376  
380  
381 +
382   #ifdef IS_MPI
383    virtual void update();                      //which is called to indicate the molecules' migration
384   #endif
385  
386 <  enum ZConsState {zcsMoving, zcsFixed};  
386 >  enum ZConsState {zcsMoving, zcsFixed};
387  
388    vector<Molecule*> zconsMols;              //z-constraint molecules array
389    vector<ZConsState> states;                 //state of z-constraint molecules
390  
387
391  
392 +
393    int totNumOfUnconsAtoms;              //total number of uncontraint atoms
394    double totalMassOfUncons;                //total mas of unconstraint molecules
395  
# Line 393 | Line 397 | template<typename T> class ZConstraint : public T {
397   protected:
398  
399  
400 <
401 <  virtual void calcForce( int calcPot, int calcStress );
400 >
401 >  virtual void calcForce( int calcPot, int calcStress );
402    virtual void thermalize(void);
403 <  
403 >
404    void zeroOutVel();
405    void doZconstraintForce();
406    void doHarmonic();
# Line 414 | Line 418 | template<typename T> class ZConstraint : public T {
418    double zconsTol;                                 //tolerance of z-contratint
419    double zForceConst;                           //base force constant term
420                                                            //which is estimate by OOPSE
417  
421  
422 <  vector<double> massOfZConsMols;       //mass of z-constraint molecule
422 >
423 >  vector<double> massOfZConsMols;       //mass of z-constraint molecule
424    vector<double> kz;                              //force constant array
425  
426    vector<double> zPos;                          //
427 <  
428 <  
427 >
428 >
429    vector<Molecule*> unconsMols;           //unconstraint molecules array
430    vector<double> massOfUnconsMols;    //mass array of unconstraint molecules
431  
432  
433    vector<ZConsParaItem>* parameters; //
434 <  
434 >
435    vector<int> indexOfAllZConsMols;     //index of All Z-Constraint Molecuels
436  
437 <  int* indexOfZConsMols;                   //index of local Z-Constraint Molecules  
437 >  int* indexOfZConsMols;                   //index of local Z-Constraint Molecules
438    double* fz;
439    double* curZPos;
436  
440  
441  
442 <  int whichDirection;                           //constraint direction
443 <  
442 >
443 >  int whichDirection;                           //constraint direction
444 >
445   private:
446 <  
446 >
447    string zconsOutput;                         //filename of zconstraint output
448    ZConsWriter* fzOut;                         //z-constraint writer
449  
450 <  double curZconsTime;                      
450 >  double curZconsTime;
451  
452    double calcMovingMolsCOMVel();
453    double calcSysCOMVel();
454    double calcTotalForce();
455 <  
455 >
456    ForceSubtractionPolicy* forcePolicy; //force subtraction policy
457    friend class ForceSubtractionPolicy;
458  

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines