IMP  2.3.1
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 HierarchyTraits.
Basic functionality that is expected to be used by a wide variety of IMP users.
General purpose algebraic and geometric methods that are expected to be used by a wide variety of IMP...
VectorD< 3 > Vector3D
Definition: VectorD.h:395
static Fragment setup_particle(kernel::Model *m, ParticleIndex pi)
Definition: Fragment.h:63
Functionality for loading, creating, manipulating and scoring atomic structures.
Class for storing model, its restraints, constraints, and particles.
Definition: kernel/Model.h:73