IMP  2.2.1
The Integrative Modeling Platform
rigid_collisions.py
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
Simple 3D transformation class.
Lower bound harmonic function (non-zero when feature < mean)
static RigidBody setup_particle(kernel::Model *m, ParticleIndex pi, kernel::ParticleIndexesAdaptor ps)
Definition: rigid_bodies.h:168
See IMP.container for more information.
Rotation3D get_random_rotation_3d(const Rotation3D &center, double distance)
Pick a rotation at random near the provided one.
Simple conjugate gradients optimizer.
An exception which is thrown when the kernel::Model has attributes with invalid values.
A score on the distance between the surfaces of two spheres.
Return all close unordered pairs of particles taken from the SingletonContainer.
Vector3D get_random_vector_in(const Cylinder3D &c)
Generate a random vector in a cylinder with uniform density.
Store a kernel::ParticleIndexes.
XYZRs create_xyzr_particles(kernel::Model *m, unsigned int num, Float radius, Float box_side=10)
Create a set of particles with random coordinates.
Class to handle individual model particles.
See IMP.core for more information.
VectorD< 3 > Vector3D
Definition: VectorD.h:395
See IMP.atom for more information.
Applies a PairScore to each Pair in a list.
Peform more efficient close pair finding when rigid bodies are involved.
Class for storing model, its restraints, constraints, and particles.
Definition: kernel/Model.h:72