IMP logo

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

A rigid body stores the a set of local coordinates for each member and an algebra::Transformation3D mapping between the local coordinates and the actual location of the member.

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.random_rotation()
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, True)
# 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

Inheritance diagram for IMP::core::RigidBody:

Inheritance graph
[legend]

Public Member Functions

void add_member (RigidBody o)
 Add another rigid body.
void add_member (XYZ d)
 Add a particle as a member.
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
algebra::VectorD< 4 > get_rotational_derivatives () const
 Get the derivatives of the quaternion.
IMP::algebra::Transformation3D get_transformation () const
 Get the transformation implied by the rigid body.
void lazy_set_transformation (const IMP::algebra::Transformation3D &tr)
 Change the transformation, delay updating the members until evaluate.
void normalize_rotation ()
 Normalized the quaternion.
 RigidBody (::IMP::Particle *p)
void set_coordinates_are_optimized (bool tf)
 Set whether the rigid body coordinates are optimized.
void set_transformation (const IMP::algebra::Transformation3D &tr)
 Set the current orientation and translation.
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 RigidMembers &members)
 Create a rigid body based on members of another one.
static RigidBody setup_particle (Particle *p, const XYZs &members)
 Create a new rigid body from a set of particles.

Related Functions

(Note that these are not member functions.)

IMP::core::RigidBody setup_as_rigid_body (Hierarchy h)
 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::lazy_set_transformation ( const IMP::algebra::Transformation3D tr  ) 

Change the transformation, delay updating the members until evaluate.

See set_transformation()

void IMP::core::RigidBody::set_transformation ( const IMP::algebra::Transformation3D tr  ) 

Set the current orientation and translation.

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

See also:
IMP::core::transform(RigidBody,const algebra::Transformation3D&)

lazy_set_transformation()

static RigidBody IMP::core::RigidBody::setup_particle ( Particle p,
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 same 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] p The particle to make into a rigid body
[in] members The 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.


Friends And Related Function Documentation

IMP::core::RigidBody setup_as_rigid_body ( Hierarchy  h  )  [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.

Note:
any existing coordinates and radii for internal nodes are overwritten.

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 Mon Mar 8 23:08:57 2010 for IMP by doxygen 1.5.8