IMP  2.4.0
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.kernel.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.kernel.Particle(m)
19 rbp1 = IMP.kernel.Particle(m)
20 
22 
24 
26 lsc.add_particles(rbps0)
27 lsc.add_particles(rbps1)
28 
29 # Set up the nonbonded list
31  lsc, 0, IMP.core.RigidClosePairsFinder(), 2.0)
32 
33 # Set up excluded volume
35 evr = IMP.container.PairsRestraint(ps, nbl)
36 evri = m.add_restraint(evr)
37 
38 # Set up optimizer
40 
41 done = False
42 while not done:
43  try:
44  o.optimize(1000)
46  for d in [rbss0, rbss1]:
47  d.set_transformation(
53  0, 0, 0),
54  IMP.algebra.Vector3D(10, 10, 10)))))
55  else:
56  done = True