IMP
2.3.0
The Integrative Modeling Platform
IMP Mainpage
Modules
Applications
Related Pages
Groups
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:270
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:37
IMP::atom::Hierarchy::get_traits
static const IMP::core::HierarchyTraits & get_traits()
Get the molecular hierarchy HierarchyTraits.
IMP::core
Basic functionality that is expected to be used by a wide variety of IMP users.
IMP::algebra
General purpose algebraic and geometric methods that are expected to be used by a wide variety of IMP...
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
Functionality for loading, creating, manipulating and scoring atomic structures.
IMP::algebra::SphereD< 3 >
IMP::kernel::Model
Class for storing model, its restraints, constraints, and particles.
Definition:
kernel/Model.h:73