home
about
news
download
doc
source
systems
tests
bugs
contact
IMP Reference Guide
develop.7482b7c7af, 2026/12/05
The Integrative Modeling Platform
IMP Manual
Reference Guide
Tutorial Index
Modules
Classes
Examples
doc
examples
core
core/restrain_in_sphere.py
1
## \example core/restrain_in_sphere.py
2
# This fragment shows how to restrain a set of points stored in a
3
# SingletonContainer in a sphere of radius 'radius' centered around
4
# 'center'.
5
6
import
IMP
7
import
IMP.core
8
import
sys
9
10
IMP.setup_from_argv
(sys.argv,
"restrain in sphere"
)
11
12
radius = 10
13
stiffness = 2
14
center =
IMP.algebra.Vector3D
(1, 2, 3)
15
m =
IMP.Model
()
16
p = m.add_particle(
"particle"
)
17
IMP.core.XYZR.setup_particle
(
18
m, p,
IMP.algebra.Sphere3D
(
IMP.algebra.Vector3D
(100, 0, 0), 1))
19
20
ub =
IMP.core.HarmonicUpperBound
(radius, stiffness)
21
22
# Restrain based on the distance to a single point (hence a ball
23
ss =
IMP.core.DistanceToSingletonScore
(ub, center)
24
25
r =
IMP.core.SingletonRestraint
(m, ss, p)
26
r.evaluate(
False
)
IMP::Model
Class for storing model, its restraints, constraints, and particles.
Definition
Model.h:111
IMP::algebra::SphereD< 3 >
IMP::core::GenericDistanceToSingletonScore< UnaryFunction >
IMP::core::HarmonicUpperBound
Upper bound harmonic function (non-zero when feature > mean).
Definition
core/HarmonicUpperBound.h:22
IMP::core::SingletonRestraint
Applies a SingletonScore to a Singleton.
Definition
SingletonRestraint.h:37
IMP::core::XYZR::setup_particle
static XYZR setup_particle(Model *m, ParticleIndex pi)
Definition
XYZR.h:48
IMP::algebra::Vector3D
VectorD< 3 > Vector3D
Definition
VectorD.h:407
IMP::core
Basic functionality that is expected to be used by a wide variety of IMP users.
IMP::setup_from_argv
void setup_from_argv(int argc, char **argv, std::string description)
Parse the command line flags and return the positional arguments.