IMP  2.0.1
The Integrative Modeling Platform
container/restrain_in_sphere.py

This fragment shows how to restrain a set of points stored in a SingletonContainer in a sphere of radius 'radius' centered around 'center'.

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
13 
15 m.add_restraint(r)
16 m.evaluate(False)