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).

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: rigid bodies, rigid collisions, randomize rigid body, analyze convergence

Inheritance diagram for IMP::core::RigidBody:

Public Member Functions

 RigidBody (::IMP::Particle *p)
void add_member (XYZ d)
 Add a particle as a member.
void add_member (RigidBody o)
 Add another rigid body.
algebra::VectorD< 3 > get_coordinates () const
 Get the coordinates of the particle.
bool get_coordinates_are_optimized () const
RigidMember get_member (unsigned int i) const
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 RigidBody setup_particle (Particle *p, const RigidBodies &o)
static RigidBody setup_particle (Particle *p, RigidBody other, const RigidMembers &members)
 Create a rigid body based on members of another one.
static RigidBody setup_particle (Particle *p, const XYZs &members, const algebra::ReferenceFrame3D &reference_frame)
 Create a new rigid body from a set of particles, specifying the frame.
static RigidBody setup_particle (Particle *p, const XYZs &members)
 Create a new rigid body from a set of particles.
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 ( RigidBody  o)

Add another rigid body.

Rigid bodies can be tied together so that one updates the other.

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,
RigidBody  other,
const RigidMembers &  members 
) [static]

Create a rigid body based on members of another one.

This function creates a rigid body that is part of another one. The member particles passed must be part of the other rigid body and the created rigid body is added to that one as a member. The purpose of this method is to, for example, define a rigid body for part of a large molecule that is also rigid.

The passed members do not become members of this rigid body, as there would be no point.

static RigidBody IMP::core::RigidBody::setup_particle ( Particle p,
const XYZs &  members 
) [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 XYZs &  members,
const algebra::ReferenceFrame3D reference_frame 
) [static]

Create a new rigid body from a set of particles, specifying the frame.

Parameters:
[in]pThe particle to make into a rigid body
[in]membersThe particles to use as members of the rigid body
[in]reference_frameThe reference frame to use

The member particles do not already need to be RigidMember particles, only XYZ particles.

static RigidBody IMP::core::RigidBody::setup_particle ( Particle p,
const RigidBodies &  o 
) [static]

Merge several rigid bodies into on.


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.

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 Thu Mar 24 2011 02:01:46 for IMP by doxygen 1.7.3