IMP logo
IMP Reference Guide  develop.63b38c487d,2024/12/22
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 
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")
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)
Strings setup_from_argv(const Strings &argv, std::string description, std::string positional_description, int num_positional)
Upper bound harmonic function (non-zero when feature > mean)
static XYZR setup_particle(Model *m, ParticleIndex pi)
Definition: XYZR.h:48
Class for storing model, its restraints, constraints, and particles.
Definition: Model.h:86
Apply a function to the distance to a fixed point.
Basic functionality that is expected to be used by a wide variety of IMP users.
VectorD< 3 > Vector3D
Definition: VectorD.h:408
Applies a SingletonScore to a Singleton.