IMP
2.0.1
The Integrative Modeling Platform
Main Page
Related Pages
Modules
Namespaces
Classes
Files
Examples
File List
File Members
XYZR_Decorator.py
1
## \example core/XYZR_Decorator.py
2
## This is a simple example using the XYZRDecorator to set the coordinates and radius of a particle and compute distances between the resulting spheres.
3
4
import
IMP
5
import
IMP.core
6
import
IMP.algebra
7
8
m=
IMP.Model
()
9
p0=
IMP.Particle
(m)
10
d0=
IMP.core.XYZR.setup_particle
(p0,
IMP.algebra.Sphere3D
(
IMP.algebra.Vector3D
(0,1,2),
11
1.0))
12
p1=
IMP.Particle
(m)
13
d1=
IMP.core.XYZR.setup_particle
(p1)
14
d1.set_coordinates(
IMP.algebra.Vector3D
(3,4,5))
15
d1.set_radius(2.0)
16
17
print
IMP.core.get_distance
(d0, d1)
18
19
# use them as XYZ particles
20
xd0=
IMP.core.XYZ.decorate_particle
(p0)
21
xd1=
IMP.core.XYZ.decorate_particle
(p1)
22
23
# distance without radii
24
print
IMP.core.get_distance
(xd0, xd1)