IMP logo
IMP Reference Guide  2.13.0
The Integrative Modeling Platform
BrownianDynamicsTAMD.h
Go to the documentation of this file.
1 /**
2  * \file IMP/atom/BrownianDynamicsTAMD.h
3  * \brief Simple molecular dynamics optimizer.
4  *
5  * Copyright 2007-2020 IMP Inventors. All rights reserved.
6  *
7  */
8 
9 #ifndef IMPATOM_BROWNIAN_DYNAMICS_TAMD_H
10 #define IMPATOM_BROWNIAN_DYNAMICS_TAMD_H
11 
12 #include <IMP/atom/atom_config.h>
13 #include "Diffusion.h"
14 #include "atom_macros.h"
15 #include <IMP/algebra/Sphere3D.h>
17 #include <IMP/Particle.h>
18 #include <IMP/Optimizer.h>
19 #include <IMP/internal/units.h>
20 #include <IMP/algebra/Vector3D.h>
21 
22 IMPATOM_BEGIN_NAMESPACE
23 
24 // for swig
25 class SimulationParameters;
26 
27 //! Simple Brownian dynamics simulator.
28 /** This is an implementation of a Brownian Dynamics simulator.
29 
30  _Input particles and score_
31 
32  Each optimized particle must have x,y,z attributes
33  that are optimizable. In addition, each optimized particle must be
34  decorated with the Diffusion decorator. Optionally, the
35  RigidBodyDiffusion decorator can be used to specify a rotational
36  diffusion coefficient for core::RigidBody particles. The
37  optimizer assumes the scoring function to be energy in kcal/mol, and the xyz
38  coordinates to be in angstroms and the diffusion coefficient of
39  each particle be in \f$A^2/fs\f$ (or \f$Radian^2/fs\f$ for rotational
40  diffusion coefficient). Particles without optimized x,y,z
41  and nonoptimized D are skipped.
42 
43  The optimizer can either automatically determine which particles
44  to use from the model or be passed a SingletonContainer for the
45  particles. If such a container is passed, particles added to it
46  during optimization state updates are handled properly.
47 
48  _Simulation_
49 
50  At each simulation time step, each particle is translated in the
51  direction of the sum of a random diffusion vector and the gradient
52  of the scoring function (force field) at the particle
53  coordinates. The translation is proportional to the particle
54  diffusion coefficient, the time step size, and the inverse of kT.
55  Note that particles masses are not considered, only their
56  diffusion coefficients.
57 
58  Similarly, rigid bodies are rotated by the sum of a random torque and a
59  force field torque, proportionally to the rotational diffusion
60  coefficient, the time step size, and inversely proportional kT.
61 
62  If the skt (stochastic runge kutta) flag is true, the simulation is
63  altered slightly to apply the SKT scheme.
64 
65  _Time step_
66  The time step is always equal precisely to Simulater::get_maximum_time_step()
67  when using either Simulator::simulate() or Optimizer::optimize()
68 
69  \see Diffusion
70  \see RigidBodyDiffusion
71  */
72 class IMPATOMEXPORT BrownianDynamicsTAMD : public BrownianDynamics {
73  public:
74  //! Create the optimizer
75  /** If sc is not null, that container will be used to find particles
76  to move, otherwise the model will be searched.
77  @param m model associated with bd
78  @param name name of bd object
79  @param wave_factor for wave step function, see Simulator object,
80  if >1.001 or so, creates a wave of time steps
81  that are larger by up to wave_factor from
82  formal maximal time step
83 
84  @note wave_factor is an advanced feature - if you're not sure, just use
85  its default, see also Simulator::simulate_wave()
86  */
88  std::string name = "BrownianDynamicsTAMD%1%",
89  double wave_factor = 1.0);
90 
91  protected:
92  /** advances a chunk of ps from index begin to end
93 
94  @param dtfs time step in femtoseconds
95  @param ikt inverse kT for current chunk step
96  @param ps particle indexes to advance
97  @param begin beginning index of chunk of ps
98  @param end end index of chunk of ps
99  */
100  void do_advance_chunk(double dtfs, double ikt,
101  const ParticleIndexes &ps,
102  unsigned int begin, unsigned int end)
103  IMP_OVERRIDE;
104 
105  private:
106  void advance_coordinates_1(ParticleIndex pi, unsigned int i,
107  double dtfs, double ikT,
108  double diffusion_coefficient,
109  algebra::Sphere3D const& xyzr_derivative_pi);
110  void advance_coordinates_0(unsigned int i,
111  double dtfs, double ikT,
112  double diffusion_coefficient,
113  algebra::Sphere3D const& xyzr_derivative_pi,
114  algebra::Sphere3D& xyzr_access);
115  inline algebra::Rotation3D
116  compute_rotation_0(ParticleIndex pi, double dtfs, double ikT,
117  double rotational_diffusion_coefficient_table,
118  double const* torque_tables[]) ;
119 };
120 
121 IMPATOM_END_NAMESPACE
122 
123 #endif /* IMPATOM_BROWNIAN_DYNAMICS_TAMD_H */
A decorator for a diffusing particle.
Simple Brownian dynamics optimizer.
Simple Brownian dynamics simulator.
Base class for all optimizers.
Class for storing model, its restraints, constraints, and particles.
Definition: Model.h:72
Simple Brownian dynamics simulator.
virtual void do_advance_chunk(double dtfs, double ikt, const ParticleIndexes &ps, unsigned int begin, unsigned int end)
3D rotation class.
Definition: Rotation3D.h:51
Classes to handle individual model particles. (Note that implementation of inline functions is in int...
Various important macros for implementing decorators.
Simple 3D vector class.
Simple 3D sphere class.
#define IMP_OVERRIDE
Cause a compile error if this method does not override a parent method.