home
about
news
download
doc
source
systems
tests
bugs
contact
IMP Reference Guide
2.8.0
The Integrative Modeling Platform
IMP Manual
Reference Guide
Modules
Classes
Examples
doc
examples
core
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
6
import
IMP
7
import
IMP.core
8
import
IMP.algebra
9
import
sys
10
11
IMP.setup_from_argv
(sys.argv,
"XYZR decorator example"
)
12
13
m =
IMP.Model
()
14
p0 =
IMP.Particle
(m)
15
d0 =
IMP.core.XYZR.setup_particle
(
16
p0,
IMP.algebra.Sphere3D
(
IMP.algebra.Vector3D
(0, 1, 2),
17
1.0))
18
p1 =
IMP.Particle
(m)
19
d1 =
IMP.core.XYZR.setup_particle
(p1)
20
d1.set_coordinates(
IMP.algebra.Vector3D
(3, 4, 5))
21
d1.set_radius(2.0)
22
23
print(
IMP.core.get_distance
(d0, d1))
24
25
# use them as XYZ particles
26
xd0 =
IMP.core.XYZ
(p0)
27
xd1 =
IMP.core.XYZ
(p1)
28
29
# distance without radii
30
print(
IMP.core.get_distance
(xd0, xd1))
IMP::setup_from_argv
Strings setup_from_argv(const Strings &argv, std::string description, std::string positional_description, int num_positional)
IMP::core::XYZR::setup_particle
static XYZR setup_particle(Model *m, ParticleIndex pi)
Definition:
XYZR.h:48
IMP::core::get_distance
double get_distance(XYZR a, XYZR b)
Compute the sphere distance between a and b.
Definition:
XYZR.h:89
IMP::Model
Class for storing model, its restraints, constraints, and particles.
Definition:
Model.h:72
IMP::core::XYZ
A decorator for a particle with x,y,z coordinates.
Definition:
XYZ.h:30
IMP::core
Basic functionality that is expected to be used by a wide variety of IMP users.
IMP::algebra
General purpose algebraic and geometric methods that are expected to be used by a wide variety of IMP...
IMP::algebra::Vector3D
VectorD< 3 > Vector3D
Definition:
VectorD.h:395
IMP::Particle
Class to handle individual particles of a Model object.
Definition:
Particle.h:41
IMP::algebra::SphereD< 3 >