IMP
2.0.1
The Integrative Modeling Platform
Main Page
Related Pages
Modules
Namespaces
Classes
Files
Examples
File List
File Members
restrain_in_sphere.py
1
## \example container/restrain_in_sphere.py
2
## This fragment shows how to restrain a set of points stored in a SingletonContainer in a sphere of radius 'radius' centered around 'center'.
3
4
import
IMP.example
5
radius=10
6
stiffness=2
7
center=
IMP.algebra.Vector3D
(1,2,3)
8
(m,c)=IMP.example.create_model_and_particles()
9
ub=
IMP.core.HarmonicUpperBound
(radius, stiffness)
10
11
# Restrain based on the distance to a single point (hence a ball
12
ss=
IMP.core.DistanceToSingletonScore
(ub, center)
13
14
r=
IMP.container.SingletonsRestraint
(ss, c)
15
m.add_restraint(r)
16
m.evaluate(
False
)