IMP  2.0.1
The Integrative Modeling Platform
core/rigid_collisions.py

Collision detection and building of a non-bonded list can be sped up when rigid bodies are used. To do this, use a RigidClosePairsFinder.

1 ## \example core/rigid_collisions.py
2 ## Collision detection and building of a non-bonded list can be sped up when rigid bodies are used.
3 ## To do this, use a RigidClosePairsFinder.
4 
5 import IMP
6 import IMP.core
7 import IMP.atom
8 import IMP.container
9 
10 # This example addes a restraint on nonbonded interactions
11 # Since it is between two rigid bodies, internal interactions are ignored
12 
13 m= IMP.Model()
14 # The particles in the rigid bodies
15 rbps0= IMP.core.create_xyzr_particles(m, 3, 1)
16 rbps1= IMP.core.create_xyzr_particles(m, 3, 1)
17 
18 rbp0= IMP.Particle(m)
19 rbp1= IMP.Particle(m)
20 
21 rbss0 = IMP.core.RigidBody.setup_particle(rbp0, IMP.core.XYZs(rbps0))
22 
23 rbss1 = IMP.core.RigidBody.setup_particle(rbp1, IMP.core.XYZs(rbps1))
24 
26 lsc.add_particles(rbps0)
27 lsc.add_particles(rbps1)
28 
29 # Set up the nonbonded list
31 
32 # Set up excluded volume
34 evr= IMP.container.PairsRestraint(ps, nbl)
35 evri= m.add_restraint(evr)
36 
37 # Set up optimizer
39 o.set_model(m)
40 
41 done=False
42 while not done:
43  try:
44  o.optimize(1000)
46  for d in [rbss0, rbss1]:
49  IMP.algebra.Vector3D(10,10,10)))))
50  else:
51  done=True