IMP logo
IMP Reference Guide  develop.7482b7c7af, 2026/12/05
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
5import IMP
6import IMP.core
7import IMP.algebra
8import sys
9
10IMP.setup_from_argv(sys.argv, "XYZ decorator example")
11
12m = IMP.Model()
13p0 = m.add_particle("xyz0")
14# add x,y,z coordinates to the particle
16p1 = m.add_particle("xyz1")
17# add slots for the coordinates, but leave them uninitialized
19# set the coordinate values
20d1.set_coordinates(IMP.algebra.Vector3D(3, 4, 5))
21
22# return the distance between the two points described by the decorated
23# particles
24print(IMP.core.get_distance(d0, d1))
Class for storing model, its restraints, constraints, and particles.
Definition Model.h:111
static XYZ setup_particle(Model *m, ParticleIndex pi)
Definition XYZ.h:51
General purpose algebraic and geometric methods that are expected to be used by a wide variety of IMP...
VectorD< 3 > Vector3D
Definition VectorD.h:407
Basic functionality that is expected to be used by a wide variety of IMP users.
double get_distance(const Surface &s, const XYZR &d)
Get distance from sphere to surface.
Definition Surface.h:153
void setup_from_argv(int argc, char **argv, std::string description)
Parse the command line flags and return the positional arguments.