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 693 by tim, Wed Aug 13 19:21:53 2003 UTC vs.
Revision 701 by tim, Wed Aug 20 14:34:04 2003 UTC

# Line 44 | Line 44 | template<typename T = BaseIntegrator> class Integrator
44    
45    void checkConstraints( void );
46    void rotate( int axes1, int axes2, double angle, double j[3],
47 <               double A[3][3] );
48 <              
47 >         double A[3][3] );
48 >        
49    ForceFields* myFF;
50  
51    SimInfo *info; // all the info we'll ever need
# Line 56 | Line 56 | template<typename T = BaseIntegrator> class Integrator
56    int nMols;
57  
58    int isConstrained; // boolean to know whether the systems contains
59 <                     // constraints.
59 >         // constraints.
60    int nConstrained;  // counter for number of constraints
61    int *constrainedA; // the i of a constraint pair
62    int *constrainedB; // the j of a constraint pair
# Line 299 | Line 299 | template<typename T> class ZConstraint : public T {
299   };
300  
301   template<typename T> class ZConstraint : public T {
302 +  
303 +  public:
304 +  class ForceSubstractionPolicy{
305 +    public:
306 +      ForceSubstractionPolicy(ZConstraint<T>* integrator) {zconsIntegrator = integrator;}
307 +
308 +      virtual void update() = 0;    
309 +      virtual double getZFOfFixedZMols(Molecule* mol, Atom* atom, double totalForce) = 0;
310 +      virtual double getZFOfMovingMols(Atom* atom, double totalForce) = 0;
311 +      virtual double getHFOfFixedZMols(Molecule* mol, Atom* atom, double totalForce) = 0;
312 +      virtual double getHFOfUnconsMols(Atom* atom, double totalForce) = 0;
313 +    
314 +   protected:
315 +     ZConstraint<T>* zconsIntegrator;;
316 +  };
317 +
318 +  class PolicyByNumber : ForceSubstractionPolicy{
319 +    public:
320 +      PolicyByNumber(ZConstraint<T>* integrator) :ForceSubstractionPolicy(integrator) {}    
321 +      virtual void update();    
322 +      virtual double getZFOfFixedZMols(Molecule* mol, Atom* atom, double totalForce) ;
323 +      virtual double getZFOfMovingMols(Atom* atom, double totalForce) ;
324 +      virtual double getHFOfFixedZMols(Molecule* mol, Atom* atom, double totalForce);
325 +      virtual double getHFOfUnconsMols(Atom* atom, double totalForce);
326 +    
327 +    private:
328 +    int totNumOfMovingAtoms;
329 +  };
330  
331 +  class PolicyByMass :ForceSubstractionPolicy{
332 +    public:
333 +      PolicyByMass(ZConstraint<T>* integrator) :ForceSubstractionPolicy(integrator) {}  
334 +      
335 +      virtual void update();    
336 +      virtual double getZFOfFixedZMols(Molecule* mol, Atom* atom, double totalForce) ;
337 +      virtual double getZFOfMovingMols(Atom* atom, double totalForce) ;
338 +      virtual double getHFOfFixedZMols(Molecule* mol, Atom* atom, double totalForce);
339 +      virtual double getHFOfUnconsMols(Atom* atom, double totalForce);
340 +
341 +   private:
342 +     double totMassOfMovingAtoms;
343 +  };
344 +
345   public:
346  
347    ZConstraint( SimInfo *theInfo, ForceFields* the_ff);
# Line 308 | Line 350 | template<typename T> class ZConstraint : public T {
350    void setZConsTime(double time)                  {this->zconsTime = time;}
351    void getZConsTime()                             {return zconsTime;}
352    
353 <  void setIndexOfAllZConsMols(vector<int> index)  {indexOfAllZConsMols = index;}
354 <  void getIndexOfAllZConsMols()                   {return indexOfAllZConsMols;}
353 >  void setIndexOfAllZConsMols(vector<int> index) {indexOfAllZConsMols = index;}
354 >  void getIndexOfAllZConsMols()                  {return indexOfAllZConsMols;}
355    
356 <  void setZConsOutput(const char * fileName)      {zconsOutput = fileName;}
356 >  void setZConsOutput(const char * fileName)          {zconsOutput = fileName;}
357    string getZConsOutput()                         {return zconsOutput;}
358    
359    virtual void integrate();
360    
361  
362   #ifdef IS_MPI
363 <  virtual void update(); //which is called to indicate the molecules' migration
363 >  virtual void update();                      //which is called to indicate the molecules' migration
364   #endif
365  
366   protected:
367  
368 <  enum ZConsState {zcsMoving, zcsFixed};
327 <
328 <
368 >  enum ZConsState {zcsMoving, zcsFixed};  
369  
370    virtual void calcForce( int calcPot, int calcStress );
371    virtual void thermalize(void);
# Line 343 | Line 383 | template<typename T> class ZConstraint : public T {
383    int isZConstraintMol(Molecule* mol);
384  
385  
386 <  double zconsTime;
387 <  double zconsTol;
388 <  double zForceConst;
386 >  double zconsTime;                              //sample time
387 >  double zconsTol;                                 //tolerance of z-contratint
388 >  double zForceConst;                           //base force constant term
389 >                                                          //which is estimate by OOPSE
390    
391 <  vector<Molecule*> zconsMols;
392 <  vector<double> massOfZConsMols;
393 <  vector<double> kz;
394 <  vector<ZConsState> states;
395 <  vector<double> zPos;
391 >  vector<Molecule*> zconsMols;              //z-constraint molecules array
392 >  vector<double> massOfZConsMols;       //mass of z-constraint molecule
393 >  vector<double> kz;                              //force constant array
394 >  vector<ZConsState> states;                 //state of z-constraint molecules
395 >  vector<double> zPos;                          //
396    
397    
398 <  vector<Molecule*> unconsMols;
399 <  vector<double> massOfUnconsMols;
400 <  double totalMassOfUncons;
398 >  vector<Molecule*> unconsMols;           //unconstraint molecules array
399 >  vector<double> massOfUnconsMols;    //mass array of unconstraint molecules
400 >  double totalMassOfUncons;                //total mas of unconstraint molecules
401  
402 <  vector<ZConsParaItem>* parameters;
402 >  vector<ZConsParaItem>* parameters; //
403    
404    vector<int> indexOfAllZConsMols;     //index of All Z-Constraint Molecuels
405  
406    int* indexOfZConsMols;                   //index of local Z-Constraint Molecules  
407    double* fz;
408 +  double* curZPos;
409    
410 <  int totNumOfUnconsAtoms;
410 >  int totNumOfUnconsAtoms;              //total number of uncontraint atoms
411  
412    int whichDirection;                           //constraint direction
413    
414   private:
415    
416 <  string zconsOutput;
417 <  ZConsWriter* fzOut;
416 >  string zconsOutput;                         //filename of zconstraint output
417 >  ZConsWriter* fzOut;                         //z-constraint writer
418  
419 <  double calcCOMVel();
378 <  double calcCOMVel2();
419 >  double curZconsTime;                      
420  
421 +  double calcMovingMolsCOMVel();
422 +  double calcSysCOMVel();
423 +  double calcTotalForce();
424 +  
425 +  ForceSubstractionPolicy* forcePolicy; //force substration policy
426 +  friend class ForceSubstractionPolicy;
427 +
428   };
429  
430   #endif

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines