Simpatico  v1.10
List of all members
McMd::Atom Class Reference

Detailed Description

A point particle within a Molecule.

Each Atom has a position Vector, an integer atom type Id, and a global integer id that is unique in the Simulation. Each Atom has a force and velocity, for use in Md simulations. Each atom has a pointer to its parent Molecule, and has an associated Mask object. A Mask contains a list of other atoms for which pair interactions with this Atom are suppressed.

Each atom also has an isActive() flag that can be used by Monte Carlo moves to mark an atom as temporarily "inactive" during a deletion or regrowth of part of a molecule. The isActive flag is initialized to true by the Atom::allocate function.

Allocation and Deallocation

Atom objects can only be created by the static Atom::allocate() function. This function allocates a static member array containing all of the Atom objects available in a program. The global index that is returned by the id() function is the index of an Atom within this array. This array of all Atoms must be allocated and deallocated using the following pattern:

RArray<Atom> atoms;
int atomCapacity; // number of Atoms to be allocated
Atom::allocate(atomCapacity, atoms)
// ... code that uses elements of the RArray atoms ...
Atom::deallocate();

Access to the array of Atom objects is provided by an RArray<Atom> array container (called "atoms" in the above example) that is passed to Atom::allocate by reference as its second parameter. After Atom::allocate() returns, this container holds the address and capacity of the underlying C array, and may thereafter be used to access individual atoms.

This interface is designed to allow an implementation of the Atom class in which some logical attributes of an Atom are not actually C++ member variables, but are instead stored in separate private arrays. These additional arrays are private static members of the Atom class that can be directly accessed by the accessor and setter functions for the associated attributes, as if they were normal non-static class members.

Definition at line 79 of file mcMd/chemistry/Atom.h.

#include <Atom.h>

Public Member Functions

Mutators
void setMolecule (Molecule &molecule)
 Set the parent molecule. More...
 
void setTypeId (int typeId)
 Set the atomic type index. More...
 
Accessors
int id () const
 Get global index for this Atom within the Simulation. More...
 
int indexInMolecule () const
 Get local index for this Atom within the parent molecule;. More...
 
int typeId () const
 Get type index for this Atom. More...
 
Moleculemolecule () const
 Get the parent Molecule by reference. More...
 
const Vectorposition () const
 Get the position Vector by const reference. More...
 
Vectorposition ()
 Get position Vector by reference. More...
 
Maskmask ()
 Get the associated Mask by reference. More...
 
const Maskmask () const
 Get the associated Mask by const reference. More...
 
Vectorvelocity ()
 Get atomic velocity Vector by reference. More...
 
const Vectorvelocity () const
 Get the atomic velocity Vector by const reference. More...
 
Vectorforce ()
 Get atomic force Vector by reference. More...
 
const Vectorforce () const
 Get atomic force Vector by const reference. More...
 
bool isActive () const
 Get the isActive flag. More...
 

Static Public Member Functions

Allocation and de-allocation (static members)
static void initStatic ()
 Method to guarantee initialization of static data. More...
 
static void allocate (int capacity, RArray< Atom > &atoms)
 Allocate a static array of Atom objects. More...
 
static void deallocate ()
 Delete all static arrays. More...
 
static int capacity ()
 Get total number of atoms (capacity of the static atom array.) More...
 

Member Function Documentation

void McMd::Atom::setMolecule ( Molecule molecule)

Set the parent molecule.

Parameters
moleculeMolecule containing this Atom

Definition at line 151 of file mcMd/chemistry/Atom.cpp.

Referenced by McMd::Simulation::save().

void McMd::Atom::setTypeId ( int  typeId)
inline

Set the atomic type index.

Parameters
typeIdinteger index that identifies atom type

Definition at line 266 of file mcMd/chemistry/Atom.h.

Referenced by McMd::CfbReptationMove::move(), McMd::EndSwapMove::move(), McMd::CfbReptateMove::move(), McMd::Simulation::save(), McMd::HomopolymerSG::setMoleculeState(), and McMd::LinearSG::setMoleculeState().

int McMd::Atom::id ( ) const
inline
int McMd::Atom::indexInMolecule ( ) const
inline
int McMd::Atom::typeId ( ) const
inline
Molecule & McMd::Atom::molecule ( ) const
inline
const Vector & McMd::Atom::position ( ) const
inline

Get the position Vector by const reference.

Definition at line 278 of file mcMd/chemistry/Atom.h.

Referenced by McMd::CfbLinear::addAtom(), McMd::CellList::addAtom(), McMd::CfbEndBase::addEndAtom(), McMd::LinkPotentialImpl< Interaction >::addForces(), McMd::BondPotentialImpl< Interaction >::addForces(), McMd::MdEwaldPairPotentialImpl< Interaction >::addForces(), McMd::MdPairPotentialImpl< Interaction >::addForces(), McMd::DihedralPotentialImpl< Interaction >::addForces(), McMd::AnglePotentialImpl< Interaction >::addForces(), McMd::CfbRebridgeBase::addMiddleAtom(), McMd::GroupRebridgeBase::angleEnergy(), McMd::LinkPotentialImpl< Interaction >::atomEnergy(), McMd::ExternalPotentialImpl< Interaction >::atomEnergy(), McMd::BondPotentialImpl< Interaction >::atomEnergy(), McMd::McPairPotentialImpl< Interaction >::atomEnergy(), McMd::DihedralPotentialImpl< Interaction >::atomEnergy(), McMd::AnglePotentialImpl< Interaction >::atomEnergy(), McMd::Generator::attemptPlaceAtom(), McMd::PointGenerator::attemptPlaceMolecule(), McMd::LinearGenerator::attemptPlaceMolecule(), McMd::PairList::build(), McMd::LinkPotentialImpl< Interaction >::computeEnergy(), McMd::McPairPotentialImpl< Interaction >::computeEnergy(), McMd::MdEwaldPairPotentialImpl< Interaction >::computeEnergy(), McMd::MdPairPotentialImpl< Interaction >::computeEnergy(), McMd::MdEwaldPairPotentialImpl< Interaction >::computeStress(), McMd::CfbLinear::deleteAtom(), McMd::CfbEndBase::deleteEndAtom(), McMd::CfbRebridgeBase::deleteMiddleAtom(), McMd::McPairExternalPerturbation< PairInteraction, ExternalInteraction >::derivative(), McMd::McPairPerturbation< Interaction >::derivative(), McMd::ClusterIdentifier::initialize(), McMd::McNVTChemicalPotential::load(), McMd::McPairPotentialImpl< Interaction >::moleculeEnergy(), McMd::GcSliplinkMove::move(), McMd::Sliplinker::move(), McMd::SliplinkerAll::move(), McMd::SliplinkMove::move(), McMd::SliplinkerEnd::move(), McMd::RingTetraRebridgeMove::move(), McMd::AtomDisplaceMove::move(), McMd::CfbDoubleRebridgeMove::move(), McMd::RingOctaRebridgeMove::move(), McMd::CfbEndMove::move(), McMd::CfbLinearEndMove::move(), McMd::CfbReptationMove::move(), McMd::CfbRingRebridgeMove::move(), McMd::EndSwapMove::move(), McMd::CfbReptateMove::move(), McMd::RigidDisplaceMove::move(), McMd::McPairPotential::moveAtom(), McMd::GroupRebridgeBase::octaEnergy(), McMd::ComMSD::output(), McMd::McConfigIo::readAtom(), McMd::MdConfigIo::readAtom(), McMd::Crosslinker::sample(), McMd::LinkLengthDist::sample(), McMd::G1MSD::sample(), McMd::McNVTChemicalPotential::sample(), McMd::McMuExchange::sample(), McMd::AtomMSD::sample(), McMd::MdPairEnergyCoefficients::sample(), McMd::McPairEnergyAverage::sample(), McMd::ComMSD::sample(), McMd::RingRouseAutoCorr::sample(), McMd::EndtoEndXYZ::sample(), McMd::LinearRouseAutoCorr::sample(), McMd::EndtoEnd::sample(), McMd::BlockRadiusGyration::sample(), McMd::IntraPairAutoCorr::sample(), McMd::RadiusGyration::sample(), McMd::RingOctaRebridgeMove::scanBridge(), McMd::RingTetraRebridgeMove::scanBridge(), McMd::G1MSD::setup(), McMd::AtomMSD::setup(), McMd::ComMSD::setup(), McMd::NvtDpdVvIntegrator::setup(), McMd::NveVvIntegrator::step(), McMd::NvtLangevinIntegrator::step(), McMd::NphIntegrator::step(), McMd::GroupRebridgeBase::tetraEnergy(), McMd::McPairPotential::updateAtomCell(), McMd::McConfigIo::writeAtom(), and McMd::MdConfigIo::writeAtom().

Vector & McMd::Atom::position ( )
inline

Get position Vector by reference.

Definition at line 282 of file mcMd/chemistry/Atom.h.

Mask & McMd::Atom::mask ( )
inline
const Mask & McMd::Atom::mask ( ) const
inline

Get the associated Mask by const reference.

Definition at line 306 of file mcMd/chemistry/Atom.h.

Vector & McMd::Atom::velocity ( )
inline
const Vector & McMd::Atom::velocity ( ) const
inline

Get the atomic velocity Vector by const reference.

Definition at line 286 of file mcMd/chemistry/Atom.h.

Vector & McMd::Atom::force ( )
inline
const Vector & McMd::Atom::force ( ) const
inline

Get atomic force Vector by const reference.

Definition at line 294 of file mcMd/chemistry/Atom.h.

bool McMd::Atom::isActive ( ) const
inline

Get the isActive flag.

Definition at line 314 of file mcMd/chemistry/Atom.h.

Referenced by McMd::Activate::deactivate(), McMd::Simulation::isValid(), and McMd::Activate::reactivate().

void McMd::Atom::initStatic ( )
static

Method to guarantee initialization of static data.

Definition at line 35 of file mcMd/chemistry/Atom.cpp.

Referenced by McMd::Simulation::Simulation().

void McMd::Atom::allocate ( int  capacity,
RArray< Atom > &  atoms 
)
static

Allocate a static array of Atom objects.

Upon return, the parameter atoms is associated with a new private static array of Atom objects, and every Atom has an id set equal to its index within this array.

Atom::allocate creates a static array that contains all of the Atom objects available for use in a program. Atom::deallocate() releases the memory allocated by Atom::allocate. Atom::allocate() cannot be called more than once without first calling Atom::deallocate().

Parameters
capacitytotal number of Atoms to be allocated in the array.
atomson return, atoms is associated with the new array.

Definition at line 52 of file mcMd/chemistry/Atom.cpp.

References Util::RArray< Data >::associate(), Util::Vector::zero(), and Util::IntVector::zero().

Referenced by McMd::Simulation::save().

void McMd::Atom::deallocate ( )
static

Delete all static arrays.

Deletes all memory allocated previously by allocate.

Definition at line 103 of file mcMd/chemistry/Atom.cpp.

Referenced by McMd::Simulation::~Simulation().

static int McMd::Atom::capacity ( )
static

Get total number of atoms (capacity of the static atom array.)


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