OpenMD  2.5
Molecular Dynamics in the Open
OpenMD::RigidBody Class Reference

#include <RigidBody.hpp>

Inheritance diagram for OpenMD::RigidBody:
OpenMD::StuntDouble

Public Types

typedef std::vector< Atom * >::iterator AtomIterator
 
- Public Types inherited from OpenMD::StuntDouble
enum  ObjectType { otAtom, otDAtom, otRigidBody }
 

Public Member Functions

 RigidBody ()
 
virtual std::string getType ()
 
virtual void setType (const std::string &name)
 
virtual void setPrevA (const RotMat3x3d &a)
 
virtual void setA (const RotMat3x3d &a)
 
virtual void setA (const RotMat3x3d &a, int snapshotNo)
 
virtual Mat3x3d getI ()
 
virtual std::vector< RealType > getGrad ()
 
virtual void accept (BaseVisitor *v)
 
void addAtom (Atom *at, AtomStamp *ats)
 
void calcRefCoords ()
 
void calcForcesAndTorques ()
 
Mat3x3d calcForcesAndTorquesAndVirial ()
 
void updateAtoms ()
 
void updateAtoms (int frame)
 
void updateAtomVel ()
 
void updateAtomVel (int frame)
 
AtombeginAtom (std::vector< Atom *>::iterator &i)
 
AtomnextAtom (std::vector< Atom *>::iterator &i)
 
std::vector< Atom * >::iterator getBeginAtomIter ()
 
std::vector< Atom * >::iterator getEndAtomIter ()
 
std::vector< Atom * > getAtoms ()
 
int getNumAtoms ()
 
bool getAtomPos (Vector3d &pos, unsigned int index)
 
bool getAtomPos (Vector3d &pos, Atom *atom)
 
bool getAtomVel (Vector3d &vel, unsigned int index)
 
bool getAtomVel (Vector3d &vel, Atom *)
 
bool getAtomRefCoor (Vector3d &coor, unsigned int index)
 
bool getAtomRefCoor (Vector3d &coor, Atom *atom)
 
- Public Member Functions inherited from OpenMD::StuntDouble
virtual ~StuntDouble ()
 
int getGlobalIndex ()
 
void setGlobalIndex (int index)
 
int getLocalIndex ()
 
void setLocalIndex (int index)
 
int getGlobalIntegrableObjectIndex ()
 
void setGlobalIntegrableObjectIndex (int index)
 
void setSnapshotManager (SnapshotManager *sman)
 
bool isAtom ()
 
bool isDirectionalAtom ()
 
bool isRigidBody ()
 
bool isDirectional ()
 
int freeze ()
 
Vector3d getPrevPos ()
 
Vector3d getPos ()
 
Vector3d getPos (int snapshotNo)
 
void setPrevPos (const Vector3d &pos)
 
void setPos (const Vector3d &pos)
 
void setPos (const Vector3d &pos, int snapshotNo)
 
Vector3d getPrevVel ()
 
Vector3d getVel ()
 
Vector3d getVel (int snapshotNo)
 
void setPrevVel (const Vector3d &vel)
 
void setVel (const Vector3d &vel)
 
void setVel (const Vector3d &vel, int snapshotNo)
 
RotMat3x3d getPrevA ()
 
RotMat3x3d getA ()
 
RotMat3x3d getA (int snapshotNo)
 
Vector3d getPrevJ ()
 
Vector3d getJ ()
 
Vector3d getJ (int snapshotNo)
 
void setPrevJ (const Vector3d &angMom)
 
void setJ (const Vector3d &angMom)
 
void setJ (const Vector3d &angMom, int snapshotNo)
 
Vector3d getCOM ()
 
Vector3d getCOMvel ()
 
Vector3d getCOMw ()
 
Vector3d getCOM (int snapshotNo)
 
Vector3d getCOMvel (int snapshotNo)
 
Vector3d getCOMw (int snapshotNo)
 
Quat4d getPrevQ ()
 
Quat4d getQ ()
 
Quat4d getQ (int snapshotNo)
 
void setPrevQ (const Quat4d &q)
 
void setQ (const Quat4d &q)
 
void setQ (const Quat4d &q, int snapshotNo)
 
Vector3d getPrevEuler ()
 
Vector3d getEuler ()
 
Vector3d getEuler (int snapshotNo)
 
void setPrevEuler (const Vector3d &euler)
 
void setEuler (const Vector3d &euler)
 
void setEuler (const Vector3d &euler, int snapshotNo)
 
Vector3d getPrevDipole ()
 
Vector3d getDipole ()
 
Vector3d getDipole (int snapshotNo)
 
Mat3x3d getPrevQuadrupole ()
 
Mat3x3d getQuadrupole ()
 
Mat3x3d getQuadrupole (int snapshotNo)
 
Vector3d getPrevFrc ()
 
Vector3d getFrc ()
 
Vector3d getFrc (int snapshotNo)
 
void setPrevFrc (const Vector3d &frc)
 
void setFrc (const Vector3d &frc)
 
void setFrc (const Vector3d &frc, int snapshotNo)
 
void addPrevFrc (const Vector3d &frc)
 
void addFrc (const Vector3d &frc)
 
void addFrc (const Vector3d &frc, int snapshotNo)
 
Vector3d getPrevTrq ()
 
Vector3d getTrq ()
 
Vector3d getTrq (int snapshotNo)
 
void setPrevTrq (const Vector3d &trq)
 
void setTrq (const Vector3d &trq)
 
void setTrq (const Vector3d &trq, int snapshotNo)
 
void addPrevTrq (const Vector3d &trq)
 
void addTrq (const Vector3d &trq)
 
void addTrq (const Vector3d &trq, int snapshotNo)
 
RealType getPrevParticlePot ()
 
RealType getParticlePot ()
 
RealType getParticlePot (int snapshotNo)
 
void setPrevParticlePot (const RealType &particlePot)
 
void setParticlePot (const RealType &particlePot)
 
void setParticlePot (const RealType &particlePot, int snapshotNo)
 
void addPrevParticlePot (const RealType &particlePot)
 
void addParticlePot (const RealType &particlePot)
 
void addParticlePot (const RealType &particlePot, int snapshotNo)
 
RealType getPrevFlucQPos ()
 
RealType getFlucQPos ()
 
RealType getFlucQPos (int snapshotNo)
 
void setPrevFlucQPos (RealType charge)
 
void setFlucQPos (RealType charge)
 
void setFlucQPos (RealType charge, int snapshotNo)
 
void addPrevFlucQPos (RealType charge)
 
void addFlucQPos (RealType charge)
 
void addFlucQPos (RealType charge, int snapshotNo)
 
RealType getPrevFlucQVel ()
 
RealType getFlucQVel ()
 
RealType getFlucQVel (int snapshotNo)
 
void setPrevFlucQVel (RealType cvel)
 
void setFlucQVel (RealType cvel)
 
void setFlucQVel (RealType cvel, int snapshotNo)
 
void addPrevFlucQVel (RealType cvel)
 
void addFlucQVel (RealType cvel)
 
void addFlucQVel (RealType cvel, int snapshotNo)
 
RealType getPrevFlucQFrc ()
 
RealType getFlucQFrc ()
 
RealType getFlucQFrc (int snapshotNo)
 
void setPrevFlucQFrc (RealType cfrc)
 
void setFlucQFrc (RealType cfrc)
 
void setFlucQFrc (RealType cfrc, int snapshotNo)
 
void addPrevFlucQFrc (RealType cfrc)
 
void addFlucQFrc (RealType cfrc)
 
void addFlucQFrc (RealType cfrc, int snapshotNo)
 
Vector3d getPrevElectricField ()
 
Vector3d getElectricField ()
 
Vector3d getElectricField (int snapshotNo)
 
void setPrevElectricField (const Vector3d &eField)
 
void setElectricField (const Vector3d &eField)
 
void setElectricField (const Vector3d &eField, int snapshotNo)
 
void addPrevEelectricField (const Vector3d &eField)
 
void addElectricField (const Vector3d &eField)
 
void addElectricField (const Vector3d &eField, int snapshotNo)
 
RealType getPrevSitePotential ()
 
RealType getSitePotential ()
 
RealType getSitePotential (int snapshotNo)
 
void setPrevSitePotential (RealType spot)
 
void setSitePotential (RealType spot)
 
void setSitePotential (RealType spot, int snapshotNo)
 
void addPrevSitePotential (RealType spot)
 
void addSitePotential (RealType spot)
 
void addSitePotential (RealType spot, int snapshotNo)
 
RealType getPrevDensity ()
 
RealType getDensity ()
 
RealType getDensity (int snapshotNo)
 
void setPrevDensity (RealType dens)
 
void setDensity (RealType dens)
 
void setDensity (RealType dens, int snapshotNo)
 
void addPrevDensity (RealType dens)
 
void addDensity (RealType dens)
 
void addDensity (RealType dens, int snapshotNo)
 
void zeroForcesAndTorques ()
 
bool isLinear ()
 
int linearAxis ()
 
RealType getMass ()
 
void setMass (RealType mass)
 
Vector3d lab2Body (const Vector3d &v)
 
Vector3d lab2Body (const Vector3d &v, int frame)
 
Vector3d body2Lab (const Vector3d &v)
 
Vector3d body2Lab (const Vector3d &v, int frame)
 
void addProperty (GenericData *genData)
 
void removeProperty (const std::string &propName)
 
void clearProperties ()
 
std::vector< std::string > getPropertyNames ()
 
std::vector< GenericData * > getProperties ()
 
GenericDatagetPropertyByName (const std::string &propName)
 

Private Attributes

std::string name_
 
Mat3x3d inertiaTensor_
 
RotMat3x3d sU_
 
std::vector< Atom * > atoms_
 
std::vector< Vector3drefCoords_
 
std::vector< RotMat3x3drefOrients_
 

Additional Inherited Members

- Protected Member Functions inherited from OpenMD::StuntDouble
 StuntDouble (ObjectType objType, DataStoragePointer storage)
 
 StuntDouble (const StuntDouble &sd)
 
StuntDoubleoperator= (const StuntDouble &sd)
 
- Protected Attributes inherited from OpenMD::StuntDouble
ObjectType objType_
 
DataStoragePointer storage_
 
SnapshotManagersnapshotMan_
 
bool linear_
 
int linearAxis_
 
int globalIndex_
 
int globalIntegrableObjectIndex_
 
int localIndex_
 
RealType mass_
 

Detailed Description

Definition at line 59 of file RigidBody.hpp.

Member Typedef Documentation

◆ AtomIterator

typedef std::vector<Atom*>::iterator OpenMD::RigidBody::AtomIterator

Definition at line 62 of file RigidBody.hpp.

Constructor & Destructor Documentation

◆ RigidBody()

OpenMD::RigidBody::RigidBody ( )

Definition at line 49 of file RigidBody.cpp.

Member Function Documentation

◆ accept()

void OpenMD::RigidBody::accept ( BaseVisitor v)
virtual

The purpose of the Visitor Pattern is to encapsulate an operation that you want to perform on the elements of a data structure. In this way, you can change the operation being performed on a structure without the need of changing the classes of the elements that you are operating on. Using a Visitor pattern allows you to decouple the classes for the data structure and the algorithms used upon them

Parameters
vvisitor

Implements OpenMD::StuntDouble.

Definition at line 148 of file RigidBody.cpp.

References OpenMD::BaseVisitor::visit().

Referenced by setType(), and OpenMD::CompositeVisitor::visit().

◆ addAtom()

◆ beginAtom()

◆ calcForcesAndTorques()

◆ calcForcesAndTorquesAndVirial()

Mat3x3d OpenMD::RigidBody::calcForcesAndTorquesAndVirial ( )

Converts Atomic forces and torques to total forces and torques and computes the rigid body contribution to the virial. Returns the rigid body contribution to the virial as a 3x3 matrix.

Definition at line 272 of file RigidBody.cpp.

References OpenMD::StuntDouble::addFrc(), OpenMD::StuntDouble::addTrq(), atoms_, OpenMD::DataStorage::dslElectricField, OpenMD::SnapshotManager::getCurrentSnapshot(), OpenMD::StuntDouble::getPos(), OpenMD::StuntDouble::isDirectional(), OpenMD::AtomType::isElectrostatic(), OpenMD::StuntDouble::setElectricField(), OpenMD::StuntDouble::snapshotMan_, and OpenMD::StuntDouble::storage_.

Referenced by OpenMD::ForceManager::postCalculation(), and setType().

◆ calcRefCoords()

◆ getAtomPos() [1/2]

bool OpenMD::RigidBody::getAtomPos ( Vector3d pos,
unsigned int  index 
)

Return the position of atom which belongs to this rigid body.

Returns
true if index is valid otherwise return false
Parameters
posthe position of atom which will be set on return if index is valid
indexthe index of the atom in rigid body's private data member atoms_

Definition at line 451 of file RigidBody.cpp.

References atoms_, OpenMD::StuntDouble::body2Lab(), errorStruct::errMsg, OpenMD::StuntDouble::getPos(), errorStruct::isFatal, painCave, refCoords_, and simError().

Referenced by getNumAtoms().

◆ getAtomPos() [2/2]

bool OpenMD::RigidBody::getAtomPos ( Vector3d pos,
Atom atom 
)

Return the position of atom which belongs to this rigid body.

Returns
true if atom belongs to this rigid body,otherwise return false
Parameters
posposition of atom which will be set on return if atom belongs to this rigid body
atomthe pointer to an atom

Definition at line 467 of file RigidBody.cpp.

References atoms_, OpenMD::StuntDouble::body2Lab(), errorStruct::errMsg, OpenMD::StuntDouble::getGlobalIndex(), OpenMD::StuntDouble::getPos(), errorStruct::isFatal, painCave, refCoords_, and simError().

◆ getAtomRefCoor() [1/2]

bool OpenMD::RigidBody::getAtomRefCoor ( Vector3d coor,
unsigned int  index 
)

Return the reference coordinate of atom which belongs to this rigid body.

Returns
true if index is valid otherwise return false
Parameters
coorthe reference coordinate of atom which will be set on return if index is valid
indexthe index of the atom in rigid body's private data member atoms_

Definition at line 539 of file RigidBody.cpp.

References atoms_, errorStruct::errMsg, errorStruct::isFatal, painCave, refCoords_, and simError().

Referenced by getNumAtoms().

◆ getAtomRefCoor() [2/2]

bool OpenMD::RigidBody::getAtomRefCoor ( Vector3d coor,
Atom atom 
)

Return the velocity of atom which belongs to this rigid body.

Returns
true if atom belongs to this rigid body,otherwise return false
Parameters
coorvelocity of atom which will be set on return if atom belongs to this rigid body
atomthe pointer to an atom

Definition at line 555 of file RigidBody.cpp.

References atoms_, errorStruct::errMsg, OpenMD::StuntDouble::getGlobalIndex(), errorStruct::isFatal, painCave, refCoords_, and simError().

◆ getAtoms()

std::vector<Atom*> OpenMD::RigidBody::getAtoms ( )
inline

◆ getAtomVel() [1/2]

bool OpenMD::RigidBody::getAtomVel ( Vector3d vel,
unsigned int  index 
)

Return the velocity of atom which belongs to this rigid body.

Returns
true if index is valid otherwise return false
Parameters
velthe velocity of atom which will be set on return if index is valid
indexthe index of the atom in rigid body's private data member atoms_

Definition at line 484 of file RigidBody.cpp.

References atoms_, errorStruct::errMsg, OpenMD::StuntDouble::getA(), getI(), OpenMD::StuntDouble::getJ(), OpenMD::StuntDouble::getVel(), errorStruct::isFatal, painCave, refCoords_, and simError().

Referenced by getAtomVel(), and getNumAtoms().

◆ getAtomVel() [2/2]

bool OpenMD::RigidBody::getAtomVel ( Vector3d vel,
Atom atom 
)

Return the velocity of atom which belongs to this rigid body.

Returns
true if atom belongs to this rigid body,otherwise return false
Parameters
velvelocity of atom which will be set on return if atom belongs to this rigid body
atomthe pointer to an atom

Definition at line 523 of file RigidBody.cpp.

References atoms_, errorStruct::errMsg, getAtomVel(), OpenMD::StuntDouble::getGlobalIndex(), errorStruct::isFatal, painCave, and simError().

◆ getBeginAtomIter()

std::vector<Atom*>::iterator OpenMD::RigidBody::getBeginAtomIter ( )
inline

Definition at line 142 of file RigidBody.hpp.

References atoms_.

Referenced by OpenMD::Molecule::complete().

◆ getEndAtomIter()

std::vector<Atom*>::iterator OpenMD::RigidBody::getEndAtomIter ( )
inline

Definition at line 146 of file RigidBody.hpp.

References atoms_.

Referenced by OpenMD::Molecule::complete().

◆ getGrad()

std::vector< RealType > OpenMD::RigidBody::getGrad ( )
virtual

Returns the gradient of this stuntdouble

Returns
the gradient of this stuntdouble

Implements OpenMD::StuntDouble.

Definition at line 90 of file RigidBody.cpp.

References OpenMD::StuntDouble::getA(), OpenMD::StuntDouble::getFrc(), OpenMD::StuntDouble::getTrq(), and OpenMD::SquareMatrix3< Real >::toEulerAngles().

Referenced by setType().

◆ getI()

Mat3x3d OpenMD::RigidBody::getI ( )
virtual

Returns the inertia tensor of this stuntdouble

Returns
the inertia tensor of this stuntdouble

Implements OpenMD::StuntDouble.

Definition at line 86 of file RigidBody.cpp.

References inertiaTensor_.

Referenced by getAtomVel(), setType(), and updateAtomVel().

◆ getNumAtoms()

int OpenMD::RigidBody::getNumAtoms ( )
inline

Returns the number of atoms in this rigid body

Returns
the number of atoms in this rigid body

Definition at line 163 of file RigidBody.hpp.

References atoms_, getAtomPos(), getAtomRefCoor(), and getAtomVel().

Referenced by OpenMD::LDForceManager::LDForceManager().

◆ getType()

virtual std::string OpenMD::RigidBody::getType ( )
inlinevirtual

Returns the name of this stuntDouble

Implements OpenMD::StuntDouble.

Definition at line 66 of file RigidBody.hpp.

References name_.

Referenced by OpenMD::NameFinder::loadNames(), OpenMD::LipidHeadVisitor::visit(), and OpenMD::WaterTypeVisitor::visit().

◆ nextAtom()

◆ setA() [1/2]

void OpenMD::RigidBody::setA ( const RotMat3x3d a)
virtual

Sets the current rotation matrix of this stuntdouble

Parameters
anew rotation matrix
Note
setA will not change the position and rotation matrix of Directional atoms belong to this rigidbody. If you want to do that, use updateAtoms

Reimplemented from OpenMD::StuntDouble.

Definition at line 65 of file RigidBody.cpp.

References atoms_, OpenMD::SnapshotManager::getCurrentSnapshot(), OpenMD::StuntDouble::isDirectional(), OpenMD::StuntDouble::localIndex_, refOrients_, OpenMD::StuntDouble::snapshotMan_, and OpenMD::StuntDouble::storage_.

Referenced by setType().

◆ setA() [2/2]

void OpenMD::RigidBody::setA ( const RotMat3x3d a,
int  snapshotNo 
)
virtual

Sets the rotation matrix of this stuntdouble in specified snapshot

Parameters
arotation matrix to be set
snapshotNo
See also
getA

Reimplemented from OpenMD::StuntDouble.

Definition at line 75 of file RigidBody.cpp.

References atoms_, OpenMD::SnapshotManager::getSnapshot(), OpenMD::StuntDouble::isDirectional(), OpenMD::StuntDouble::localIndex_, refOrients_, OpenMD::StuntDouble::snapshotMan_, and OpenMD::StuntDouble::storage_.

◆ setPrevA()

void OpenMD::RigidBody::setPrevA ( const RotMat3x3d a)
virtual

Sets the previous rotation matrix of this stuntdouble

Parameters
anew rotation matrix

Reimplemented from OpenMD::StuntDouble.

Definition at line 53 of file RigidBody.cpp.

References atoms_, OpenMD::SnapshotManager::getPrevSnapshot(), OpenMD::StuntDouble::isDirectional(), OpenMD::StuntDouble::localIndex_, refOrients_, OpenMD::StuntDouble::snapshotMan_, and OpenMD::StuntDouble::storage_.

Referenced by setType().

◆ setType()

virtual void OpenMD::RigidBody::setType ( const std::string &  name)
inlinevirtual

◆ updateAtoms() [1/2]

◆ updateAtoms() [2/2]

◆ updateAtomVel() [1/2]

void OpenMD::RigidBody::updateAtomVel ( )

◆ updateAtomVel() [2/2]

void OpenMD::RigidBody::updateAtomVel ( int  frame)

Member Data Documentation

◆ atoms_

◆ inertiaTensor_

Mat3x3d OpenMD::RigidBody::inertiaTensor_
private

Definition at line 217 of file RigidBody.hpp.

Referenced by calcRefCoords(), and getI().

◆ name_

std::string OpenMD::RigidBody::name_
private

Definition at line 216 of file RigidBody.hpp.

Referenced by getType(), and setType().

◆ refCoords_

std::vector<Vector3d> OpenMD::RigidBody::refCoords_
private

◆ refOrients_

std::vector<RotMat3x3d> OpenMD::RigidBody::refOrients_
private

Definition at line 222 of file RigidBody.hpp.

Referenced by addAtom(), calcRefCoords(), setA(), setPrevA(), and updateAtoms().

◆ sU_

RotMat3x3d OpenMD::RigidBody::sU_
private

body fixed standard unit vector

Definition at line 218 of file RigidBody.hpp.

Referenced by calcRefCoords().


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