home
about
news
download
doc
source
systems
tests
bugs
contact
IMP Reference Guide
2.13.0
The Integrative Modeling Platform
IMP Manual
Reference Guide
Tutorial Index
Modules
Classes
Examples
doc
examples
core
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))
25
d =
IMP.atom.Hierarchy.setup_particle
(pr)
26
for
j
in
range(0, 5):
27
p =
IMP.Particle
(m)
28
p.set_name(
"fragment "
+ str(i) +
" "
+ str(j))
29
cd =
IMP.atom.Fragment.setup_particle
(p)
30
d.add_child(cd)
31
xd =
IMP.core.XYZR.setup_particle
(
32
p,
IMP.algebra.Sphere3D
(
IMP.algebra.Vector3D
(3 * i, j, 0), 1))
33
hs.append(pr)
34
35
36
ps =
IMP.core.SphereDistancePairScore
(
IMP.core.HarmonicUpperBound
(0, 1))
37
cps =
IMP.core.ChildrenRefiner
(
IMP.atom.Hierarchy.get_traits
())
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
42
lsc =
IMP.container.ListSingletonContainer
(m, hs)
43
cr =
IMP.core.ConnectivityRestraint
(lrps, lsc)
44
45
cr.evaluate(
False
)
IMP::core::ChildrenRefiner
Return the hierarchy children of a particle.
Definition:
ChildrenRefiner.h:27
IMP::core::KClosePairsPairScore
Apply a score to a fixed number of close pairs from the two sets.
Definition:
ClosePairsPairScore.h:30
IMP::setup_from_argv
Strings setup_from_argv(const Strings &argv, std::string description, std::string positional_description, int num_positional)
IMP::atom::Fragment::setup_particle
static Fragment setup_particle(Model *m, ParticleIndex pi)
Definition:
Fragment.h:63
IMP::container
Various classes to hold sets of particles.
IMP::core::HarmonicUpperBound
Upper bound harmonic function (non-zero when feature > mean)
Definition:
core/HarmonicUpperBound.h:20
IMP::core::XYZR::setup_particle
static XYZR setup_particle(Model *m, ParticleIndex pi)
Definition:
XYZR.h:48
IMP::core::SphereDistancePairScore
A score on the distance between the surfaces of two spheres.
Definition:
SphereDistancePairScore.h:38
IMP::Model
Class for storing model, its restraints, constraints, and particles.
Definition:
Model.h:72
IMP::atom::Hierarchy::setup_particle
static Hierarchy setup_particle(Model *m, ParticleIndex pi, ParticleIndexesAdaptor children=ParticleIndexesAdaptor())
Create a Hierarchy of level t by adding the needed attributes.
Definition:
atom/Hierarchy.h:240
IMP::container::ListSingletonContainer
Store a list of ParticleIndexes.
Definition:
ListSingletonContainer.h:33
IMP::core::ConnectivityRestraint
Ensure that a set of particles remains connected with one another.
Definition:
ConnectivityRestraint.h:39
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:421
IMP::Particle
Class to handle individual particles of a Model object.
Definition:
Particle.h:41
IMP::atom
Functionality for loading, creating, manipulating and scoring atomic structures.
IMP::algebra::SphereD< 3 >