IMP
2.2.1
The Integrative Modeling Platform
IMP Mainpage
All IMP Modules
Related Pages
Modules
Namespaces
Classes
Files
Examples
Indexes
File List
File Members
atom/MolecularDynamics.h
Go to the documentation of this file.
1
/**
2
* \file IMP/atom/MolecularDynamics.h
3
* \brief Simple molecular dynamics optimizer.
4
*
5
* Copyright 2007-2014 IMP Inventors. All rights reserved.
6
*
7
*/
8
9
#ifndef IMPATOM_MOLECULAR_DYNAMICS_H
10
#define IMPATOM_MOLECULAR_DYNAMICS_H
11
12
#include <IMP/atom/atom_config.h>
13
#include "
Simulator.h
"
14
#include "
atom_macros.h
"
15
#include <
IMP/kernel/Particle.h
>
16
#include <
IMP/Optimizer.h
>
17
18
IMPATOM_BEGIN_NAMESPACE
19
20
//! Simple molecular dynamics optimizer.
21
/** The particles to be optimized must have optimizable x,y,z attributes
22
and a non-optimizable mass attribute; this optimizer assumes the score
23
to be energy in kcal/mol, the xyz coordinates to be in angstroms, and
24
the mass to be in AMU (g/mol).
25
26
\note RigidBody particles are not handled properly.
27
28
kernel::Particles without optimized x,y,z and nonoptimized mass are skipped.
29
\see VelocityScalingOptimizerState
30
\see LangevinThermostatOptimizerState
31
\see BerendsenThermostatOptimizerState
32
\see RemoveRigidMotionOptimizerState
33
*/
34
class
IMPATOMEXPORT
MolecularDynamics
:
public
Simulator
{
35
public
:
36
/** Score based on the provided model */
37
MolecularDynamics
(
kernel::Model
*m);
38
39
//! \return the current kinetic energy of the system, in kcal/mol
40
virtual
Float
get_kinetic_energy()
const
;
41
42
//! \return the current kinetic temperature of the system
43
/** \param[in] ekinetic kinetic energy, e.g. from get_kinetic_energy()
44
*/
45
Float
get_kinetic_temperature(
Float
ekinetic)
const
;
46
47
//! Set maximum velocity in A/fs
48
/** At each dynamics time step, the absolute value of each velocity
49
component is capped at this value. This prevents spurious strong forces
50
(occasionally encountered with frustrated conformations) from causing
51
large oscillations in the system.
52
By default, velocities are not capped.
53
54
\note The actual velocities that are capped are the half-step velocities
55
in the velocity Verlet algorithm.
56
*/
57
void
set_velocity_cap
(
Float
velocity_cap) { velocity_cap_ = velocity_cap; }
58
59
//! Assign velocities representative of the given temperature
60
virtual
void
assign_velocities(
Float
temperature);
61
virtual
void
setup
(
const
kernel::ParticleIndexes
&ps) IMP_OVERRIDE;
62
virtual
double
do_step
(
const
kernel::ParticleIndexes
&sc,
63
double
dt) IMP_OVERRIDE;
64
virtual
bool
get_is_simulation_particle
(
kernel::ParticleIndex
p)
const
65
IMP_OVERRIDE;
66
67
IMP_OBJECT_METHODS
(
MolecularDynamics
);
68
69
protected
:
70
void
initialize();
71
72
virtual
void
setup_degrees_of_freedom(
const
kernel::ParticleIndexes
&ps);
73
74
//! First part of velocity Verlet (update coordinates and half-step velocity)
75
virtual
void
propagate_coordinates(
const
kernel::ParticleIndexes
&ps,
76
double
step_size);
77
78
//! Second part of velocity Verlet (update velocity)
79
virtual
void
propagate_velocities(
const
kernel::ParticleIndexes
&ps,
80
double
step_size);
81
82
//! Cap a velocity component to the maximum value.
83
inline
void
cap_velocity_component
(
Float
&vel) {
84
if
(vel >= 0.0) {
85
vel = std::min(vel, velocity_cap_);
86
}
else
{
87
vel = std::max(vel, -velocity_cap_);
88
}
89
}
90
91
//! Keys of the xyz velocities
92
FloatKey
vs_[3];
93
94
//! Number of degrees of freedom in the system
95
int
degrees_of_freedom_
;
96
97
//! Maximum absolute value of a single velocity component
98
Float
velocity_cap_
;
99
};
100
101
IMPATOM_END_NAMESPACE
102
103
#endif
/* IMPATOM_MOLECULAR_DYNAMICS_H */
IMP::atom::Simulator
The base class for simulators.
Definition:
Simulator.h:34
IMP::kernel::Key< 0, true >
IMP::base::Vector< ParticleIndex >
Optimizer.h
Import IMP/kernel/Optimizer.h in the namespace.
IMP::atom::MolecularDynamics::set_velocity_cap
void set_velocity_cap(Float velocity_cap)
Set maximum velocity in A/fs.
Definition:
atom/MolecularDynamics.h:57
IMP::atom::MolecularDynamics
Simple molecular dynamics optimizer.
Definition:
atom/MolecularDynamics.h:34
IMP::atom::MolecularDynamics::degrees_of_freedom_
int degrees_of_freedom_
Number of degrees of freedom in the system.
Definition:
atom/MolecularDynamics.h:95
IMP_OBJECT_METHODS
#define IMP_OBJECT_METHODS(Name)
Define the basic things needed by any Object.
Definition:
base/object_macros.h:25
Simulator.h
Simple molecular dynamics optimizer.
IMP::base::Index< ParticleIndexTag >
Particle.h
Classes to handle individual model particles.
IMP::atom::Simulator::get_is_simulation_particle
virtual bool get_is_simulation_particle(kernel::ParticleIndex p) const =0
IMP::atom::MolecularDynamics::cap_velocity_component
void cap_velocity_component(Float &vel)
Cap a velocity component to the maximum value.
Definition:
atom/MolecularDynamics.h:83
atom_macros.h
Various important macros for implementing decorators.
IMP::atom::MolecularDynamics::velocity_cap_
Float velocity_cap_
Maximum absolute value of a single velocity component.
Definition:
atom/MolecularDynamics.h:98
IMP::atom::Simulator::setup
virtual void setup(const kernel::ParticleIndexes &)
Definition:
Simulator.h:158
IMP::Float
double Float
Basic floating-point value (could be float, double...)
Definition:
base/types.h:20
IMP::atom::Simulator::do_step
virtual double do_step(const kernel::ParticleIndexes &sc, double dt)=0
IMP::kernel::Model
Class for storing model, its restraints, constraints, and particles.
Definition:
kernel/Model.h:72