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 378 by mmeineke, Fri Mar 21 17:42:12 2003 UTC vs.
Revision 600 by gezelter, Mon Jul 14 22:38:13 2003 UTC

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

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines