IMP  2.3.0
The Integrative Modeling Platform
core/XYZR_Decorator.py

This is a simple example using the XYZRDecorator to set the coordinates and radius of a particle and compute distances between the resulting spheres.

1 ## \example core/XYZR_Decorator.py
2 # This is a simple example using the XYZRDecorator to set the coordinates
3 # and radius of a particle and compute distances between the resulting
4 # spheres.
5 
6 import IMP
7 import IMP.core
8 import IMP.algebra
9 
10 m = IMP.kernel.Model()
11 p0 = IMP.kernel.Particle(m)
14  1.0))
15 p1 = IMP.kernel.Particle(m)
17 d1.set_coordinates(IMP.algebra.Vector3D(3, 4, 5))
18 d1.set_radius(2.0)
19 
20 print IMP.core.get_distance(d0, d1)
21 
22 # use them as XYZ particles
23 xd0 = IMP.core.XYZ(p0)
24 xd1 = IMP.core.XYZ(p1)
25 
26 # distance without radii
27 print IMP.core.get_distance(xd0, xd1)