IMP logo
Public Member Functions | Static Public Member Functions | Related Functions
IMP::core::RigidBody Class Reference

Detailed Description

A decorator for a rigid body.

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_local_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 also take a Refiner to map from the rigid body to the set of particles defining the geometry of interest.

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:

# Assume p is a RigidBody Particle
rbd= IMP.core.RigidBody(p)
translation=IMP.algebra.get_random_vector_in(IMP.algebra.Vector3D(0,0,0),
                                                 10.0)
# we don't yet have python code to generate a nearby rotation
rotation= IMP.algebra.get_random_rotation_3d()
transformation= IMP.algebra.Transformation3D(rotation, translation)
# note, this overwrites the existing position
# The True is to transform the members now rather than wait for a
# score state
rbd.set_transformation(transformation)
# to instead perturb the existing transformation instead do
rbd.set_transformation(IMP.algebra.compose(rbd.get_transformation(),
                                                           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

Examples: randomize rigid body, rigid collisions, dock with crosslinks, rigid brownian dynamics, analyze convergence

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

List of all members.

Public Member Functions

 RigidBody (Model *m, ParticleIndex id)
 RigidBody (::IMP::Particle *p)
void add_member (Particle *p)
const ParticleIndexes & get_body_member_particle_indexes () const
algebra::Vector3D get_coordinates () const
 Get the coordinates of the particle.
bool get_coordinates_are_optimized () const
 Get whether the coordinates are optimized.
RigidMember get_member (unsigned int i) const
const ParticleIndexes & get_member_particle_indexes () const
 Return the members as particle pointers.
RigidMembers get_members () const
unsigned int get_number_of_members () const
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.
void normalize_rotation ()
 Normalized the quaternion.
void set_coordinates_are_optimized (bool tf)
 Set whether the rigid body coordinates are optimized.
void set_reference_frame (const IMP::algebra::ReferenceFrame3D &tr)
 Set the current reference frame.
void set_reference_frame_lazy (const IMP::algebra::ReferenceFrame3D &tr)
 Change the reference, delay updating the members until evaluate.
void update_members ()
 Update the coordinates of the members.

Static Public Member Functions

static RigidBody decorate_particle (::IMP::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.
static RigidBody setup_particle (Particle *p, const algebra::ReferenceFrame3D &rf)
static void teardown_particle (RigidBody rb)
 Make the rigid body no longer rigid.

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.
IMP::core::RigidBody create_rigid_body (const Hierarchies &h, std::string name=std::string("created rigid body"))
 Rigidify a molecule or collection of molecules.
void transform (RigidBody a, const algebra::Transformation3D &tr)
 Transform a rigid body.

Member Function Documentation

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

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

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

Get the coordinates of the particle.

Reimplemented from IMP::core::XYZ.

bool IMP::core::RigidBody::get_coordinates_are_optimized ( ) const

Get whether the coordinates are optimized.

Returns:
true only if all of them are optimized.

Reimplemented from IMP::core::XYZ.

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

Return the members as particle pointers.

This member function is here for efficiency.

IMP::algebra::ReferenceFrame3D IMP::core::RigidBody::get_reference_frame ( ) const

Get the reference frame for the local coordinates.

algebra::VectorD<4> IMP::core::RigidBody::get_rotational_derivatives ( ) const

Get the derivatives of the quaternion.

void IMP::core::RigidBody::normalize_rotation ( )

Normalized the quaternion.

static bool IMP::core::RigidBody::particle_is_instance ( Particle p) [static]

Return true of the particle is a rigid body.

Reimplemented from IMP::core::XYZ.

static bool IMP::core::RigidBody::particle_is_instance ( Model m,
ParticleIndex  pi 
) [static]

Return true of the particle is a rigid body.

Reimplemented from IMP::core::XYZ.

void IMP::core::RigidBody::set_coordinates_are_optimized ( bool  tf)

Set whether the rigid body coordinates are optimized.

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

Set the current reference frame.

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_lazy ( const IMP::algebra::ReferenceFrame3D tr)

Change the reference, delay updating the members until evaluate.

See set_transformation()

static RigidBody IMP::core::RigidBody::setup_particle ( Particle p,
const ParticlesTemp &  ps 
) [static]

Create a new rigid body from a set of particles.

Parameters:
[in]pThe particle to make into a rigid body
[in]membersThe 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.

static void IMP::core::RigidBody::teardown_particle ( RigidBody  rb) [static]

Make the rigid body no longer rigid.

void IMP::core::RigidBody::update_members ( )

Update the coordinates of the members.


Friends And Related Function Documentation

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

Rigidify a molecule or collection of molecules.

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]

Rigidify a molecule or collection of molecules.

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]

Transform a rigid body.

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

algebra::Transformation3D


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

Generated on Fri Feb 10 2012 23:36:26 for IMP by doxygen 1.7.5.1