IMP logo
IMP Reference Guide  2.19.0
The Integrative Modeling Platform
XYZ_Decorator.py
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))
Strings setup_from_argv(const Strings &argv, std::string description, std::string positional_description, int num_positional)
static XYZ setup_particle(Model *m, ParticleIndex pi)
Definition: XYZ.h:51
double get_distance(XYZR a, XYZR b)
Compute the sphere distance between a and b.
Definition: XYZR.h:89
Class for storing model, its restraints, constraints, and particles.
Definition: Model.h:86
Basic functionality that is expected to be used by a wide variety of IMP users.
General purpose algebraic and geometric methods that are expected to be used by a wide variety of IMP...
VectorD< 3 > Vector3D
Definition: VectorD.h:425