IMP  2.0.0
The Integrative Modeling Platform
IMP::core::RigidBody Class Reference

A decorator for a rigid body. More...

#include <IMP/core/rigid_bodies.h>

+ Inheritance diagram for IMP::core::RigidBody:

Public Member Functions

 RigidBody (Model *m, ParticleIndex id)
 
 RigidBody (::IMP::kernel::Particle *p)
 
void add_member (ParticleIndex p)
 
void add_non_rigid_member (ParticleIndex pi)
 
const ParticleIndexesget_body_member_particle_indexes () const
 
algebra::Vector3D get_coordinates () const
 Get the coordinates of the particle.
 
bool get_coordinates_are_optimized () const
 
const ParticleIndexesget_member_particle_indexes () const
 Return the members as particle pointers. More...
 
IMP::algebra::ReferenceFrame3D get_reference_frame () const
 Get the reference frame for the local coordinates.
 
algebra::VectorD< 4 > get_rotational_derivatives () const
 Get the derivatives of the quaternion.
 
algebra::Vector3D get_torque () const
 
void normalize_rotation ()
 Normalized the quaternion.
 
void set_coordinates_are_optimized (bool tf)
 Set whether the rigid body coordinates are optimized.
 
void set_is_rigid_member (ParticleIndex pi, bool tf)
 
void set_reference_frame (const IMP::algebra::ReferenceFrame3D &tr)
 Set the current reference frame. More...
 
void set_reference_frame_from_members (const ParticleIndexes &members)
 
void set_reference_frame_lazy (const IMP::algebra::ReferenceFrame3D &tr)
 Change the reference, delay updating the members until evaluate. More...
 
void show (std::ostream &out=std::cout) const
 
void update_members ()
 Update the coordinates of the members.
 
- Public Member Functions inherited from IMP::core::XYZ
 XYZ (Model *m, ParticleIndex id)
 
 XYZ (::IMP::kernel::Particle *p)
 
void add_to_derivative (int i, Float v, DerivativeAccumulator &d)
 Add something to the derivative of the ith coordinate.
 
void add_to_derivatives (const algebra::Vector3D &v, DerivativeAccumulator &d)
 Add something to the derivative of the coordinates.
 
Float get_coordinate (int i) const
 Get the ith coordinate.
 
const algebra::Vector3Dget_coordinates () const
 Convert it to a vector. More...
 
bool get_coordinates_are_optimized () const
 Get whether the coordinates are optimized. More...
 
Float get_derivative (int i) const
 Get the ith coordinate derivative.
 
algebra::Vector3D get_derivatives () const
 Get the vector of derivatives. More...
 
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::kernel::Decorator
ParticleIndex get_particle_index () const
 
Particleget_particle () const
 
Modelget_model () const
 Returns the Model containing the particle.
 
 Decorator (Particle *p)
 
 Decorator ()
 

Static Public Member Functions

static RigidBody decorate_particle (::IMP::kernel::Particle *p)
 
static bool particle_is_instance (Particle *p)
 Return true of the particle is a rigid body.
 
static bool particle_is_instance (Model *m, ParticleIndex pi)
 Return true of the particle is a rigid body.
 
static RigidBody setup_particle (Particle *p, const ParticlesTemp &ps)
 Create a new rigid body from a set of particles. More...
 
static RigidBody setup_particle (Particle *p, const algebra::ReferenceFrame3D &rf)
 
static void teardown_particle (RigidBody rb)
 Make the rigid body no longer rigid.
 
- Static Public Member Functions inherited from IMP::core::XYZ
static XYZ decorate_particle (::IMP::kernel::Particle *p)
 
static FloatKey get_coordinate_key (unsigned int i)
 
static const FloatKeysget_xyz_keys ()
 Get a vector containing the keys for x,y,z. More...
 
static bool particle_is_instance (Particle *p)
 
static bool particle_is_instance (Model *m, ParticleIndex pi)
 
static XYZ setup_particle (Model *m, ParticleIndex pi, const algebra::Vector3D v=algebra::Vector3D(0, 0, 0))
 
static XYZ setup_particle (Particle *p, const algebra::Vector3D v=algebra::Vector3D(0, 0, 0))
 
- Static Public Member Functions inherited from IMP::kernel::Decorator
static bool particle_is_instance (Particle *p)
 Return true if the particle can be cast to the decorator. More...
 

Related Functions

(Note that these are not member functions.)

IMP::core::RigidBody create_compatible_rigid_body (Hierarchy h, Hierarchy reference)
 Rigidify a molecule or collection of molecules. More...
 
IMP::core::RigidBody create_rigid_body (const Hierarchies &h, std::string name=std::string("created rigid body"))
 Rigidify a molecule or collection of molecules. More...
 
void transform (RigidBody a, const algebra::Transformation3D &tr)
 Transform a rigid body. More...
 

Additional Inherited Members

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

Detailed Description

A rigid body particle describes a set of particles, known as the members, which move rigidly together. The rigid body is represented as an algebra::ReferenceFrame3D coupled with local coordinates (RigidMember::get_internal_coordinates()) for the members expressed in that reference frame. The global coordinates of the members are accessed, as with other global coordinates, via the XYZ::get_coordinates().

Since the members are simply a set of particles which move together they don't (necessarily) define a shape. For example, the members of the rigid body made from a molecular hierarchy would include particles corresponding to intermediate levels of the hierarchy. As a result, methods that use rigid bodies usually should simply take the list of particles they are interested in and then check for rigid bodies internally.

The initial reference of the rigid body is computed from the coordinates, masses and radii of the particles passed to the constructor, based on diagonalizing the inertial tensor (which is not stored, currently).

RigidBodies can be nested (that is, a RigidBody can have another RigidBody as a member). This can be useful for organizational reasons as well as for accelerating computations since since operations are affected by the total number of children contained in the rigid body being operated on. Examples of this include collision detection where if you have multiple representations of geometry at different resolutions it is faster to put each of them in a separate rigid body and then creat one rigid body containing all of them.

It is often desirable to randomize the orientation of a rigid body:

1 ## \example core/randomize_rigid_body.py
2 ## This fragments shows how to either perturb or set the orientation of a rigid
3 ## body randomly.
4 
5 import IMP.core
6 import IMP.algebra
7 import IMP
8 from IMP.algebra import ReferenceFrame3D
9 from IMP.algebra import Transformation3D
10 
11 m = IMP.Model()
12 p = IMP.Particle(m)
13 rbd = IMP.core.RigidBody.setup_particle(p, ReferenceFrame3D())
14 translation=IMP.algebra.get_random_vector_in(IMP.algebra.get_unit_bounding_box_3d())
15 
16 # we don't yet have python code to generate a nearby rotation
18 transformation= Transformation3D(rotation, translation)
19 # Option 1:
20 # note, this overwrites the existing position
21 # The True is to transform the members now rather than wait for a
22 # score state
23 rbd.set_reference_frame(ReferenceFrame3D(transformation))
24 # Option 2:
25 # perturb the existing transformation
26 composed_tr = IMP.algebra.compose \
27  (rbd.get_reference_frame().get_transformation_to(),
28  transformation)
29 rbd.set_reference_frame(ReferenceFrame3D(composed_tr))
30 # Alternative to Option 2:
31 IMP.core.transform(rbd, transformation)
Note
The maintenance of the invariant is done by an associated IMP::Constraint. As a result, the state is only guaranteed to be correct either during model evaluation, or immediately following model evaluation before any particles have been changed.
See Also
RigidMember
RigidBodyMover
RigidClosePairsFinder
RigidBodyDistancePairScore

Definition at line 75 of file rigid_bodies.h.

Member Function Documentation

void IMP::core::RigidBody::add_member ( ParticleIndex  p)

Add a member, properly handle rigid bodies and XYZ particles.

Definition at line 259 of file rigid_bodies.h.

+ Here is the call graph for this function:

void IMP::core::RigidBody::add_non_rigid_member ( ParticleIndex  pi)

Add a NonRigidMember. Currently RigidBody non-rigid members are not handler properly.

const ParticleIndexes& IMP::core::RigidBody::get_member_particle_indexes ( ) const

This member function is here for efficiency.

Definition at line 95 of file rigid_bodies.h.

+ Here is the call graph for this function:

algebra::Vector3D IMP::core::RigidBody::get_torque ( ) const

The units are kCal/Mol/Radian

Definition at line 221 of file rigid_bodies.h.

+ Here is the call graph for this function:

void IMP::core::RigidBody::set_is_rigid_member ( ParticleIndex  pi,
bool  tf 
)

Set whether a particular member is a rigid member or a non-rigid member.

void IMP::core::RigidBody::set_reference_frame ( const IMP::algebra::ReferenceFrame3D tr)

All members of the rigid body will have their coordinates updated immediately.

See Also
IMP::core::transform(RigidBody,const algebra::Transformation3D&)
lazy_set_reference_frame()
void IMP::core::RigidBody::set_reference_frame_from_members ( const ParticleIndexes members)

Update the reference frame of the rigid body based on the current coordinates of the passed members (nonpassed members are ignored). This can be used to update the rigid body after new coordinates were loaded for the members. The members are passed explictily since, typically, some are desired to just move along with the newly loaded rigid body.

Note
This requires at least three members that are not collinear to work.
void IMP::core::RigidBody::set_reference_frame_lazy ( const IMP::algebra::ReferenceFrame3D tr)
static RigidBody IMP::core::RigidBody::setup_particle ( Particle p,
const ParticlesTemp &  ps 
)
static
Parameters
[in]pThe particle to make into a rigid body
[in]psThe particles to use as members of the rigid body

The initial position and orientation of p is computed, as are the relative positions of the member particles. The member particles do not already need to be RigidMember particles, only XYZ particles.

static RigidBody IMP::core::RigidBody::setup_particle ( Particle p,
const algebra::ReferenceFrame3D rf 
)
static

Set it up with the provided initial reference frame.

Friends And Related Function Documentation

IMP::core::RigidBody create_compatible_rigid_body ( Hierarchy  h,
Hierarchy  reference 
)
related

This method is identical to create_rigid_body() except that the chosen reference frame is aligned with that of reference (which must have exactly the same set of particles). This allows one to make sure the rigid body is equivalent when you have several copies of the same molecule.

IMP::core::RigidBody create_rigid_body ( const Hierarchies &  h,
std::string  name = std::string("created rigid body") 
)
related

The rigid body created has all the leaves as members and a member rigid body for each internal node in the tree. The particle created to be the rigid body is returned.

A name can be passed as it is not easy to automatically pick a decent name.

See Also
create_aligned_rigid_body()
void transform ( RigidBody  a,
const algebra::Transformation3D tr 
)
related

The transformation is applied current conformation of the rigid body, as opposed to replacing the current conformation, as in RigidBody::set_reference_frame().

algebra::Transformation3D

Definition at line 479 of file rigid_bodies.h.


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