Debian Codegraph @

include/BALL/MOLMEC/MDSIMULATION/canonicalMD.h

raw symbols SCIP
1 // -*- Mode: C++; tab-width: 2; -*-
2 // vi: set ts=2:
3 //
4 // $Id: canonicalMD.h,v 1.27 2005/12/23 17:01:52 amoll Exp $
5 //
6
7 #ifndef BALL_MOLMEC_MDSIMULATION_CANONICALMD_H
8 #define BALL_MOLMEC_MDSIMULATION_CANONICALMD_H
9
10 #ifndef BALL_MOLMEC_MDSIMULATION_MOLECULARDYNAMICS_H
11 # include <BALL/MOLMEC/MDSIMULATION/molecularDynamics.h>
12 #endif
13
14 namespace BALL
15 {
16 /** A MD simulation in the canoncial ensemble.
17 A class for doing molecular dynamics simulations
18 according to the principle of a canonical ensemble (NVT), i.e.,
19 the temperature is kept constant.
20 This is achieved via the velocity rescaling proposed by
21 Berendsen et al., J. Chem. Physics, 81:3684, 1984.
22 Note that this approach does not give all properties of a
23 true canonical system. In particular, the heat capacity
24 cannot be calculated!
25 \par
26 The temperature is set through the \link MDSimulation::setReferenceTemperature \endlink method.
27
28 \ingroup MDSimulation
29 */
30 class BALL_EXPORT CanonicalMD
31 : public MolecularDynamics
32 {
33 public:
34
35 BALL_CREATE(CanonicalMD)
36
37 /** @name Constructors and Destructor
38 */
39 //@{
40
41
42 ///
43 CanonicalMD() ;
44
45 /** This constructor expects a force field .
46 The force field's options are used and no saving of snapshots is done.
47 @param myforcefield the forcefield we need for the simulation
48 */
49 CanonicalMD(ForceField& myforcefield) ;
50
51 /** This constructor expects a force field and a snapshot manager.
52 The force field's options are used.
53 @param myforcefield the forcefield to use in the simulation
54 @param ssm a pointer to the SnapShotManager which will be used to
55 create trajectory files
56 */
57 CanonicalMD(ForceField& force_field, SnapShotManager* ssm) ;
58
59 /** This constructor wants a force field, a snapshot manager and new options.
60 @param myforcefield the forcefield which is to be used in the simulation
61 @param ssm a pointer to the SnapShotManager used for creating
62 trajectory files
63 @param myoptions arbitrary options that are to be used by this
64 instance instead of those defined therein
65 */
66 CanonicalMD(ForceField& myforcefield, SnapShotManager* ssm,
67 const Options& options) ;
68
69 /// Copy constructor
70 CanonicalMD(const CanonicalMD& rhs) ;
71
72 /// Destructor
73 virtual ~CanonicalMD() ;
74 //@}
75
76 /** @name Assignment */
77 //@{
78
79 /// Assignment operator
80 CanonicalMD &operator = (const CanonicalMD& rhs) ;
81 //@}
82
83 /** @name Setup methods
84 */
85 //@{
86
87 /** This method does general setup things
88 @param ssm if no snapshots during the simulations are required, leave this at the default (NULL pointer)
89 @param force_field the forcefield, which has to be bound to a system
90 */
91 virtual bool setup(ForceField& force_field, SnapShotManager* ssm = 0)
92 ;
93
94 /** This method does general setup things.
95 This method also allows the assignment of options for the setup.
96 */
97 virtual bool setup(ForceField& force_field, SnapShotManager* ssm,
98 const Options& options)
99 ;
100
101 /** This method is meant for additional preparations apart from those done in setup.
102 @return bool, <b>true</b> if specificSetup() was successful
103 */
104 virtual bool specificSetup() ;
105 //@}
106
107 /** @name Accessors
108 */
109 //@{
110
111 /** This method sets a new relaxation time for the coupling to an external heat bath.
112 The readjustment to the external bath is not done after every step in order
113 to save compute time. Instead, it is coupled periodically after the
114 time specified here has elapsed.
115 @param time the time in <em>ps</em>
116 */
117 void setBathRelaxationTime(double time) ;
118
119 /** This method gets the current value for heat bath coupling.
120 @return the bath relaxation time in <em>ps</em>
121 */
122 double getBathRelaxationTime() const ;
123
124 /** Set a new time step for the numerical integration.
125 */
126 virtual void setTimeStep(double time) ;
127
128 /** This method does the actual simulation stuff.
129 It runs for the indicated number of iterations.
130 If restart is true, the counting of iterations starts with the
131 number of the last iteration in the previous run.
132 @param number the number of iterations that have to be simulated
133 @param restart flag for restarting the simulation
134 */
135 virtual bool simulateIterations(Size number, bool restart = false) ;
136
137 //@}
138
139 protected:
140
141 /// Helper class containing auxiliary factors.
142 struct AuxFactors
143 {
144 double factor1;
145 double factor2;
146 };
147
148 /** @name Protected methods */
149 //@{
150
151 /** A protected method for calculating some factors that are needed all the time.
152 */
153 void calculateFactors_() ;
154 //@}
155
156 /** @name Protected Attributes */
157 //@{
158
159 /// The coupling parameter to the heat bath
160 double bath_relaxation_time_;
161
162 /// This vector contains special precomputed factors
163 std::vector<AuxFactors> mass_factor_;
164 //_@}
165
166 }; //class CanonicalMD
167
168 } // namespace BALL
169
170 #endif // BALL_MOLMEC_MDSIMULATION_CANONICALMD_H