IMP logo
IMP Reference Guide  develop.7482b7c7af, 2026/12/05
The Integrative Modeling Platform

A decorator for a particle with x,y,z coordinates and a radius. More...

#include <IMP/core/XYZR.h>

Inheritance diagram for IMP::core::XYZR:

Detailed Description

A decorator for a particle with x,y,z coordinates and a radius.

A simple example illustrating some of the functionality.

## \example core/XYZR_Decorator.py
# This is a simple example using the XYZRDecorator to set the coordinates
# and radius of a particle and compute distances between the resulting
# spheres.
import IMP
import IMP.core
import sys
IMP.setup_from_argv(sys.argv, "XYZR decorator example")
m = IMP.Model()
p0 = IMP.Particle(m)
1.0))
p1 = IMP.Particle(m)
d1.set_coordinates(IMP.algebra.Vector3D(3, 4, 5))
d1.set_radius(2.0)
print(IMP.core.get_distance(d0, d1))
# use them as XYZ particles
xd0 = IMP.core.XYZ(p0)
xd1 = IMP.core.XYZ(p1)
# distance without radii
print(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.

Definition at line 27 of file XYZR.h.

Public Member Functions

 XYZR (::IMP::Model *m, ::IMP::ParticleIndex id)
 XYZR (const IMP::ParticleAdaptor &d)
void add_to_radius_derivative (double v, DerivativeAccumulator &d)
 add v to the derivative of the radius attribute
double get_radius () const
const algebra::Sphere3D & get_sphere () const
 Return a sphere object.
void set_radius (double r) const
void set_sphere (const algebra::Sphere3D &s)
 Set the attributes from a sphere.
void show (std::ostream &out=std::cout) const
Public Member Functions inherited from IMP::core::XYZ
 XYZ (::IMP::Model *m, ::IMP::ParticleIndex id)
 XYZ (const IMP::ParticleAdaptor &d)
void add_to_derivative (int i, Float v, DerivativeAccumulator &d)
void add_to_derivatives (const algebra::Vector3D &v, DerivativeAccumulator &d)
 Add the vector v to the derivative vector of the x,y,z coordinates.
Float get_coordinate (int i) const
 Get the ith coordinate.
const algebra::Vector3D & get_coordinates () const
 Convert it to a vector.
bool get_coordinates_are_optimized () const
 Get whether the coordinates are optimized.
Float get_derivative (int i) const
algebra::Vector3D get_derivatives () const
 Get the vector of derivatives accumulated by add_to_derivatives().
algebra::Vector3D get_vector_to (const XYZ &b) const
 Get the vector from this particle to another.
Float get_x () const
Float get_y () const
Float get_z () const
void set_coordinate (unsigned int i, Float v)
 set the ith coordinate
void set_coordinates (const algebra::Vector3D &v)
 set all coordinates from a vector
void set_coordinates_are_optimized (bool tf) const
 Set whether the coordinates are optimized.
void set_x (Float t)
void set_y (Float t)
void set_z (Float t)
void show (std::ostream &out=std::cout) const
Public Member Functions inherited from IMP::Decorator
bool get_is_valid () const
 Returns true if constructed with a non-default constructor.
Model * get_model () const
 Returns the Model containing the particle.
Particle * get_particle () const
 Returns the particle decorated by this decorator.
ParticleIndex get_particle_index () const
 Returns the particle index decorated by this decorator.
 operator Particle * () const
 operator ParticleIndex () const
Particle * operator-> () const

Static Public Member Functions

static bool get_is_setup (const IMP::ParticleAdaptor &p)
static bool get_is_setup (Model *m, ParticleIndex pi)
 Check if the particle has the required attributes.
static FloatKey get_radius_key ()
 Get the key for the radius.
static XYZR setup_particle (IMP::ParticleAdaptor pa)
static XYZR setup_particle (IMP::ParticleAdaptor pa, algebra::Sphere3D ball)
static XYZR setup_particle (IMP::ParticleAdaptor pa, Float radius)
static XYZR setup_particle (Model *m, ParticleIndex pi)
static XYZR setup_particle (Model *m, ParticleIndex pi, algebra::Sphere3D ball)
static XYZR setup_particle (Model *m, ParticleIndex pi, Float radius)
Static Public Member Functions inherited from IMP::core::XYZ
static FloatKey get_coordinate_key (unsigned int i)
static bool get_is_setup (const IMP::ParticleAdaptor &p)
static bool get_is_setup (Model *m, ParticleIndex pi)
static const FloatKeys & get_xyz_keys ()
 Get a vector containing the keys for x,y,z.
static XYZ setup_particle (IMP::ParticleAdaptor pa)
static XYZ setup_particle (IMP::ParticleAdaptor pa, algebra::Vector3D v)
static XYZ setup_particle (Model *m, ParticleIndex pi)
static XYZ setup_particle (Model *m, ParticleIndex pi, algebra::Vector3D v)

Additional Inherited Members

Protected Member Functions inherited from IMP::Decorator
 Decorator (Model *m, ParticleIndex pi)
 Decorator (ParticleAdaptor p)

Constructor & Destructor Documentation

◆ XYZR() [1/3]

IMP::core::XYZR::XYZR ( )

Definition at line 47 of file XYZR.h.

◆ XYZR() [2/3]

IMP::core::XYZR::XYZR ( ::IMP::Model * m,
::IMP::ParticleIndex id )

Definition at line 47 of file XYZR.h.

◆ XYZR() [3/3]

IMP::core::XYZR::XYZR ( const IMP::ParticleAdaptor & d)
explicit

Definition at line 47 of file XYZR.h.

Member Function Documentation

◆ add_to_radius_derivative()

void IMP::core::XYZR::add_to_radius_derivative ( double v,
DerivativeAccumulator & d )

add v to the derivative of the radius attribute

Definition at line 79 of file XYZR.h.

Here is the call graph for this function:

◆ get_is_setup() [1/2]

bool IMP::core::XYZR::get_is_setup ( const IMP::ParticleAdaptor & p)
static

Definition at line 47 of file XYZR.h.

◆ get_is_setup() [2/2]

bool IMP::core::XYZR::get_is_setup ( Model * m,
ParticleIndex pi )
static

Check if the particle has the required attributes.

Add the coordinates and radius from the sphere to the particle.

Definition at line 57 of file XYZR.h.

Here is the call graph for this function:

◆ get_radius()

double IMP::core::XYZR::get_radius ( ) const

Definition at line 61 of file XYZR.h.

◆ get_radius_key()

FloatKey IMP::core::XYZR::get_radius_key ( )
static

Get the key for the radius.

Definition at line 76 of file XYZR.h.

◆ get_sphere()

const algebra::Sphere3D & IMP::core::XYZR::get_sphere ( ) const

Return a sphere object.

Definition at line 67 of file XYZR.h.

Here is the call graph for this function:

◆ set_radius()

void IMP::core::XYZR::set_radius ( double r) const

Definition at line 62 of file XYZR.h.

◆ set_sphere()

void IMP::core::XYZR::set_sphere ( const algebra::Sphere3D & s)

Set the attributes from a sphere.

Definition at line 72 of file XYZR.h.

Here is the call graph for this function:

◆ setup_particle() [1/6]

XYZR IMP::core::XYZR::setup_particle ( IMP::ParticleAdaptor pa)
static
Returns
a XYZR object that decorates the particle specified by pa
See also
setup_particle(m, p)

Definition at line 48 of file XYZR.h.

◆ setup_particle() [2/6]

XYZR IMP::core::XYZR::setup_particle ( IMP::ParticleAdaptor pa,
algebra::Sphere3D ball )
static
Returns
a XYZR object that decorates the particle specified by pa
See also
setup_particle(m, pi, ball)

Definition at line 51 of file XYZR.h.

◆ setup_particle() [3/6]

XYZR IMP::core::XYZR::setup_particle ( IMP::ParticleAdaptor pa,
Float radius )
static
Returns
a XYZR object that decorates the particle specified by pa
See also
setup_particle(m, pi, radius)

Definition at line 50 of file XYZR.h.

◆ setup_particle() [4/6]

XYZR IMP::core::XYZR::setup_particle ( Model * m,
ParticleIndex pi )
static
Returns
a XYZR object that decorates particle pi

Definition at line 48 of file XYZR.h.

◆ setup_particle() [5/6]

XYZR IMP::core::XYZR::setup_particle ( Model * m,
ParticleIndex pi,
algebra::Sphere3D ball )
static
Returns
a XYZR object that decorates particle pi

Definition at line 51 of file XYZR.h.

◆ setup_particle() [6/6]

XYZR IMP::core::XYZR::setup_particle ( Model * m,
ParticleIndex pi,
Float radius )
static

Setup an XYZ particle as an XYZR particle.

Returns
a XYZR object that decorates particle pi

Definition at line 50 of file XYZR.h.


The documentation for this class was generated from the following file: