IMP  2.1.0
The Integrative Modeling Platform
connectivity_restraint.py
1 ## \example core/connectivity_restraint.py
2 # This example shows how to use the ConnectivityRestraint to ensure that
3 # all the particles end up in a connected conformation following the
4 # optimization. One should also check out the
5 # IMP::atom::create_connectivity_restraint() helper functions.
6 
7 import IMP
8 import IMP.core
9 import IMP.algebra
10 import IMP.atom
11 
12 m = IMP.kernel.Model()
13 
14 # Put the parent particles for each molecule
15 hs = []
16 
17 # create the molecules, with 5 particles for each of 10 molecules
18 for i in range(0, 10):
19  pr = IMP.kernel.Particle(m)
20  pr.set_name("root " + str(i))
22  for j in range(0, 5):
23  p = IMP.kernel.Particle(m)
24  p.set_name("fragment " + str(i) + " " + str(j))
26  d.add_child(cd)
28  p, IMP.algebra.Sphere3D(IMP.algebra.Vector3D(3 * i, j, 0), 1))
29  hs.append(pr)
30 
31 
34 
35 # score based on the one closest particle from each set of balls
36 lrps = IMP.core.KClosePairsPairScore(ps, cps, 1)
37 # connect all 10 molecules together
39 cr.set_particles(hs)
40 m.add_restraint(cr)
41 
42 m.evaluate(False)
Return the hierarchy children of a particle.
Upper bound harmonic function (non-zero when feature > mean)
A score on the distance between the surfaces of two spheres.
static XYZR setup_particle(kernel::Model *m, ParticleIndex pi)
Definition: XYZR.h:48
static Hierarchy setup_particle(kernel::Model *m, kernel::ParticleIndex pi, kernel::ParticleIndexesAdaptor children=kernel::ParticleIndexesAdaptor())
Ensure that a set of particles remains connected with one another.
Class to handle individual model particles.
static const IMP::core::HierarchyTraits & get_traits()
Get the molecular hierarchy HierararchyTraits.
See IMP.core for more information.
See IMP.algebra for more information.
static Fragment setup_particle(kernel::Model *m, ParticleIndex pi)
Definition: Fragment.h:66
See IMP.atom for more information.
Class for storing model, its restraints, constraints, and particles.