IMP logo
IMP Reference Guide  develop.7482b7c7af, 2026/12/05
The Integrative Modeling Platform
IMP::atom::CenterOfMass Class Reference

A particle that is the center of mass of other particles. More...

#include <IMP/atom/CenterOfMass.h>

Inheritance diagram for IMP::atom::CenterOfMass:

Detailed Description

A particle that is the center of mass of other particles.

A decorator which constrains a particle to be the center of mass of a set of other particles, and whose mass is the sum of their masses. The c.o.m. is updated before model evaluation and its derivatives are copied to its children, using a constraint that is created at setup time. The derivatives propagated to each particle are scaled based on its mass relative to the total mass.

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.

Definition at line 33 of file CenterOfMass.h.

Public Member Functions

 CenterOfMass (::IMP::Model *m, ::IMP::ParticleIndex id)
 CenterOfMass (const IMP::ParticleAdaptor &d)
Constraint * get_constraint () const
Float get_coordinate (int i) const
const algebra::Vector3D & get_coordinates () const
Float get_mass () const
void show (std::ostream &out=std::cout) const
Public Member Functions inherited from IMP::Decorator
bool get_is_valid () const
 Returns true if constructed with a non-default constructor.
Model * get_model () const
 Returns the Model containing the particle.
Particle * get_particle () const
 Returns the particle decorated by this decorator.
ParticleIndex get_particle_index () const
 Returns the particle index decorated by this decorator.
 operator Particle * () const
 operator ParticleIndex () const
Particle * operator-> () const

Static Public Member Functions

static bool get_is_setup (const IMP::ParticleAdaptor &p)
static bool get_is_setup (Model *m, ParticleIndex pi)
static CenterOfMass setup_particle (IMP::ParticleAdaptor pa, ParticleIndexesAdaptor members)
static CenterOfMass setup_particle (IMP::ParticleAdaptor pa, Refiner *refiner)
static CenterOfMass setup_particle (Model *m, ParticleIndex pi, ParticleIndexesAdaptor members)
static CenterOfMass setup_particle (Model *m, ParticleIndex pi, Refiner *refiner)
static void teardown_particle (CenterOfMass com)
 Make the particle no longer a center of mass.

Additional Inherited Members

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

Constructor & Destructor Documentation

◆ CenterOfMass() [1/3]

IMP::atom::CenterOfMass::CenterOfMass ( )

Definition at line 71 of file CenterOfMass.h.

◆ CenterOfMass() [2/3]

IMP::atom::CenterOfMass::CenterOfMass ( ::IMP::Model * m,
::IMP::ParticleIndex id )

Definition at line 71 of file CenterOfMass.h.

◆ CenterOfMass() [3/3]

IMP::atom::CenterOfMass::CenterOfMass ( const IMP::ParticleAdaptor & d)
explicit

Definition at line 71 of file CenterOfMass.h.

Member Function Documentation

◆ get_constraint()

Constraint * IMP::atom::CenterOfMass::get_constraint ( ) const

Definition at line 34 of file CenterOfMass.h.

◆ get_coordinate()

Float IMP::atom::CenterOfMass::get_coordinate ( int i) const

Definition at line 59 of file CenterOfMass.h.

◆ get_coordinates()

const algebra::Vector3D & IMP::atom::CenterOfMass::get_coordinates ( ) const

Definition at line 64 of file CenterOfMass.h.

◆ get_is_setup() [1/2]

bool IMP::atom::CenterOfMass::get_is_setup ( const IMP::ParticleAdaptor & p)
static

Definition at line 71 of file CenterOfMass.h.

◆ get_is_setup() [2/2]

bool IMP::atom::CenterOfMass::get_is_setup ( Model * m,
ParticleIndex pi )
static

Definition at line 98 of file CenterOfMass.h.

◆ get_mass()

Float IMP::atom::CenterOfMass::get_mass ( ) const

Definition at line 54 of file CenterOfMass.h.

◆ setup_particle() [1/4]

CenterOfMass IMP::atom::CenterOfMass::setup_particle ( IMP::ParticleAdaptor pa,
ParticleIndexesAdaptor members )
static
Returns
a CenterOfMass object that decorates the particle specified by pa
See also
setup_particle(m, pi, members)

Definition at line 81 of file CenterOfMass.h.

◆ setup_particle() [2/4]

CenterOfMass IMP::atom::CenterOfMass::setup_particle ( IMP::ParticleAdaptor pa,
Refiner * refiner )
static
Returns
a CenterOfMass object that decorates the particle specified by pa
See also
setup_particle(m, pi, refiner)

Definition at line 93 of file CenterOfMass.h.

◆ setup_particle() [3/4]

CenterOfMass IMP::atom::CenterOfMass::setup_particle ( Model * m,
ParticleIndex pi,
ParticleIndexesAdaptor members )
static

Sets up CenterOfMass over members, and constrains CenterOfMass to be computed before model evaluation and to propagate derivatives following model evaluation.

pi is decorated with core::XYZ and atom::Mass decorators, its coordinates are set to the current center of mass of pis, and its mass is set to the sum of their masses.

Returns
a CenterOfMass object that decorates particle pi

Definition at line 81 of file CenterOfMass.h.

◆ setup_particle() [4/4]

CenterOfMass IMP::atom::CenterOfMass::setup_particle ( Model * m,
ParticleIndex pi,
Refiner * refiner )
static

Sets up CenterOfMass over particles passed by applying the refiner over the particle pi, and constrains CenterOfMass to be computed before model evaluation and to propagate derivatives following model evaluation.

pi is decorated with the core::XYZ and atom::Mass decorators, its coordinates are set to the current center of mass of refiner->get_refined_indexes(m, pi), and its mass is set to the sum of their masses.

Returns
a CenterOfMass object that decorates particle pi

Definition at line 93 of file CenterOfMass.h.

◆ teardown_particle()

void IMP::atom::CenterOfMass::teardown_particle ( CenterOfMass com)
static

Make the particle no longer a center of mass.


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