IMP
2.2.0
The Integrative Modeling Platform
IMP Mainpage
All IMP Modules
Related Pages
Modules
Namespaces
Classes
Files
Examples
Indexes
File List
File Members
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))
21
d =
IMP.atom.Hierarchy.setup_particle
(pr)
22
for
j
in
range(0, 5):
23
p =
IMP.kernel.Particle
(m)
24
p.set_name(
"fragment "
+ str(i) +
" "
+ str(j))
25
cd =
IMP.atom.Fragment.setup_particle
(p)
26
d.add_child(cd)
27
xd =
IMP.core.XYZR.setup_particle
(
28
p,
IMP.algebra.Sphere3D
(
IMP.algebra.Vector3D
(3 * i, j, 0), 1))
29
hs.append(pr)
30
31
32
ps =
IMP.core.SphereDistancePairScore
(
IMP.core.HarmonicUpperBound
(0, 1))
33
cps =
IMP.core.ChildrenRefiner
(
IMP.atom.Hierarchy.get_traits
())
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
38
cr =
IMP.core.ConnectivityRestraint
(m, lrps)
39
cr.set_particles(hs)
40
m.add_restraint(cr)
41
42
m.evaluate(
False
)
IMP::core::ChildrenRefiner
Return the hierarchy children of a particle.
Definition:
ChildrenRefiner.h:27
IMP::core::KClosePairsPairScore
Definition:
ClosePairsPairScore.h:31
IMP::core::HarmonicUpperBound
Upper bound harmonic function (non-zero when feature > mean)
Definition:
core/HarmonicUpperBound.h:20
IMP::core::SphereDistancePairScore
A score on the distance between the surfaces of two spheres.
Definition:
SphereDistancePairScore.h:38
IMP::core::XYZR::setup_particle
static XYZR setup_particle(kernel::Model *m, ParticleIndex pi)
Definition:
XYZR.h:48
IMP::atom::Hierarchy::setup_particle
static Hierarchy setup_particle(kernel::Model *m, kernel::ParticleIndex pi, kernel::ParticleIndexesAdaptor children=kernel::ParticleIndexesAdaptor())
Definition:
atom/Hierarchy.h:263
IMP::core::ConnectivityRestraint
Ensure that a set of particles remains connected with one another.
Definition:
ConnectivityRestraint.h:38
IMP::kernel::Particle
Class to handle individual model particles.
Definition:
kernel/Particle.h:34
IMP::atom::Hierarchy::get_traits
static const IMP::core::HierarchyTraits & get_traits()
Get the molecular hierarchy HierararchyTraits.
IMP::core
See IMP.core for more information.
Definition:
AngleRestraint.h:19
IMP::algebra
See IMP.algebra for more information.
Definition:
algebra_config.h:113
IMP::algebra::Vector3D
VectorD< 3 > Vector3D
Definition:
VectorD.h:395
IMP::atom::Fragment::setup_particle
static Fragment setup_particle(kernel::Model *m, ParticleIndex pi)
Definition:
Fragment.h:63
IMP::atom
See IMP.atom for more information.
Definition:
angle_decorators.h:15
IMP::algebra::SphereD< 3 >
IMP::kernel::Model
Class for storing model, its restraints, constraints, and particles.
Definition:
kernel/Model.h:72