Simpatico
v1.10
|
A point particle in an MD simulation.
An Atom has:
An Atom may only be constructed as an element of an AtomArray. The Atom constructor is private, to prevent instantiation of an indivual Atom, but is accessible by the AtomArray class via a a friend declaration.
The interface of the Atom class provides access to each Atom data field through an accessor function, as if all were true C++ class data members. In fact, some of the above are "pseudo-members" that are stored in separate arrays. All arrays that store atom data are private members of the associated AtomArray, all of which use the same indexing scheme to identify atoms. Each Atom object has a pointer to its parent AtomArray and its array index, in private members. The public accessor method for each pseudo-member simply retrieves the required array element for this atom.
In the current implementation, the position, force, atom type id, and isGhost flag are stored in true member variables of an Atom object, while the velocity, mask, plan, id (the global atom index), and AtomContext (if any) are all pseudo-members stored in separate arrays. See documentation of the private member localId_ and other comments in the Atom.h file for further implementation details.
Definition at line 64 of file ddMd/chemistry/Atom.h.
#include <Atom.h>
Public Member Functions | |
Mutators | |
Atom & | operator= (Atom const &other) |
Assignment. More... | |
void | clear () |
Reset integer members to initial null values. More... | |
void | setId (int Id) |
Set unique global id for this Atom. More... | |
void | setTypeId (int Id) |
Set the atom type index. More... | |
void | setIsGhost (bool isGhost) |
Mark as ghost or local atom for this processor. More... | |
Accessors (return non-const references) | |
Vector & | position () |
Get position Vector by reference. More... | |
Vector & | velocity () |
Get velocity Vector by reference. More... | |
Vector & | force () |
Get force Vector by reference. More... | |
Mask & | mask () |
Get the associated Mask by reference. More... | |
Plan & | plan () |
Get communication plan by reference. More... | |
AtomContext & | context () |
Get the AtomContext struct by non-const reference. More... | |
unsigned int & | groups () |
Get groups bit field by non-const reference. More... | |
Accessors (return by value or const references). | |
int | id () const |
Get unique global index for this atom. More... | |
int | typeId () const |
Get atom type index. More... | |
bool | isGhost () const |
Is this atom a ghost? More... | |
const Vector & | position () const |
Get the position Vector (const reference). More... | |
const Vector & | velocity () const |
Get the velocity Vector (const reference). More... | |
const Vector & | force () const |
Get the force Vector (const reference). More... | |
const Mask & | mask () const |
Get the associated Mask by const reference. More... | |
const Plan & | plan () const |
Get communication plan by const reference. More... | |
const AtomContext & | context () const |
Get the AtomContext struct by const reference. More... | |
unsigned int | groups () const |
Get bit field of groups to which this atom belongs. More... | |
Pack and Unpack Methods (Interprocessor Communication) | |
void | packAtom (Buffer &buffer) |
Pack an Atom into a send buffer, for exchange of ownership. More... | |
void | unpackAtom (Buffer &buffer) |
Unpack an atom from a recv buffer and receive ownership. More... | |
void | packGhost (Buffer &buffer) |
Pack a ghost Atom into a send buffer. More... | |
void | unpackGhost (Buffer &buffer) |
Unpack a ghost Atom from a recv buffer. More... | |
void | packUpdate (Buffer &buffer) |
Pack updated ghost position into send buffer. More... | |
void | unpackUpdate (Buffer &buffer) |
Unpack updated ghost position from recv buffer. More... | |
void | packForce (Buffer &buffer) |
Pack update of ghost Atom force into send buffer. More... | |
void | unpackForce (Buffer &buffer) |
Unpack updated position of ghost Atom from recv buffer. More... | |
void | copyLocalGhost (Atom const &sendAtom) |
Copies data from local atom to update this ghost atom. More... | |
void | copyLocalUpdate (Atom const &sendAtom) |
Copies position of local atom to update this ghost atom. More... | |
Static Public Member Functions | |
static void | setHasAtomContext (bool hasAtomContext) |
Enable (true) or disable (false) use of AtomContext data. More... | |
static bool | hasAtomContext () |
Is AtomContext data enabled? More... | |
static int | packedAtomSize () |
Return max size of an atom packed for exchange, in bytes. More... | |
static int | packedGhostSize () |
Return size of ghost atom packed for communication, in bytes. More... | |
Friends | |
class | Util::Memory |
|
static |
Enable (true) or disable (false) use of AtomContext data.
hasAtomContext | new value for hasAtomContext static bool flag. |
Definition at line 29 of file ddMd/chemistry/Atom.cpp.
Referenced by DdMd::Simulation::loadParameters(), and DdMd::Simulation::readParameters().
|
inlinestatic |
Is AtomContext data enabled?
Definition at line 591 of file ddMd/chemistry/Atom.h.
Referenced by DdMd::AtomArray::allocate(), DdMd::ConfigIoFactory::factory(), DdMd::SerializeConfigIo::loadConfig(), DdMd::DdMdConfigIo::readConfig(), DdMd::DdMdOrderedConfigIo::readConfig(), DdMd::SerializeConfigIo::saveConfig(), DdMd::Simulation::setConfigIo(), DdMd::Simulation::unsetVirialStress(), DdMd::DdMdConfigIo::writeConfig(), and DdMd::DdMdOrderedConfigIo::writeConfig().
|
static |
Return max size of an atom packed for exchange, in bytes.
Definition at line 149 of file ddMd/chemistry/Atom.cpp.
Referenced by DdMd::Buffer::isInitialized().
|
static |
Return size of ghost atom packed for communication, in bytes.
Definition at line 204 of file ddMd/chemistry/Atom.cpp.
Referenced by DdMd::Buffer::isInitialized().
Assignment.
Definition at line 49 of file ddMd/chemistry/Atom.cpp.
References context(), groups(), id(), isGhost(), mask(), plan(), and velocity().
void DdMd::Atom::clear | ( | ) |
Reset integer members to initial null values.
Definition at line 69 of file ddMd/chemistry/Atom.cpp.
Referenced by DdMd::AtomDistributor::newAtomPtr(), DdMd::AtomStorage::newAtomPtr(), and DdMd::AtomStorage::newGhostPtr().
|
inline |
Set unique global id for this Atom.
This id must be unique among all atoms on all processors, and must be less than totalAtomCapacity of the AtomStorage.
Id | unique atom id. |
Definition at line 551 of file ddMd/chemistry/Atom.h.
Referenced by DdMd::AtomStorage::addAtom(), DdMd::AtomStorage::addGhost(), DdMd::Exchanger::exchange(), DdMd::SerializeConfigIo::loadConfig(), DdMd::DdMdConfigIo::readConfig(), DdMd::LammpsConfigIo::readConfig(), and DdMd::DdMdOrderedConfigIo::readConfig().
|
inline |
Set the atom type index.
Id | integer index that identifies atom type |
Definition at line 433 of file ddMd/chemistry/Atom.h.
Referenced by DdMd::Exchanger::exchange(), DdMd::SerializeConfigIo::loadConfig(), DdMd::DdMdConfigIo::readConfig(), DdMd::LammpsConfigIo::readConfig(), and DdMd::DdMdOrderedConfigIo::readConfig().
|
inline |
Mark as ghost or local atom for this processor.
isGhost | true if this is a ghost, or false if local. |
Definition at line 439 of file ddMd/chemistry/Atom.h.
Referenced by DdMd::AtomStorage::addNewAtom(), DdMd::AtomStorage::addNewGhost(), and DdMd::AtomStorage::newGhostPtr().
|
inline |
Get position Vector by reference.
Definition at line 468 of file ddMd/chemistry/Atom.h.
Referenced by DdMd::AtomDistributor::addAtom(), DdMd::AtomMap::addLocal(), DdMd::BondTensorAutoCorr::computeData(), DdMd::AnglePotentialImpl< Interaction >::computeEnergy(), DdMd::BondPotentialImpl< Interaction >::computeEnergy(), DdMd::DihedralPotentialImpl< Interaction >::computeEnergy(), DdMd::PairPotentialImpl< Interaction >::computeEnergy(), DdMd::AnglePotentialImpl< Interaction >::computeForces(), DdMd::BondPotentialImpl< Interaction >::computeForces(), DdMd::DihedralPotentialImpl< Interaction >::computeForces(), DdMd::BondPotentialImpl< Interaction >::computeForcesAndStress(), DdMd::PairPotentialImpl< Interaction >::computeForcesAndStress(), DdMd::PairPotentialImpl< Interaction >::computePairEnergies(), DdMd::AnglePotentialImpl< Interaction >::computeStress(), DdMd::BondPotentialImpl< Interaction >::computeStress(), DdMd::DihedralPotentialImpl< Interaction >::computeStress(), DdMd::PairPotentialImpl< Interaction >::computeStress(), copyLocalGhost(), copyLocalUpdate(), DdMd::Exchanger::exchange(), DdMd::SerializeConfigIo::loadConfig(), DdMd::GroupStorage< N >::markSpanningGroups(), DdMd::PairPotential::nPair(), DdMd::CellList::placeAtom(), DdMd::DdMdConfigIo::readConfig(), DdMd::LammpsConfigIo::readConfig(), DdMd::DdMdOrderedConfigIo::readConfig(), DdMd::AtomDistributor::receive(), DdMd::SerializeConfigIo::saveConfig(), DdMd::Exchanger::update(), DdMd::DdMdConfigIo::writeConfig(), DdMd::LammpsConfigIo::writeConfig(), DdMd::DdMdOrderedConfigIo::writeConfig(), DdMd::LammpsDumpWriter::writeFrame(), DdMd::DdMdTrajectoryWriter::writeFrame(), and DdMd::DdMdGroupTrajectoryWriter::writeFrame().
|
inline |
Get velocity Vector by reference.
Definition at line 509 of file ddMd/chemistry/Atom.h.
Referenced by DdMd::SerializeConfigIo::loadConfig(), operator=(), DdMd::DdMdConfigIo::readConfig(), DdMd::DdMdOrderedConfigIo::readConfig(), DdMd::SerializeConfigIo::saveConfig(), DdMd::DdMdConfigIo::writeConfig(), and DdMd::DdMdOrderedConfigIo::writeConfig().
|
inline |
Get force Vector by reference.
Definition at line 480 of file ddMd/chemistry/Atom.h.
Referenced by DdMd::PairPotentialImpl< Interaction >::computeEnergy(), DdMd::AnglePotentialImpl< Interaction >::computeForces(), DdMd::BondPotentialImpl< Interaction >::computeForces(), DdMd::DihedralPotentialImpl< Interaction >::computeForces(), DdMd::BondPotentialImpl< Interaction >::computeForcesAndStress(), DdMd::PairPotentialImpl< Interaction >::computeForcesAndStress(), and DdMd::Exchanger::reverseUpdate().
|
inline |
Get the associated Mask by reference.
Definition at line 521 of file ddMd/chemistry/Atom.h.
Referenced by operator=(), and DdMd::ConfigIo::setAtomMasks().
|
inline |
Get communication plan by reference.
Definition at line 533 of file ddMd/chemistry/Atom.h.
Referenced by copyLocalGhost(), DdMd::Exchanger::exchange(), DdMd::GroupStorage< N >::markGhosts(), DdMd::GroupStorage< N >::markSpanningGroups(), operator=(), and DdMd::GroupStorage< N >::pack().
|
inline |
Get the AtomContext struct by non-const reference.
Throws and Exception if atom context data is disabled.
A DdMd::AtomContext struct contains public members speciesId, moleculeId and atomId that identify the species of molecule to which this atom belongs, the index of the molecule within it species, and the index of the atom with the molecule.
Definition at line 557 of file ddMd/chemistry/Atom.h.
References UTIL_THROW.
Referenced by copyLocalGhost(), DdMd::SerializeConfigIo::loadConfig(), operator=(), DdMd::DdMdConfigIo::readConfig(), DdMd::DdMdOrderedConfigIo::readConfig(), DdMd::SerializeConfigIo::saveConfig(), DdMd::DdMdConfigIo::writeConfig(), and DdMd::DdMdOrderedConfigIo::writeConfig().
|
inline |
Get groups bit field by non-const reference.
The unsigned int groups is used as a bit field in which bit number i (with i=0 the least signficant bit), is set true/1 if this atom belongs to group i, and is false/0 if this atom of not belong to group i. By default, all bits are clear.
Individual bits may be set, unset and queried using an instance of class Util::Bit.
Definition at line 579 of file ddMd/chemistry/Atom.h.
Referenced by DdMd::SerializeConfigIo::loadConfig(), operator=(), DdMd::SerializeConfigIo::saveConfig(), DdMd::DdMdGroupTrajectoryWriter::writeFrame(), and DdMd::DdMdGroupTrajectoryWriter::writeHeader().
|
inline |
Get unique global index for this atom.
Definition at line 545 of file ddMd/chemistry/Atom.h.
Referenced by DdMd::AtomMap::addGhost(), DdMd::AtomMap::addLocal(), copyLocalGhost(), DdMd::Exchanger::exchange(), DdMd::AtomMap::findGroupGhostAtoms(), DdMd::AtomMap::findGroupLocalAtoms(), DdMd::AtomMap::isValid(), operator=(), DdMd::AtomMap::removeGhost(), DdMd::AtomMap::removeLocal(), DdMd::SerializeConfigIo::saveConfig(), DdMd::DdMdConfigIo::writeConfig(), DdMd::LammpsConfigIo::writeConfig(), DdMd::DdMdOrderedConfigIo::writeConfig(), DdMd::LammpsDumpWriter::writeFrame(), DdMd::DdMdTrajectoryWriter::writeFrame(), and DdMd::DdMdGroupTrajectoryWriter::writeFrame().
|
inline |
Get atom type index.
Definition at line 453 of file ddMd/chemistry/Atom.h.
Referenced by DdMd::PairPotentialImpl< Interaction >::computeEnergy(), DdMd::PairPotentialImpl< Interaction >::computeForcesAndStress(), DdMd::PairPotentialImpl< Interaction >::computePairEnergies(), DdMd::PairPotentialImpl< Interaction >::computeStress(), copyLocalGhost(), DdMd::Exchanger::exchange(), DdMd::SerializeConfigIo::saveConfig(), DdMd::DdMdConfigIo::writeConfig(), DdMd::LammpsConfigIo::writeConfig(), DdMd::DdMdOrderedConfigIo::writeConfig(), and DdMd::LammpsDumpWriter::writeFrame().
|
inline |
Is this atom a ghost?
Definition at line 459 of file ddMd/chemistry/Atom.h.
Referenced by DdMd::BondTensorAutoCorr::computeData(), DdMd::AnglePotentialImpl< Interaction >::computeEnergy(), DdMd::BondPotentialImpl< Interaction >::computeEnergy(), DdMd::DihedralPotentialImpl< Interaction >::computeEnergy(), DdMd::PairPotentialImpl< Interaction >::computeEnergy(), DdMd::AnglePotentialImpl< Interaction >::computeForces(), DdMd::BondPotentialImpl< Interaction >::computeForces(), DdMd::DihedralPotentialImpl< Interaction >::computeForces(), DdMd::BondPotentialImpl< Interaction >::computeForcesAndStress(), DdMd::PairPotentialImpl< Interaction >::computeForcesAndStress(), DdMd::GroupStorage< N >::computeNTotal(), DdMd::PairPotentialImpl< Interaction >::computePairEnergies(), DdMd::AnglePotentialImpl< Interaction >::computeStress(), DdMd::BondPotentialImpl< Interaction >::computeStress(), DdMd::DihedralPotentialImpl< Interaction >::computeStress(), DdMd::PairPotentialImpl< Interaction >::computeStress(), DdMd::AtomMap::findGroupGhostAtoms(), DdMd::AtomMap::findGroupLocalAtoms(), DdMd::GroupStorage< N >::isValid(), DdMd::GroupStorage< N >::markGhosts(), DdMd::GroupStorage< N >::markSpanningGroups(), DdMd::GroupCollector< N >::nextPtr(), DdMd::PairPotential::nPair(), operator=(), and DdMd::GroupCollector< N >::send().
|
inline |
Get the position Vector (const reference).
Definition at line 474 of file ddMd/chemistry/Atom.h.
|
inline |
Get the velocity Vector (const reference).
Definition at line 515 of file ddMd/chemistry/Atom.h.
|
inline |
Get the force Vector (const reference).
Definition at line 486 of file ddMd/chemistry/Atom.h.
|
inline |
Get the associated Mask by const reference.
Definition at line 527 of file ddMd/chemistry/Atom.h.
|
inline |
Get communication plan by const reference.
Definition at line 539 of file ddMd/chemistry/Atom.h.
|
inline |
Get the AtomContext struct by const reference.
Throws an Exception if atom context data is disabled.
Definition at line 568 of file ddMd/chemistry/Atom.h.
References UTIL_THROW.
|
inline |
Get bit field of groups to which this atom belongs.
Definition at line 585 of file ddMd/chemistry/Atom.h.
void DdMd::Atom::packAtom | ( | Buffer & | buffer | ) |
Pack an Atom into a send buffer, for exchange of ownership.
Packs required data, increments buffer sendSize counter.
buffer | communication buffer |
Definition at line 88 of file ddMd/chemistry/Atom.cpp.
References DdMd::Buffer::incrementSendSize(), and DdMd::Buffer::pack().
Referenced by DdMd::AtomDistributor::addAtom(), DdMd::AtomDistributor::newAtomPtr(), and DdMd::AtomDistributor::send().
void DdMd::Atom::unpackAtom | ( | Buffer & | buffer | ) |
Unpack an atom from a recv buffer and receive ownership.
buffer | communication buffer |
Definition at line 114 of file ddMd/chemistry/Atom.cpp.
References DdMd::Buffer::decrementRecvSize(), and DdMd::Buffer::unpack().
Referenced by DdMd::Exchanger::exchange(), and DdMd::AtomDistributor::receive().
void DdMd::Atom::packGhost | ( | Buffer & | buffer | ) |
Pack a ghost Atom into a send buffer.
Packs required data, increments buffer sendSize counter.
buffer | communication buffer |
Definition at line 168 of file ddMd/chemistry/Atom.cpp.
References DdMd::Buffer::incrementSendSize(), and DdMd::Buffer::pack().
Referenced by DdMd::Exchanger::exchange().
void DdMd::Atom::unpackGhost | ( | Buffer & | buffer | ) |
Unpack a ghost Atom from a recv buffer.
Unpacks required data, decrements buffer recvSize counter.
buffer | communication buffer |
Definition at line 184 of file ddMd/chemistry/Atom.cpp.
References DdMd::Buffer::decrementRecvSize(), and DdMd::Buffer::unpack().
Referenced by DdMd::Exchanger::exchange().
void DdMd::Atom::packUpdate | ( | Buffer & | buffer | ) |
Pack updated ghost position into send buffer.
Packs position Vector, increments buffer sendSize counter.
buffer | communication buffer |
Definition at line 221 of file ddMd/chemistry/Atom.cpp.
References DdMd::Buffer::incrementSendSize(), and DdMd::Buffer::pack().
Referenced by DdMd::Exchanger::update().
void DdMd::Atom::unpackUpdate | ( | Buffer & | buffer | ) |
Unpack updated ghost position from recv buffer.
Unpacks position Vector, decrements buffer recvSize counter.
buffer | communication buffer |
Definition at line 230 of file ddMd/chemistry/Atom.cpp.
References DdMd::Buffer::decrementRecvSize(), and DdMd::Buffer::unpack().
Referenced by DdMd::Exchanger::update().
void DdMd::Atom::packForce | ( | Buffer & | buffer | ) |
Pack update of ghost Atom force into send buffer.
Packs force Vector, increments buffer sendSize counter.
buffer | communication buffer |
Definition at line 241 of file ddMd/chemistry/Atom.cpp.
References DdMd::Buffer::incrementSendSize(), and DdMd::Buffer::pack().
Referenced by DdMd::Exchanger::reverseUpdate().
void DdMd::Atom::unpackForce | ( | Buffer & | buffer | ) |
Unpack updated position of ghost Atom from recv buffer.
Reads force from buffer and increments the atomic force (rather than overwriting), then decrements recvSize counter.
buffer | communication buffer |
Definition at line 250 of file ddMd/chemistry/Atom.cpp.
References DdMd::Buffer::decrementRecvSize(), and DdMd::Buffer::unpack().
Referenced by DdMd::Exchanger::reverseUpdate().
void DdMd::Atom::copyLocalGhost | ( | Atom const & | sendAtom | ) |
Copies data from local atom to update this ghost atom.
sendAtom | Local atom to be copied to this atom. |
Definition at line 262 of file ddMd/chemistry/Atom.cpp.
References context(), DdMd::Plan::flags(), id(), plan(), position(), and typeId().
Referenced by DdMd::Exchanger::exchange().
void DdMd::Atom::copyLocalUpdate | ( | Atom const & | sendAtom | ) |
Copies position of local atom to update this ghost atom.
sendAtom | Local atom to be copied to update this atom. |
Definition at line 276 of file ddMd/chemistry/Atom.cpp.
References position().
Referenced by DdMd::Exchanger::update().