IMP logo
IMP Reference Guide  2.20.0
The Integrative Modeling Platform
Diffusion_decorator.py
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()))
Strings setup_from_argv(const Strings &argv, std::string description, std::string positional_description, int num_positional)
static XYZR setup_particle(Model *m, ParticleIndex pi)
Definition: XYZR.h:48
Class for storing model, its restraints, constraints, and particles.
Definition: Model.h:86
Basic functionality that is expected to be used by a wide variety of IMP users.
General purpose algebraic and geometric methods that are expected to be used by a wide variety of IMP...
static Diffusion setup_particle(Model *m, ParticleIndex pi, Float D)
Setup the particle with the specified diffusion coefficient.
Definition: Diffusion.h:76
Functionality for loading, creating, manipulating and scoring atomic structures.