IMP logo
IMP Reference Guide  develop.7482b7c7af, 2026/12/05
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
5import IMP
6import IMP.core
7import IMP.atom
8import IMP.container
9import sys
10
11IMP.setup_from_argv(sys.argv, "rigid collisions")
12
13# This example adds a restraint on nonbonded interactions
14# Since it is between two rigid bodies, internal interactions are ignored
15
16m = IMP.Model()
17# The particles in the rigid bodies
18rbps0 = IMP.core.create_xyzr_particles(m, 3, 1)
19rbps1 = IMP.core.create_xyzr_particles(m, 3, 1)
20
21rbp0 = IMP.Particle(m)
22rbp1 = IMP.Particle(m)
23
25
27
29lsc.add(rbps0)
30lsc.add(rbps1)
31
32# Set up the nonbonded list
34 lsc, 0, IMP.core.RigidClosePairsFinder(), 2.0)
35
36# Set up excluded volume
40
41# Set up optimizer
43o.set_scoring_function(sf)
44
45done = False
46while 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
An exception which is thrown when the Model has attributes with invalid values.
Definition exception.h:188
Class for storing model, its restraints, constraints, and particles.
Definition Model.h:111
Class to handle individual particles of a Model object.
Definition Particle.h:45
Simple 3D transformation class.
Return all close unordered pairs of particles taken from the SingletonContainer.
Applies a PairScore to each Pair in a list.
Simple conjugate gradients optimizer.
Lower bound harmonic function (non-zero when feature < mean).
Create a scoring function on a list of restraints.
static RigidBody setup_particle(Model *m, ParticleIndex pi, ParticleIndexesAdaptor ps)
Perform more efficient close pair finding when rigid bodies are involved.
A score on the distance between the surfaces of two spheres.
Rotation3D get_random_rotation_3d()
Pick a rotation at random from all possible rotations.
VectorD< 3 > Vector3D
Definition VectorD.h:407
VectorD< D > get_random_vector_in(const BoundingBoxD< D > &bb)
Generate a random vector in a box with uniform density.
Functionality for loading, creating, manipulating and scoring atomic structures.
Various classes to hold sets of particles.
Basic functionality that is expected to be used by a wide variety of IMP users.
XYZRs create_xyzr_particles(Model *m, unsigned int num, Float radius, Float box_side=10)
Create a set of particles with random coordinates.
void setup_from_argv(int argc, char **argv, std::string description)
Parse the command line flags and return the positional arguments.