IMP logo
IMP Reference Guide  2.11.0
The Integrative Modeling Platform
core/XYZ_Decorator.py

This is a simple example using the XYZ decorator to set the coordinates of some particles and compute the distance between them.

1 ## \example core/XYZ_Decorator.py
2 # This is a simple example using the XYZ decorator to set the coordinates
3 # of some particles and compute the distance between them.
4 
5 import IMP
6 import IMP.core
7 import IMP.algebra
8 import sys
9 
10 IMP.setup_from_argv(sys.argv, "XYZ decorator example")
11 
12 m = IMP.Model()
13 p0 = m.add_particle("xyz0")
14 # add x,y,z coordinates to the particle
16 p1 = m.add_particle("xyz1")
17 # add slots for the coordinates, but leave them uninitialized
19 # set the coordinate values
20 d1.set_coordinates(IMP.algebra.Vector3D(3, 4, 5))
21 
22 # return the distance between the two points described by the decorated
23 # particles
24 print(IMP.core.get_distance(d0, d1))