| 1 | // -*- Mode: C++; tab-width: 2; -*- |
| 2 | // vi: set ts=2: |
| 3 | // |
| 4 | // $Id: microCanonicalMD.h,v 1.25 2005/12/23 17:01:53 amoll Exp $ |
| 5 | // |
| 6 | |
| 7 | #ifndef BALL_MOLMEC_MDSIMULATION_MICROCANONICALMD_H |
| 8 | #define BALL_MOLMEC_MDSIMULATION_MICROCANONICALMD_H |
| 9 | |
| 10 | #ifndef BALL_MOLMEC_MDSIMULATION_MOLECULARDYNAMICS_H |
| 11 | # include <BALL/MOLMEC/MDSIMULATION/molecularDynamics.h> |
| 12 | #endif |
| 13 | |
| 14 | namespace BALL |
| 15 | { |
| 16 | /** Microcanonical MD: A class for doing molecular dynamics simulations |
| 17 | according to the principle of a microcanonical ensemble (NVE), i.e., |
| 18 | the total energy of the system is kept constant. Numerical |
| 19 | integration for new atom positions is done via the Velocity Verlet |
| 20 | method. \par |
| 21 | |
| 22 | \ingroup MDSimulation |
| 23 | */ |
| 24 | class BALL_EXPORT MicroCanonicalMD : public MolecularDynamics |
| 25 | { |
| 26 | |
| 27 | public: |
| 28 | |
| 29 | /** A local auxiliary class. |
| 30 | */ |
| 31 | struct AuxFactors |
| 32 | { |
| 33 | double factor1,factor2; |
| 34 | }; |
| 35 | |
| 36 | /** @name Constructors and Destructors. |
| 37 | */ |
| 38 | //@{ |
| 39 | |
| 40 | BALL_CREATE(MicroCanonicalMD) |
| 41 | |
| 42 | /** The default constructor with no arguments. |
| 43 | */ |
| 44 | MicroCanonicalMD(); |
| 45 | |
| 46 | /** This constructor expects a force field. |
| 47 | The force field's options are used and no snapshots are taken. |
| 48 | */ |
| 49 | MicroCanonicalMD(ForceField &myforcefield); |
| 50 | |
| 51 | /** This constructor expects a force field and a snapshot-manager. |
| 52 | The force field's options are used. |
| 53 | */ |
| 54 | MicroCanonicalMD(ForceField &myforcefield, SnapShotManager *ssm); |
| 55 | |
| 56 | /** This constructor wants a force field, a snapshot manager and new |
| 57 | options. |
| 58 | */ |
| 59 | MicroCanonicalMD(ForceField &myforcefield, SnapShotManager *ssm, |
| 60 | const Options &myoptions); |
| 61 | |
| 62 | /// Copy constructor |
| 63 | MicroCanonicalMD(const MicroCanonicalMD& rhs); |
| 64 | |
| 65 | /// The destructor |
| 66 | virtual ~MicroCanonicalMD(); |
| 67 | |
| 68 | //@} |
| 69 | /** @name Assignment |
| 70 | */ |
| 71 | //@{ |
| 72 | |
| 73 | /// Assignment operator |
| 74 | MicroCanonicalMD &operator=(const MicroCanonicalMD &rhs); |
| 75 | |
| 76 | //@} |
| 77 | /** @name Setup methods. |
| 78 | */ |
| 79 | //@{ |
| 80 | |
| 81 | /** This method does general setup things. |
| 82 | */ |
| 83 | virtual bool setup(ForceField &myforcefield, SnapShotManager *ssm); |
| 84 | |
| 85 | /** This method does general setup things. |
| 86 | */ |
| 87 | virtual bool setup(ForceField &myforcefield, SnapShotManager *ssm, |
| 88 | const Options &myoptions); |
| 89 | |
| 90 | /** This method is meant for additional preparations apart from those |
| 91 | done in setup. |
| 92 | */ |
| 93 | virtual bool specificSetup(); |
| 94 | |
| 95 | //@} |
| 96 | /** @name Accessors |
| 97 | */ |
| 98 | //@{ |
| 99 | |
| 100 | /** Choose a new time step |
| 101 | */ |
| 102 | virtual void setTimeStep(double step); |
| 103 | |
| 104 | /** This method does the actual simulation stuff. |
| 105 | It runs for the indicated number of iterations. |
| 106 | restart = true means that the counting of iterations is |
| 107 | continued from the previous run. |
| 108 | */ |
| 109 | virtual bool simulateIterations(Size number, bool restart = false); |
| 110 | |
| 111 | //@} |
| 112 | |
| 113 | protected: |
| 114 | |
| 115 | /*_ @name Protected methods |
| 116 | */ |
| 117 | //_@{ |
| 118 | |
| 119 | /*_ A protected method for calculating some |
| 120 | factors that are needed all the time |
| 121 | */ |
| 122 | void calculateFactors(); |
| 123 | |
| 124 | //_@} |
| 125 | /*_ @name Protected Attributes |
| 126 | */ |
| 127 | //_@{ |
| 128 | |
| 129 | /*_ This vector contains special, precomputed factors |
| 130 | */ |
| 131 | vector<AuxFactors> mass_factor_; |
| 132 | |
| 133 | //_@} |
| 134 | |
| 135 | }; // end of class MicroCanonicalMD |
| 136 | } // end of namespace BALL |
| 137 | |
| 138 | #endif // BALL_MOLMEC_MDSIMULATION_MICROCANONICALMD_H |