Processing math: 20%
IMP logo
IMP Reference Guide  2.22.0
The Integrative Modeling Platform
IMP::atom::Diffusion Class Reference

A decorator for a diffusing particle with a diffusion coefficient. More...

#include <IMP/atom/Diffusion.h>

+ Inheritance diagram for IMP::atom::Diffusion:

Detailed Description

A decorator for a diffusing particle with a diffusion coefficient.

Diffusion is used to decorate a particle with XYZ coordinates (since it inherits from XYZ) and a translational diffusion coefficient D. D is specified in units of A^2/fs, and it is used by eg IMP's Brownian dynamics simulator. It can be set explicitly or inferred implicitly from the radius.

1 ## \example atom/Diffusion_decorator.py
2 # This is a simple example using the Diffusion decorator to set the coordinates
3 # and translational diffusion coefficient of some particles
4 
5 import IMP
6 import IMP.core
7 import IMP.atom
8 import IMP.algebra
9 import sys
10 
11 C0=[0,1,2] # in A
12 C1=[1,2,3] # in A
13 D1 = 3.0 # in A^2/fs
14 R0=5 # in A
15 IMP.setup_from_argv(sys.argv, "Diffusion decorator example")
16 m = IMP.Model()
17 
18 # Setup a diffusion particle with an implicitly-set diffusion coefficient
19 # using the Stokes-Einstein equation, treating radius as the Stokes radius
20 p0 = m.add_particle("diffusion0")
21 xyzr0 = IMP.core.XYZR.setup_particle(m, p0,
22  IMP.algebra.Sphere3D(C0, R0))
24 print("D automatically set to {:.2e} A^2/fs for radius {:.1f} A"
25  .format(d0.get_diffusion_coefficient(), xyzr0.get_radius()))
26 
27 # Explicitly change the diffusion coefficient:
28 d0.set_diffusion_coefficient(d0.get_diffusion_coefficient()/2.0)
29 print("D reset to {:.2e} A^2/fs".format(d0.get_diffusion_coefficient()))
30 
31 # Setup a diffusion particle with an explicitly-set diffusion coefficient
32 p1 = m.add_particle("diffusion1")
33 d1 = IMP.atom.Diffusion.setup_particle(m, p1, C1, D1)
34 print("D explicitly set to {:.2e} A^2/fs for coordinates {} A"
35  .format(d1.get_diffusion_coefficient(), d1.get_coordinates()))
See Also
RigidBodyDiffusion
BrownianDynamics

Definition at line 36 of file Diffusion.h.

Public Member Functions

 Diffusion (::IMP::Model *m,::IMP::ParticleIndex id)
 
 Diffusion (const IMP::ParticleAdaptor &d)
 
double get_diffusion_coefficient () const
 get diffusion coefficient in A^2/fs More...
 
void set_diffusion_coefficient (double d)
 set diffusion coefficient in A^2/fs More...
 
void show (std::ostream &out=std::cout) const
 
- Public Member Functions inherited from IMP::core::XYZ
 XYZ (::IMP::Model *m,::IMP::ParticleIndex id)
 
 XYZ (const IMP::ParticleAdaptor &d)
 
void add_to_derivative (int i, Float v, DerivativeAccumulator &d)
 
void add_to_derivatives (const algebra::Vector3D &v, DerivativeAccumulator &d)
 Add the vector v to the derivative vector of the x,y,z coordinates. More...
 
Float get_coordinate (int i) const
 Get the ith coordinate. More...
 
const algebra::Vector3Dget_coordinates () const
 Convert it to a vector. More...
 
bool get_coordinates_are_optimized () const
 Get whether the coordinates are optimized. More...
 
Float get_derivative (int i) const
 
algebra::Vector3D get_derivatives () const
 Get the vector of derivatives accumulated by add_to_derivatives(). More...
 
algebra::Vector3D get_vector_to (const XYZ &b) const
 Get the vector from this particle to another. More...
 
Float get_x () const
 
Float get_y () const
 
Float get_z () const
 
void set_coordinate (unsigned int i, Float v)
 set the ith coordinate More...
 
void set_coordinates (const algebra::Vector3D &v)
 set all coordinates from a vector More...
 
void set_coordinates_are_optimized (bool tf) const
 Set whether the coordinates are optimized. More...
 
void set_x (Float t)
 
void set_y (Float t)
 
void set_z (Float t)
 
void show (std::ostream &out=std::cout) const
 
- Public Member Functions inherited from IMP::Decorator
bool get_is_valid () const
 Returns true if constructed with a non-default constructor. More...
 
Modelget_model () const
 Returns the Model containing the particle. More...
 
Particleget_particle () const
 Returns the particle decorated by this decorator. More...
 
ParticleIndex get_particle_index () const
 Returns the particle index decorated by this decorator. More...
 
 operator Particle * () const
 
 operator ParticleIndex () const
 
Particleoperator-> () const
 

Static Public Member Functions

static FloatKey get_diffusion_coefficient_key ()
 Get the D key. More...
 
static bool get_is_setup (const IMP::ParticleAdaptor &p)
 
static bool get_is_setup (Model *m, ParticleIndex p)
 Return true if the particle is an instance of Diffusion. More...
 
static Diffusion setup_particle (Model *m, ParticleIndex pi, Float D)
 Setup the particle with the specified diffusion coefficient. More...
 
static Diffusion setup_particle (IMP::ParticleAdaptor pa, Float D)
 
static Diffusion setup_particle (IMP::ParticleAdaptor pa, algebra::Vector3D v, Float D)
 
static Diffusion setup_particle (Model *m, ParticleIndex pi, algebra::Vector3D v, Float D)
 Setup the particle with the specified coordinates and diffusion coefficient. More...
 
static Diffusion setup_particle (Model *m, ParticleIndex pi)
 
static Diffusion setup_particle (IMP::ParticleAdaptor pa)
 
- Static Public Member Functions inherited from IMP::core::XYZ
static FloatKey get_coordinate_key (unsigned int i)
 
static bool get_is_setup (const IMP::ParticleAdaptor &p)
 
static bool get_is_setup (Model *m, ParticleIndex pi)
 
static const FloatKeysget_xyz_keys ()
 Get a vector containing the keys for x,y,z. More...
 
static XYZ setup_particle (IMP::ParticleAdaptor pa)
 
static XYZ setup_particle (Model *m, ParticleIndex pi)
 
static XYZ setup_particle (IMP::ParticleAdaptor pa, algebra::Vector3D v)
 
static XYZ setup_particle (Model *m, ParticleIndex pi, algebra::Vector3D v)
 

Additional Inherited Members

- Protected Member Functions inherited from IMP::Decorator
 Decorator (Model *m, ParticleIndex pi)
 
 Decorator (ParticleAdaptor p)
 

Member Function Documentation

double IMP::atom::Diffusion::get_diffusion_coefficient ( ) const

get diffusion coefficient in A^2/fs

Definition at line 107 of file Diffusion.h.

+ Here is the call graph for this function:

static FloatKey IMP::atom::Diffusion::get_diffusion_coefficient_key ( )
static

Get the D key.

static bool IMP::atom::Diffusion::get_is_setup ( Model m,
ParticleIndex  p 
)
static

Return true if the particle is an instance of Diffusion.

Definition at line 97 of file Diffusion.h.

+ Here is the call graph for this function:

void IMP::atom::Diffusion::set_diffusion_coefficient ( double  d)

set diffusion coefficient in A^2/fs

Definition at line 102 of file Diffusion.h.

+ Here is the call graph for this function:

static Diffusion IMP::atom::Diffusion::setup_particle ( IMP::ParticleAdaptor  pa,
Float  D 
)
static
Returns
a Diffusion object that decorates the particle specified by pa
See Also
setup_particle(m, pi, D )

Definition at line 76 of file Diffusion.h.

static Diffusion IMP::atom::Diffusion::setup_particle ( Model m,
ParticleIndex  pi,
Float  D 
)
static

Setup the particle with the specified diffusion coefficient.

If the particle does not have coordinates, it is decorated as XYZ and its coordinates are set to [0,0,0], otherwise the coordinates remain the same.

Returns
a Diffusion object that decorates particle pi

Definition at line 76 of file Diffusion.h.

static Diffusion IMP::atom::Diffusion::setup_particle ( Model m,
ParticleIndex  pi,
algebra::Vector3D  v,
Float  D 
)
static

Setup the particle with the specified coordinates and diffusion coefficient.

Returns
a Diffusion object that decorates particle pi

Definition at line 78 of file Diffusion.h.

static Diffusion IMP::atom::Diffusion::setup_particle ( IMP::ParticleAdaptor  pa,
algebra::Vector3D  v,
Float  D 
)
static
Returns
a Diffusion object that decorates the particle specified by pa
See Also
setup_particle(m, p, v , D )

Definition at line 78 of file Diffusion.h.

static Diffusion IMP::atom::Diffusion::setup_particle ( IMP::ParticleAdaptor  pa)
static
Returns
a Diffusion object that decorates the particle specified by pa
See Also
setup_particle(m, p)

Definition at line 94 of file Diffusion.h.

static Diffusion IMP::atom::Diffusion::setup_particle ( Model m,
ParticleIndex  pi 
)
static

Setup the particle with a diffusion coefficient automatically inferred from its radius using the Stokes-Einstein equation. The diffusion coefficient is computed implicitly using the Stokes-Einstein equation by calling IMP::atom::get_einstein_diffusion_coefficient(R), where the Stokes radius R is core::XYZR::get_radius() and the temperature is the default IMP temperature of 297.15K.

Note
If the simulation temperature or particle radius change, the diffusion coefficient must be changed explicitly e.g., using set_diffusion_coefficient()
This constructor can be used only on particles that have a radius field, e.g. decorated as IMP::core::XYZR.
Returns
a Diffusion object that decorates particle pi

Definition at line 94 of file Diffusion.h.


The documentation for this class was generated from the following file: