IMP  2.3.0
The Integrative Modeling Platform
rigid_brownian_dynamics.py
1 ## \example atom/rigid_brownian_dynamics.py
2 # This example shows how to run brownian dynamics with rigid bodies.
3 
4 import IMP.atom
5 import IMP.core
6 import IMP.algebra
7 import IMP.display
8 
9 
10 def create_rigid_body(m, name):
13  prb.set_coordinates_are_optimized(True)
14  prb.set_name(name + " rb")
16  ph.set_name(name)
17  for i in range(0, 2):
18  for j in range(0, 2):
19  for k in range(0, 2):
23  i, j, k) * 10.0,
24  10))
25  ph.add_child(IMP.atom.Fragment.setup_particle(d))
27  prb.add_member(d)
28  d.set_name(name + str(i) + str(j) + str(k))
30  d.set_rotational_diffusion_coefficient(
31  d.get_rotational_diffusion_coefficient() * 100)
32  return prb, ph
33 
34 
35 def display(i, w, hs):
36  w.set_frame(i)
37  for h in hs:
39  w.add_geometry(g)
40 
41 m = IMP.kernel.Model()
42 IMP.base.set_log_level(IMP.base.SILENT)
43 
44 rb0, h0 = create_rigid_body(m, "first")
45 rb1, h1 = create_rigid_body(m, "second")
46 rb1.set_reference_frame(IMP.algebra.ReferenceFrame3D(
48 
51  rb0.get_members() + rb1.get_members()),
52  1, 3)
53 m.add_restraint(ev)
54 
55 #h= IMP.core.Harmonic(0,1)
56 #s= IMP.core.DistanceToSingletonScore(h, IMP.algebra.Vector3D(0,0,0))
57 #r= IMP.core.SingletonRestraint(s, rb0.get_member(0))
58 # m.add_restraint(r)
61 m.add_restraint(cr)
62 
64 bd.set_time_step(10000)
65 
66 nm = IMP.base.create_temporary_file_name("rigid_bd", ".pym")
67 nm = "rigid.pym"
69 for i in range(0, 100):
70  display(i, w, [h0, h1])
71  bd.optimize(10)
Simple 3D transformation class.
static RigidBody setup_particle(kernel::Model *m, ParticleIndex pi, kernel::ParticleIndexesAdaptor ps)
Definition: rigid_bodies.h:168
void set_log_level(LogLevel l)
Set the current global log level.
std::string create_temporary_file_name(std::string prefix="imp_temp", std::string suffix="")
Create a temporary file.
kernel::Restraint * create_distance_restraint(const Selection &n0, const Selection &n1, double x0, double k, std::string name="Distance%1%")
A reference frame in 3D.
static XYZR setup_particle(kernel::Model *m, ParticleIndex pi)
Definition: XYZR.h:48
Simple Brownian dynamics simulator.
static Molecule setup_particle(kernel::Model *m, ParticleIndex pi)
Definition: Molecule.h:37
Store a kernel::ParticleIndexes.
Class to handle individual model particles.
static Mass setup_particle(kernel::Model *m, ParticleIndex pi, Float mass)
Definition: Mass.h:44
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...
VectorD< 3 > Vector3D
Definition: VectorD.h:395
Prevent a set of particles and rigid bodies from inter-penetrating.
Write a CGO file with the geometry.
Definition: PymolWriter.h:34
static Fragment setup_particle(kernel::Model *m, ParticleIndex pi)
Definition: Fragment.h:63
Output IMP model data in various file formats.
Functionality for loading, creating, manipulating and scoring atomic structures.
IMP::core::RigidBody create_rigid_body(const Hierarchies &h, std::string name=std::string("created rigid body"))
Rigidify a molecule or collection of molecules.
Select hierarchy particles identified by the biological name.
Definition: Selection.h:62
static RigidBodyDiffusion setup_particle(kernel::Model *m, ParticleIndex pi)
Definition: Diffusion.h:83
Display an IMP::atom::Hierarchy particle as balls.
Class for storing model, its restraints, constraints, and particles.
Definition: kernel/Model.h:73