IMP  2.0.1
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 def create_rigid_body(m, name):
11  prb.set_coordinates_are_optimized(True)
12  prb.set_name(name+" rb")
14  ph.set_name(name)
15  for i in range(0,2):
16  for j in range(0,2):
17  for k in range(0,2):
20  10))
21  ph.add_child(IMP.atom.Fragment.setup_particle(d))
23  prb.add_member(d)
24  d.set_name(name+str(i)+str(j)+str(k))
26  d.set_rotational_diffusion_coefficient(d.get_rotational_diffusion_coefficient()*100)
27  return prb, ph
28 
29 def display(i, w, hs):
30  w.set_frame(i)
31  for h in hs:
33  w.add_geometry(g)
34 
35 m= IMP.Model()
36 IMP.base.set_log_level(IMP.base.SILENT)
37 
38 rb0, h0= create_rigid_body(m, "first")
39 rb1, h1= create_rigid_body(m, "second")
41 
42 ev= IMP.core.ExcludedVolumeRestraint(IMP.container.ListSingletonContainer(rb0.get_members()+rb1.get_members()),
43  1, 3)
44 m.add_restraint(ev)
45 
46 #h= IMP.core.Harmonic(0,1)
47 #s= IMP.core.DistanceToSingletonScore(h, IMP.algebra.Vector3D(0,0,0))
48 #r= IMP.core.SingletonRestraint(s, rb0.get_member(0))
49 #m.add_restraint(r)
51 m.add_restraint(cr)
52 
54 bd.set_time_step(10000)
55 
56 nm=IMP.base.create_temporary_file_name("rigid_bd", ".pym")
57 nm="rigid.pym"
59 for i in range(0,100):
60  display(i, w, [h0, h1])
61  bd.optimize(10)