IMP logo
IMP Reference Guide  develop.7482b7c7af, 2026/12/05
The Integrative Modeling Platform
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
6import IMP
7import IMP.core
8import sys
9
10IMP.setup_from_argv(sys.argv, "restrain in sphere")
11
12radius = 10
13stiffness = 2
14center = IMP.algebra.Vector3D(1, 2, 3)
15m = IMP.Model()
16p = m.add_particle("particle")
18 m, p, IMP.algebra.Sphere3D(IMP.algebra.Vector3D(100, 0, 0), 1))
19
20ub = IMP.core.HarmonicUpperBound(radius, stiffness)
21
22# Restrain based on the distance to a single point (hence a ball
24
26r.evaluate(False)
Class for storing model, its restraints, constraints, and particles.
Definition Model.h:111
Upper bound harmonic function (non-zero when feature > mean).
Applies a SingletonScore to a Singleton.
static XYZR setup_particle(Model *m, ParticleIndex pi)
Definition XYZR.h:48
VectorD< 3 > Vector3D
Definition VectorD.h:407
Basic functionality that is expected to be used by a wide variety of IMP users.
void setup_from_argv(int argc, char **argv, std::string description)
Parse the command line flags and return the positional arguments.