IMP  2.1.0
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-2013 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>
18 
19 IMPATOM_BEGIN_NAMESPACE
20 
21 //! Maintains temperature during molecular dynamics.
22 /** The thermostat scales velocities using the algorithm described
23  in H. J. C. Berendsen, J. P. M. Postma,
24  W. F. van Gunsteren, A. DiNola, and J. R. Haak "Molecular dynamics
25  with coupling to an external bath", Journal of Chemical Physics 81
26  pp. 3684-3690 (1984).
27 
28  At each update, velocities are rescaled by \f[
29  \lambda = \left[1 + \frac{\Delta t}{\tau_T}
30  \left( \frac{T}{T_k} -1\right)\right]^{1/2}
31  \f]
32  where \f$\Delta t\f$ is the molecular dynamics timestep, \f$\tau_T\f$
33  is the coupling constant (in fs) of the thermostat, \f$T\f$ is the
34  thermostat temperature, and \f$T_k\f$ is the instantaneous (kinetic)
35  temperature of the dynamics. (This is equation 11 from the reference above.)
36  */
37 class IMPATOMEXPORT BerendsenThermostatOptimizerState : public OptimizerState {
38  public:
40  double temperature, double tau);
41 
42  //! Set the particles to use.
43  void set_particles(const kernel::Particles &pis) { pis_ = pis; }
44 
45  double get_temperature() { return temperature_; }
46 
47  double get_tau() { return tau_; }
48 
49  void set_temperature(double temperature) { temperature_ = temperature; }
50 
51  void set_tau(double tau) { tau_ = tau; }
52 
53  //! Rescale the velocities now
54  void rescale_velocities() const;
55 
57 
58  protected:
59  virtual void do_update(unsigned int) IMP_OVERRIDE;
60 
61  private:
62  kernel::Particles pis_;
63  double temperature_;
64  double tau_;
65 
66  //! Keys of the xyz velocities
67  FloatKey vs_[3];
68 };
69 
72 
73 IMPATOM_END_NAMESPACE
74 
75 #endif /* IMPATOM_BERENDSEN_THERMOSTAT_OPTIMIZER_STATE_H */
Import IMP/kernel/base_types.h in the namespace.
virtual void do_update(unsigned int)
Shared optimizer state that is invoked upon commitment of new coordinates.
#define IMP_OBJECT_METHODS(Name)
Define the basic things needed by any Object.
Import IMP/kernel/optimizer_state_macros.h in the namespace.
Classes to handle individual model particles.
#define IMP_OBJECTS(Name, PluralName)
Define the types for storing sets of objects.
void set_particles(const kernel::Particles &pis)
Set the particles to use.
Import IMP/kernel/OptimizerState.h in the namespace.
Maintains temperature during molecular dynamics.