IMP  2.3.1
The Integrative Modeling Platform
BerendsenThermostatOptimizerState.h
Go to the documentation of this file.
1 /**
2  * \file IMP/atom/BerendsenThermostatOptimizerState.h
3  * \brief Maintains temperature during molecular dynamics using a
4  * Berendsen thermostat.
5  *
6  * Copyright 2007-2014 IMP Inventors. All rights reserved.
7  *
8  */
9 
10 #ifndef IMPATOM_BERENDSEN_THERMOSTAT_OPTIMIZER_STATE_H
11 #define IMPATOM_BERENDSEN_THERMOSTAT_OPTIMIZER_STATE_H
12 
13 #include <IMP/atom/atom_config.h>
14 #include <IMP/kernel/Particle.h>
15 #include <IMP/base_types.h>
16 #include <IMP/OptimizerState.h>
17 
18 IMPATOM_BEGIN_NAMESPACE
19 
20 //! Maintains temperature during molecular dynamics.
21 /** The thermostat scales velocities using the algorithm described
22  in H. J. C. Berendsen, J. P. M. Postma,
23  W. F. van Gunsteren, A. DiNola, and J. R. Haak "Molecular dynamics
24  with coupling to an external bath", Journal of Chemical Physics 81
25  pp. 3684-3690 (1984).
26 
27  At each update, velocities are rescaled by \f[
28  \lambda = \left[1 + \frac{\Delta t}{\tau_T}
29  \left( \frac{T}{T_k} -1\right)\right]^{1/2}
30  \f]
31  where \f$\Delta t\f$ is the molecular dynamics timestep, \f$\tau_T\f$
32  is the coupling constant (in fs) of the thermostat, \f$T\f$ is the
33  thermostat temperature, and \f$T_k\f$ is the instantaneous (kinetic)
34  temperature of the dynamics. (This is equation 11 from the reference above.)
35  */
36 class IMPATOMEXPORT BerendsenThermostatOptimizerState : public OptimizerState {
37  public:
39  double temperature, double tau);
40 
41  //! Set the particles to use.
42  void set_particles(const kernel::Particles &pis) { pis_ = pis; }
43 
44  double get_temperature() { return temperature_; }
45 
46  double get_tau() { return tau_; }
47 
48  void set_temperature(double temperature) { temperature_ = temperature; }
49 
50  void set_tau(double tau) { tau_ = tau; }
51 
52  //! Rescale the velocities now
53  void rescale_velocities() const;
54 
56 
57  protected:
58  virtual void do_update(unsigned int) IMP_OVERRIDE;
59 
60  private:
61  kernel::Particles pis_;
62  double temperature_;
63  double tau_;
64 
65  //! Keys of the xyz velocities
66  FloatKey vs_[3];
67 };
68 
71 
72 IMPATOM_END_NAMESPACE
73 
74 #endif /* IMPATOM_BERENDSEN_THERMOSTAT_OPTIMIZER_STATE_H */
Import IMP/kernel/base_types.h in the namespace.
virtual void do_update(unsigned int)
#define IMP_OBJECT_METHODS(Name)
Define the basic things needed by any Object.
Definition: object_macros.h:25
Shared optimizer state that is invoked upon commitment of new coordinates.
Classes to handle individual model particles. (Note that implementation of inline functions in in int...
void set_particles(const kernel::Particles &pis)
Set the particles to use.
#define IMP_OBJECTS(Name, PluralName)
Define the types for storing sets of objects.
Definition: object_macros.h:52
Import IMP/kernel/OptimizerState.h in the namespace.
#define IMP_OVERRIDE
Cause a compile error if this method does not override a parent method.
Maintains temperature during molecular dynamics.