IMP logo
IMP Reference Guide  2.6.2
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 import sys
9 
10 IMP.setup_from_argv(sys.argv, "rigid brownian dynamics")
11 
12 
13 def create_rigid_body(m, name):
16  prb.set_coordinates_are_optimized(True)
17  prb.set_name(name + " rb")
19  ph.set_name(name)
20  for i in range(0, 2):
21  for j in range(0, 2):
22  for k in range(0, 2):
26  i, j, k) * 10.0,
27  10))
28  ph.add_child(IMP.atom.Fragment.setup_particle(d))
30  prb.add_member(d)
31  d.set_name(name + str(i) + str(j) + str(k))
33  d.set_rotational_diffusion_coefficient(
34  d.get_rotational_diffusion_coefficient() * 100)
35  return prb, ph
36 
37 
38 def display(i, w, hs):
39  w.set_frame(i)
40  for h in hs:
42  w.add_geometry(g)
43 
44 m = IMP.Model()
45 IMP.set_log_level(IMP.SILENT)
46 
47 rb0, h0 = create_rigid_body(m, "first")
48 rb1, h1 = create_rigid_body(m, "second")
49 rb1.set_reference_frame(IMP.algebra.ReferenceFrame3D(
51 
54  m, rb0.get_rigid_members() + rb1.get_rigid_members()), 1, 3)
55 
56 #h= IMP.core.Harmonic(0,1)
57 #s= IMP.core.DistanceToSingletonScore(h, IMP.algebra.Vector3D(0,0,0))
58 #r= IMP.core.SingletonRestraint(s, rb0.get_member(0))
59 # m.add_restraint(r)
62 
64 
66 bd.set_scoring_function(sf)
67 bd.set_time_step(10000)
68 
69 nm = IMP.create_temporary_file_name("rigid_bd", ".pym")
70 nm = "rigid.pym"
72 for i in range(0, 100):
73  display(i, w, [h0, h1])
74  bd.optimize(10)
Simple 3D transformation class.
static RigidBodyDiffusion setup_particle(Model *m, ParticleIndex pi)
Definition: Diffusion.h:83
Strings setup_from_argv(const Strings &argv, std::string description, std::string positional_description, int num_positional)
static Fragment setup_particle(Model *m, ParticleIndex pi)
Definition: Fragment.h:63
static XYZR setup_particle(Model *m, ParticleIndex pi)
Definition: XYZR.h:48
A reference frame in 3D.
static Molecule setup_particle(Model *m, ParticleIndex pi)
Definition: Molecule.h:37
Class for storing model, its restraints, constraints, and particles.
Definition: Model.h:72
Simple Brownian dynamics simulator.
Store a list of ParticleIndexes.
static Mass setup_particle(Model *m, ParticleIndex pi, Float mass)
Definition: Mass.h:44
void set_log_level(LogLevel l)
Set the current global log level.
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.
Class to handle individual model particles.
Definition: Particle.h:37
Write a CGO file with the geometry.
Definition: PymolWriter.h:34
Restraint * create_distance_restraint(const Selection &n0, const Selection &n1, double x0, double k, std::string name="Distance%1%")
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:66
static RigidBody setup_particle(Model *m, ParticleIndex pi, ParticleIndexesAdaptor ps)
Definition: rigid_bodies.h:158
Display an IMP::atom::Hierarchy particle as balls.
std::string create_temporary_file_name(std::string prefix="imp_temp", std::string suffix="")
Create a temporary file.