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 423 by mmeineke, Thu Mar 27 20:12:15 2003 UTC vs.
Revision 605 by gezelter, Tue Jul 15 03:27:24 2003 UTC

# Line 2 | Line 2
2   #define _INTEGRATOR_H_
3  
4   #include "Atom.hpp"
5 + #include "Molecule.hpp"
6   #include "SRI.hpp"
7   #include "AbstractClasses.hpp"
8   #include "SimInfo.hpp"
9   #include "ForceFields.hpp"
10 + #include "Thermo.hpp"
11 + #include "ReadWrite.hpp"
12  
13 < class Verlet : public Integrator {
13 > const double kB = 8.31451e-7;// boltzmann constant amu*Ang^2*fs^-2/K
14 > const double eConvert = 4.184e-4; // converts kcal/mol -> amu*A^2/fs^2
15 > const double p_convert = 1.63882576e8; //converts amu*fs^-2*Ang^-1 -> atm
16 > const int maxIteration = 300;
17 > const double tol = 1.0e-6;
18  
19 + class Integrator : public BaseIntegrator {
20 +
21   public:
22 <  Verlet( SimInfo &info, ForceFields* the_ff );
23 <  ~Verlet();
22 >  Integrator( SimInfo *theInfo, ForceFields* the_ff );
23 >  virtual ~Integrator();
24    void integrate( void );
25  
26 < private:
26 >
27 > protected:
28    
29 <  void move_a( double dt );
30 <  void move_b( double dt );
29 >  virtual void integrateStep( int calcPot, int calcStress );
30 >  virtual void preMove( void );
31 >  virtual void moveA( void );
32 >  virtual void moveB( void );
33 >  virtual void constrainA( void );
34 >  virtual void constrainB( void );
35 >  virtual int  readyCheck( void ) { return 1; }
36 >  
37 >  void checkConstraints( void );
38 >  void rotate( int axes1, int axes2, double angle, double j[3],
39 >               double A[3][3] );
40  
41 +
42    ForceFields* myFF;
43  
44 <  SimInfo *entry_plug; // all the info we'll ever need
45 <  int c_natoms;  /* the number of atoms */
46 <  Atom **c_atoms; /* array of atom pointers */
44 >  SimInfo *info; // all the info we'll ever need
45 >  int nAtoms;  /* the number of atoms */
46 >  int oldAtoms;
47 >  Atom **atoms; /* array of atom pointers */
48    Molecule* molecules;
49    int nMols;
50  
51 <  int c_is_constrained; /*boolean to know whether the systems contains
52 <                          constraints. */
53 <  int c_n_constrained; /*counter for number of constraints */
54 <  int *c_constrained_i; /* the i of a constraint pair */
55 <  int *c_constrained_j; /* the j of a constraint pair */
56 <  double *c_constrained_dsqr; /* the square of the constraint distance */
57 <  double *c_mass; /* the array of masses */
58 <  short is_first; /*boolean for the first time integrate is called */
59 <  double c_box_x;
60 <  double c_box_y;
40 <  double c_box_z;
41 < };
51 >  int isConstrained; // boolean to know whether the systems contains
52 >                     // constraints.
53 >  int nConstrained;  // counter for number of constraints
54 >  int *constrainedA; // the i of a constraint pair
55 >  int *constrainedB; // the j of a constraint pair
56 >  double *constrainedDsqr; // the square of the constraint distance
57 >  
58 >  int* moving; // tells whether we are moving atom i
59 >  int* moved;  // tells whether we have moved atom i
60 >  double* oldPos; // pre constrained positions
61  
62 < class Symplectic : public Integrator {
62 >  short isFirst; /*boolean for the first time integrate is called */
63    
64 +  double dt;
65 +  double dt2;
66 +
67 +  Thermo *tStats;
68 +  StatWriter*  statOut;
69 +  DumpWriter*  dumpOut;
70 +  
71 + };
72 +
73 + class NVE : public Integrator{
74 +
75   public:
76 <  Symplectic( SimInfo* the_entry_plug,  ForceFields* the_ff );
77 <  ~Symplectic();
76 >  NVE ( SimInfo *theInfo, ForceFields* the_ff ):
77 >    Integrator( theInfo, the_ff ){}
78 >  virtual ~NVE(){}
79 >
80    
49  void integrate( void );
81  
82 < private:
82 > };
83  
84 <  void rotate( int axes1, int axes2, double angle, double j[3],
54 <               double A[3][3] );
84 > class NVT : public Integrator{
85  
86 <  SimInfo* entry_plug;
57 <  ForceFields* myFF;
86 > public:
87  
88 <  Molecule* molecules;
89 <  int nMols;
88 >  NVT ( SimInfo *theInfo, ForceFields* the_ff);
89 >  virtual ~NVT() {}
90  
91 <  int is_constrained; /*boolean to know whether the systems contains
92 <                          constraints. */
64 <  int n_constrained; /*counter for number of constraints */
65 <  int *constrained_i; /* the i of a constraint pair */
66 <  int *constrained_j; /* the j of a constraint pair */
67 <  double *constrained_dsqr; /* the square of the constraint distance */
68 <  double *mass; /* the array of masses */
91 >  void setTauThermostat(double tt) {tauThermostat = tt; have_tau_thermostat=1;}
92 >  void setTargetTemp(double tt) {targetTemp = tt; have_target_temp = 1;}
93  
94 <  short int isFirst;
94 > protected:
95  
96 <  SRI **srInteractions; /* array of SRI pointers */
97 <  int nSRI; /* the number of short range interactions */
96 >  virtual void moveA( void );
97 >  virtual void moveB( void );
98 >
99 >  virtual int readyCheck();
100 >
101 >  // chi is a propagated degree of freedom.
102 >
103 >  double chi;
104 >
105 >  // targetTemp must be set.  tauThermostat must also be set;
106 >
107 >  double targetTemp;
108 >  double tauThermostat;
109    
110 +  short int have_tau_thermostat, have_target_temp;
111 +
112   };
113  
114 +
115 + class NPTi : public Integrator{
116 +
117 + public:
118 +
119 +  NPTi ( SimInfo *theInfo, ForceFields* the_ff);
120 +  virtual ~NPTi() {};
121 +
122 +  virtual void integrateStep( int calcPot, int calcStress ){
123 +    calcStress = 1;
124 +    Integrator::integrateStep( calcPot, calcStress );
125 +  }
126 +
127 +  void setTauThermostat(double tt) {tauThermostat = tt; have_tau_thermostat=1;}
128 +  void setTauBarostat(double tb) {tauBarostat = tb; have_tau_barostat=1;}
129 +  void setTargetTemp(double tt) {targetTemp = tt; have_target_temp = 1;}
130 +  void setTargetPressure(double tp) {targetPressure = tp; have_target_pressure = 1;}
131 +
132 + protected:
133 +
134 +  virtual void  moveA( void );
135 +  virtual void moveB( void );
136 +
137 +  virtual int readyCheck();
138 +
139 +  // chi and eta are the propagated degrees of freedom
140 +
141 +  double chi;
142 +  double eta;
143 +  double NkBT;
144 +
145 +  // targetTemp, targetPressure, and tauBarostat must be set.  
146 +  // One of qmass or tauThermostat must be set;
147 +
148 +  double targetTemp;
149 +  double targetPressure;
150 +  double tauThermostat;
151 +  double tauBarostat;
152 +
153 +  short int have_tau_thermostat, have_tau_barostat, have_target_temp;
154 +  short int have_target_pressure;
155 +
156 + };
157 +
158 + class NPTim : public Integrator{
159 +
160 + public:
161 +
162 +  NPTim ( SimInfo *theInfo, ForceFields* the_ff);
163 +  virtual ~NPTim() {};
164 +
165 +  virtual void integrateStep( int calcPot, int calcStress ){
166 +    calcStress = 1;
167 +    Integrator::integrateStep( calcPot, calcStress );
168 +  }
169 +
170 +  void setTauThermostat(double tt) {tauThermostat = tt; have_tau_thermostat=1;}
171 +  void setTauBarostat(double tb) {tauBarostat = tb; have_tau_barostat=1;}
172 +  void setTargetTemp(double tt) {targetTemp = tt; have_target_temp = 1;}
173 +  void setTargetPressure(double tp) {targetPressure = tp; have_target_pressure = 1;}
174 +
175 + protected:
176 +
177 +  virtual void moveA( void );
178 +  virtual void moveB( void );
179 +
180 +  virtual int readyCheck();
181 +
182 +  Molecule* myMolecules;
183 +  Atom** myAtoms;
184 +
185 +  // chi and eta are the propagated degrees of freedom
186 +
187 +  double chi;
188 +  double eta;
189 +  double NkBT;
190 +
191 +  // targetTemp, targetPressure, and tauBarostat must be set.  
192 +  // One of qmass or tauThermostat must be set;
193 +
194 +  double targetTemp;
195 +  double targetPressure;
196 +  double tauThermostat;
197 +  double tauBarostat;
198 +
199 +  short int have_tau_thermostat, have_tau_barostat, have_target_temp;
200 +  short int have_target_pressure;
201 +
202 + };
203 +
204 + class NPTf : public Integrator{
205 +
206 + public:
207 +
208 +  NPTf ( SimInfo *theInfo, ForceFields* the_ff);
209 +  virtual ~NPTf() {};
210 +
211 +  virtual void integrateStep( int calcPot, int calcStress ){
212 +    calcStress = 1;
213 +    Integrator::integrateStep( calcPot, calcStress );
214 +  }
215 +
216 +  void setTauThermostat(double tt) {tauThermostat = tt; have_tau_thermostat=1;}
217 +  void setTauBarostat(double tb) {tauBarostat = tb; have_tau_barostat=1;}
218 +  void setTargetTemp(double tt) {targetTemp = tt; have_target_temp = 1;}
219 +  void setTargetPressure(double tp) {targetPressure = tp; have_target_pressure = 1;}
220 +
221 + protected:
222 +
223 +  virtual void  moveA( void );
224 +  virtual void moveB( void );
225 +
226 +  virtual int readyCheck();
227 +
228 +  // chi and eta are the propagated degrees of freedom
229 +
230 +  double chi;
231 +  double eta[3][3];
232 +  double NkBT;
233 +
234 +  // targetTemp, targetPressure, and tauBarostat must be set.  
235 +  // One of qmass or tauThermostat must be set;
236 +
237 +  double targetTemp;
238 +  double targetPressure;
239 +  double tauThermostat;
240 +  double tauBarostat;
241 +
242 +  short int have_tau_thermostat, have_tau_barostat, have_target_temp;
243 +  short int have_target_pressure;
244 +
245 + };
246 +
247 + class NPTfm : public Integrator{
248 +
249 + public:
250 +
251 +  NPTfm ( SimInfo *theInfo, ForceFields* the_ff);
252 +  virtual ~NPTfm() {};
253 +
254 +  virtual void integrateStep( int calcPot, int calcStress ){
255 +    calcStress = 1;
256 +    Integrator::integrateStep( calcPot, calcStress );
257 +  }
258 +
259 +  void setTauThermostat(double tt) {tauThermostat = tt; have_tau_thermostat=1;}
260 +  void setTauBarostat(double tb) {tauBarostat = tb; have_tau_barostat=1;}
261 +  void setTargetTemp(double tt) {targetTemp = tt; have_target_temp = 1;}
262 +  void setTargetPressure(double tp) {targetPressure = tp; have_target_pressure = 1;}
263 +
264 + protected:
265 +
266 +  virtual void  moveA( void );
267 +  virtual void moveB( void );
268 +
269 +  virtual int readyCheck();
270 +
271 +  Molecule* myMolecules;
272 +  Atom** myAtoms;
273 +
274 +  // chi and eta are the propagated degrees of freedom
275 +
276 +  double chi;
277 +  double eta[3][3];
278 +  double NkBT;
279 +
280 +  // targetTemp, targetPressure, and tauBarostat must be set.  
281 +  // One of qmass or tauThermostat must be set;
282 +
283 +  double targetTemp;
284 +  double targetPressure;
285 +  double tauThermostat;
286 +  double tauBarostat;
287 +
288 +  short int have_tau_thermostat, have_tau_barostat, have_target_temp;
289 +  short int have_target_pressure;
290 +
291 + };
292 +
293   #endif

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines