IMP  2.3.1
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 radius = 10
9 stiffness = 2
10 center = IMP.algebra.Vector3D(1, 2, 3)
11 m = IMP.kernel.Model()
12 p = m.add_particle("particle")
14  m, p, IMP.algebra.Sphere3D(IMP.algebra.Vector3D(100, 0, 0), 1))
15 
16 ub = IMP.core.HarmonicUpperBound(radius, stiffness)
17 
18 # Restrain based on the distance to a single point (hence a ball
19 ss = IMP.core.DistanceToSingletonScore(ub, center)
20 
21 r = IMP.core.SingletonRestraint(ss, m.get_particle(p))
22 r.evaluate(False)
Upper bound harmonic function (non-zero when feature > mean)
static XYZR setup_particle(kernel::Model *m, ParticleIndex pi)
Definition: XYZR.h:48
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:395
Applies a SingletonScore to a Singleton.
Class for storing model, its restraints, constraints, and particles.
Definition: kernel/Model.h:73