IMP logo
IMP Reference Guide  develop.7482b7c7af, 2026/12/05
The Integrative Modeling Platform
XYZR_Decorator.py
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
6import IMP
7import IMP.core
8import IMP.algebra
9import sys
10
11IMP.setup_from_argv(sys.argv, "XYZR decorator example")
12
13m = IMP.Model()
14p0 = IMP.Particle(m)
17 1.0))
18p1 = IMP.Particle(m)
20d1.set_coordinates(IMP.algebra.Vector3D(3, 4, 5))
21d1.set_radius(2.0)
22
23print(IMP.core.get_distance(d0, d1))
24
25# use them as XYZ particles
26xd0 = IMP.core.XYZ(p0)
27xd1 = IMP.core.XYZ(p1)
28
29# distance without radii
30print(IMP.core.get_distance(xd0, xd1))
Class for storing model, its restraints, constraints, and particles.
Definition Model.h:111
Class to handle individual particles of a Model object.
Definition Particle.h:45
static XYZR setup_particle(Model *m, ParticleIndex pi)
Definition XYZR.h:48
A decorator for a particle with x,y,z coordinates.
Definition XYZ.h:30
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.