BALL  1.4.2
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Groups Pages
molecularDynamics.h
Go to the documentation of this file.
1 // -*- Mode: C++; tab-width: 2; -*-
2 // vi: set ts=2:
3 //
4 // $Id: molecularDynamics.h,v 1.33 2005/12/23 17:01:53 amoll Exp $
5 //
6 
7 // MolecularDynamics: A base class for molecular dynamics simulations
8 // Useful MD classes must be derived from this class.
9 
10 #ifndef BALL_MOLMEC_MDSIMULATION_MOLECULARDYNAMICS_H
11 #define BALL_MOLMEC_MDSIMULATION_MOLECULARDYNAMICS_H
12 
13 #ifndef BALL_COMMON_H
14 # include <BALL/common.h>
15 #endif
16 
17 #ifndef BALL_DATATYPE_OPTIONS_H
18 # include <BALL/DATATYPE/options.h>
19 #endif
20 
21 #ifndef BALL_MOLMEC_COMMON_ATOMVECTOR_H
23 #endif
24 
25 #include <vector>
26 
27 namespace BALL
28 {
29  // Some forward decls
30  class SnapShotManager;
31  class ForceField;
32  class System;
33 
43  {
44  public:
45 
50  {
51 
54  static const char* MAXIMAL_NUMBER_OF_ITERATIONS;
55 
59  static const char* MAXIMAL_SIMULATION_TIME;
60 
63  static const char* NUMBER_OF_ITERATION;
64 
67  static const char* ENERGY_OUTPUT_FREQUENCY;
68 
71  static const char* SNAPSHOT_FREQUENCY;
72 
75  static const char* TIME_STEP;
76 
79  static const char* REFERENCE_TEMPERATURE;
80 
84  static const char* BATH_RELAXATION_TIME;
85 
88  static const char* CURRENT_TIME;
89  };
90 
92  {
93 
97 
101  static const double MAXIMAL_SIMULATION_TIME;
102 
105  static const Size NUMBER_OF_ITERATION;
106 
111 
114  static const Size SNAPSHOT_FREQUENCY;
115 
118  static const double TIME_STEP;
119 
122  static const double REFERENCE_TEMPERATURE;
123 
126  static const double BATH_RELAXATION_TIME;
127 
131  static const double CURRENT_TIME;
132  };
133 
137 
139 
140 
143 
146  MolecularDynamics(ForceField& force_field);
147 
150  MolecularDynamics(const MolecularDynamics& rhs);
151 
154  virtual ~MolecularDynamics();
155 
157 
160 
163  const MolecularDynamics& operator =(const MolecularDynamics& rhs);
164 
167  void set(const MolecularDynamics& rhs);
168 
170 
173 
176  bool isValid() const;
177 
179 
182 
185  virtual bool setup(ForceField& force_field, SnapShotManager* snapshot_man);
186 
189  virtual bool setup(ForceField& forcefield, SnapShotManager* snapshot_man, const Options& myoptions);
190 
194  virtual bool specificSetup();
195 
197 
200 
203  void setNumberOfIteration(Size number);
204 
209  void setMaximalNumberOfIterations(Size number);
210 
215  void setMaximalSimulationTime(double time);
216 
220  virtual void setTimeStep(double step);
221 
226  void setReferenceTemperature(double temperature);
227 
230  void setCurrentTime(double time);
231 
236  void setEnergyOutputFrequency(Size number);
237 
240  void setSnapShotFrequency(Size number);
241 
244  Size getEnergyOutputFrequency() const;
245 
248  Size getNumberOfIterations() const;
249 
252  Size getMaximalNumberOfIterations() const;
253 
256  double getMaximalSimulationTime() const;
257 
260  double getTimeStep() const;
261 
264  Size getSnapShotFrequency() const;
265 
268  double getTemperature() const;
269 
272  double getTime() const;
273 
276  double getTotalEnergy() const;
277 
280  double getPotentialEnergy() const;
281 
284  double getKineticEnergy() const;
285 
288  ForceField* getForceField() const;
289 
296  bool simulate(bool restart = false);
297 
304  bool simulateTime(double simulation_time, bool restart = false);
305 
313  virtual bool simulateIterations(Size number, bool restart = false);
314 
317  void enableEnergyAbortCondition(bool state);
318 
320  bool energyAbortConditionEnabled() const;
321 
325  void setEnergyToAbort(float value);
326 
330  float getEnergyToAbort() const;
331 
333 
337 
340  Options options;
341 
342  protected:
343 
345  /*_ @name Protected Methods
346  */
347  //_@{
348 
349  /*_ A method for calculating the
350  current temperature in the system
351  */
352  void updateInstantaneousTemperature();
353 
354  //_@}
355  /*_ @name Protected Attributes
356  */
357  //_@{
358 
359  /*_ The boolean variable indicates if the setup of the
360  molecular dynamics has been successful
361  */
362  bool valid_;
363 
364  /*_ The force field the MD class is bound to
365  */
366  ForceField* force_field_ptr_;
367 
368  /*_ The system the MD class is bound to
369  */
370  System* system_ptr_;
371 
372  /*_ The list of atoms. The simulation will be carried out for these atoms
373  */
374  AtomVector atom_vector_;
375 
376  /*_ The current iteration number
377  */
378  Size number_of_iteration_;
379 
380  /*_ The maximal number of iterations to be simulated when
381  calling the simulate() method.
382  */
383  Size maximal_number_of_iterations_;
384 
385  /*_ The time step in picoseconds
386  */
387  double time_step_;
388 
389  /*_ The reference temperature in Kelvin
390  */
391  double reference_temperature_;
392 
393  /*_ The current(kinetic) temperatue in Kelvin
394  */
395  double current_temperature_;
396 
397  /*_ The current kinetic energy in kJ/mol
398  */
399  double kinetic_energy_;
400 
401  /*_ The current total energy in kJ/mol
402  */
403  double total_energy_;
404 
405  /*_ The current time of the MD run
406  */
407  double current_time_;
408 
409  /*_ Frequency of energy output(i.e. after how many iterations)
410  */
411  Size energy_output_frequency_;
412 
413  /*_ Frequency of taking snapshots(i.e. after how many iterations)
414  */
415  Size snapshot_frequency_;
416 
417  /*_ The Snapshot Manager that is used for taking snapshots
418  */
419  SnapShotManager* snapshot_manager_ptr_;
420 
421  //_
422  bool abort_by_energy_enabled_;
423 
424  //_
425  float abort_energy_;
426 
427  //_@}
428 
429  }; // end of class MolecularDynamics
430 } // end of namespace Ball
431 
432 #endif // BALL_MOLMEC_MDSIMULATION_MOLECULARDYNAMICS_H