IMP logo
IMP Reference Guide  2.20.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.container
10 import IMP.algebra
11 import IMP.atom
12 import sys
13 
14 IMP.setup_from_argv(sys.argv, "Connectivity restraint")
15 
16 m = IMP.Model()
17 
18 # Put the parent particles for each molecule
19 hs = []
20 
21 # create the molecules, with 5 particles for each of 10 molecules
22 for i in range(0, 10):
23  pr = IMP.Particle(m)
24  pr.set_name("root " + str(i))
26  for j in range(0, 5):
27  p = IMP.Particle(m)
28  p.set_name("fragment " + str(i) + " " + str(j))
30  d.add_child(cd)
32  p, IMP.algebra.Sphere3D(IMP.algebra.Vector3D(3 * i, j, 0), 1))
33  hs.append(pr)
34 
35 
38 
39 # score based on the one closest particle from each set of balls
40 lrps = IMP.core.KClosePairsPairScore(ps, cps, 1)
41 # connect all 10 molecules together
43 cr = IMP.core.ConnectivityRestraint(lrps, lsc)
44 
45 cr.evaluate(False)
Return the hierarchy children of a particle.
Apply a score to a fixed number of close pairs from the two sets.
Strings setup_from_argv(const Strings &argv, std::string description, std::string positional_description, int num_positional)
static Fragment setup_particle(Model *m, ParticleIndex pi)
Definition: Fragment.h:67
Various classes to hold sets of particles.
Upper bound harmonic function (non-zero when feature > mean)
static XYZR setup_particle(Model *m, ParticleIndex pi)
Definition: XYZR.h:48
A score on the distance between the surfaces of two spheres.
Class for storing model, its restraints, constraints, and particles.
Definition: Model.h:86
static Hierarchy setup_particle(Model *m, ParticleIndex pi, ParticleIndexesAdaptor children=ParticleIndexesAdaptor())
Create a Hierarchy of level t by adding the needed attributes.
Store a list of ParticleIndexes.
Ensure that a set of particles remains connected with one another.
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:425
Class to handle individual particles of a Model object.
Definition: Particle.h:43
Functionality for loading, creating, manipulating and scoring atomic structures.