IMP logo
IMP Reference Guide  2.22.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-2022 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 Simulator::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  /** @param dtfs time step in femtoseconds
94  @param ikt inverse kT for current chunk step
95  @param ps particle indexes to advance
96  @param begin beginning index of chunk of ps
97  @param end end index of chunk of ps
98  */
99  void do_advance_chunk(double dtfs, double ikt,
100  const ParticleIndexes &ps,
101  unsigned int begin, unsigned int end)
102  override;
103 
104  private:
105  void advance_coordinates_1(ParticleIndex pi, unsigned int i,
106  double dtfs, double ikT,
107  double diffusion_coefficient,
108  algebra::Sphere3D const& xyzr_derivative_pi);
109  void advance_coordinates_0(unsigned int i,
110  double dtfs, double ikT,
111  double diffusion_coefficient,
112  algebra::Sphere3D const& xyzr_derivative_pi,
113  algebra::Sphere3D& xyzr_access);
114  inline algebra::Rotation3D
115  compute_rotation_0(ParticleIndex pi, double dtfs, double ikT,
116  double rotational_diffusion_coefficient_table,
117  double const* torque_tables[]) ;
118 };
119 
120 IMPATOM_END_NAMESPACE
121 
122 #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:86
Simple Brownian dynamics simulator.
virtual void do_advance_chunk(double dtfs, double ikt, const ParticleIndexes &ps, unsigned int begin, unsigned int end)
advances a chunk of ps from index begin to end
3D rotation class.
Definition: Rotation3D.h:52
Classes to handle individual model particles. (Note that implementation of inline functions is in int...
Macros for maintaining molecular hierarchies.
Simple 3D vector class.
Simple 3D sphere class.