A simple example illustrating some of the functionality.
import IMP import IMP.core import IMP.algebra m= IMP.Model() p0= IMP.Particle(m) d0= IMP.core.XYZR.setup_particle(p0, IMP.algebra.Sphere3D(IMP.algebra.Vector3D(0,1,2), 1.0)) p1= IMP.Particle(m) d1= IMP.core.XYZR.setup_particle(p1) 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.decorate_particle(p0) xd1= IMP.core.XYZ.decorate_particle(p1) # distance without radii print IMP.core.get_distance(xd0, xd1)
Public Member Functions | |
void | add_to_radius_derivative (double v, DerivativeAccumulator &d) |
Float | get_radius () const |
const FloatKey & | get_radius_key () const |
algebra::SphereD< 3 > | get_sphere () const |
Return a sphere object. | |
void | set_radius (Float t) |
void | set_sphere (const algebra::SphereD< 3 > &s) |
Set the attributes from a sphere. | |
XYZR (::IMP::Particle *p, const FloatKey &tr=get_default_radius_key()) | |
Static Public Member Functions | |
static XYZR | decorate_particle (::IMP::Particle *p, const FloatKey &tr=get_default_radius_key()) |
static FloatKey | get_default_radius_key () |
Get the default radius key. | |
static bool | particle_is_instance (Particle *p, FloatKey radius_key=get_default_radius_key()) |
Check if the particle has the required attributes. | |
static XYZR | setup_particle (Particle *p, const algebra::SphereD< 3 > &s, FloatKey radius_key=get_default_radius_key()) |
static XYZR | setup_particle (Particle *p, Float radius, FloatKey radius_key=get_default_radius_key()) |
static XYZR | setup_particle (Particle *p, FloatKey radius_key=get_default_radius_key()) |
Related Functions | |
(Note that these are not member functions.) | |
XYZRs | create_xyzr_particles (Model *m, unsigned int num, Float radius, Float box_side=10) |
Create a set of particles which random coordinates. | |
double | get_distance (XYZR a, XYZR b) |
Compute the distance between a pair of particles. | |
algebra::SphereD< 3 > | get_enclosing_sphere (const XYZsTemp &v, FloatKey rk=XYZR::get_default_radius_key()) |
Get a sphere enclosing the set of XYZRs. | |
void | set_enclosing_radius (XYZR b, const XYZsTemp &v) |
Set the radius of the first to enclose the list. | |
void | set_enclosing_sphere (XYZR b, const XYZsTemp &v, double slack=0) |
Set the coordinates and radius of the first to enclose the list. |
static XYZR IMP::core::XYZR::setup_particle | ( | Particle * | p, | |
const algebra::SphereD< 3 > & | s, | |||
FloatKey | radius_key = get_default_radius_key() | |||
) | [static] |
Create a decorator using radius_key to store the FloatKey.
[in] | p | The particle to wrap. |
[in] | s | The sphere to use to set the position and radius |
[in] | radius_key | The (optional) key name to use. The default is "radius". |
static XYZR IMP::core::XYZR::setup_particle | ( | Particle * | p, | |
FloatKey | radius_key = get_default_radius_key() | |||
) | [static] |
Create a decorator using radius_key to store the FloatKey.
[in] | p | The particle to wrap. |
[in] | radius_key | The (optional) key name to use. The default is "radius". |
XYZRs create_xyzr_particles | ( | Model * | m, | |
unsigned int | num, | |||
Float | radius, | |||
Float | box_side = 10 | |||
) | [related] |
Create a set of particles which random coordinates.
This function is mostly to be used to keep demo code brief.
[in] | m | The model to add them to. |
[in] | num | The number of particles to create. |
[in] | radius | The radius to give them. |
[in] | box_side | The particles have coordinates from -box_side to box_side. |
algebra::SphereD< 3 > get_enclosing_sphere | ( | const XYZsTemp & | v, | |
FloatKey | rk = XYZR::get_default_radius_key() | |||
) | [related] |
Get a sphere enclosing the set of XYZRs.
[in] | v | The one whose radius should be set |
[in] | rk | The radius key to use Any particle which does not have the attribute b.get_radius() is assumed to have a radius of 0. |
Set the coordinates and radius of the first to enclose the list.
[in] | v | The vector of XYZ or XYZR particles to enclose |
[out] | b | The one whose values should be set |
[in] | slack | An amount to add to the radius. Any particle which does not have the attribute b.get_radius() is assumed to have a radius of 0. |