IMP logo
IMP Reference Guide  2.19.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-2022 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/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 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) override;
59 
60  private:
61  Particles pis_;
62  double temperature_;
63  double tau_;
64 };
65 
68 
69 IMPATOM_END_NAMESPACE
70 
71 #endif /* IMPATOM_BERENDSEN_THERMOSTAT_OPTIMIZER_STATE_H */
Basic types used by IMP.
#define IMP_OBJECT_METHODS(Name)
Define the basic things needed by any Object.
Definition: object_macros.h:25
virtual void do_update(unsigned int)
void set_particles(const Particles &pis)
Set the particles to use.
Classes to handle individual model particles. (Note that implementation of inline functions is in int...
#define IMP_OBJECTS(Name, PluralName)
Define the types for storing lists of object pointers.
Definition: object_macros.h:44
Shared optimizer state that is invoked upon commitment of new coordinates.
Shared optimizer state.
Maintains temperature during molecular dynamics.