IMP logo
IMP Reference Guide  2.17.0
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
3 # rigid bodies are used. To do this, use a RigidClosePairsFinder.
4 
5 import IMP
6 import IMP.core
7 import IMP.atom
8 import IMP.container
9 import sys
10 
11 IMP.setup_from_argv(sys.argv, "rigid collisions")
12 
13 # This example addes a restraint on nonbonded interactions
14 # Since it is between two rigid bodies, internal interactions are ignored
15 
16 m = IMP.Model()
17 # The particles in the rigid bodies
18 rbps0 = IMP.core.create_xyzr_particles(m, 3, 1)
19 rbps1 = IMP.core.create_xyzr_particles(m, 3, 1)
20 
21 rbp0 = IMP.Particle(m)
22 rbp1 = IMP.Particle(m)
23 
25 
27 
29 lsc.add(rbps0)
30 lsc.add(rbps1)
31 
32 # Set up the nonbonded list
34  lsc, 0, IMP.core.RigidClosePairsFinder(), 2.0)
35 
36 # Set up excluded volume
38 evr = IMP.container.PairsRestraint(ps, nbl)
40 
41 # Set up optimizer
43 o.set_scoring_function(sf)
44 
45 done = False
46 while not done:
47  try:
48  o.optimize(1000)
49  except IMP.ModelException:
50  for d in [rbss0, rbss1]:
51  d.set_transformation(
57  0, 0, 0),
58  IMP.algebra.Vector3D(10, 10, 10)))))
59  else:
60  done = True
Simple 3D transformation class.
Lower bound harmonic function (non-zero when feature < mean)
Strings setup_from_argv(const Strings &argv, std::string description, std::string positional_description, int num_positional)
Various classes to hold sets of particles.
XYZRs create_xyzr_particles(Model *m, unsigned int num, Float radius, Float box_side=10)
Create a set of particles with random coordinates.
Rotation3D get_random_rotation_3d(const Rotation3D &center, double distance)
Pick a rotation at random near the provided one.
Simple conjugate gradients optimizer.
Create a scoring function on a list of restraints.
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.
Class for storing model, its restraints, constraints, and particles.
Definition: Model.h:73
Store a list of ParticleIndexes.
Basic functionality that is expected to be used by a wide variety of IMP users.
VectorD< 3 > Vector3D
Definition: VectorD.h:421
Class to handle individual particles of a Model object.
Definition: Particle.h:41
An exception which is thrown when the Model has attributes with invalid values.
Definition: exception.h:188
Functionality for loading, creating, manipulating and scoring atomic structures.
static RigidBody setup_particle(Model *m, ParticleIndex pi, ParticleIndexesAdaptor ps)
Definition: rigid_bodies.h:174
Applies a PairScore to each Pair in a list.
Perform more efficient close pair finding when rigid bodies are involved.