Simpatico
v1.10
|
A container for all the atoms and ghost atoms on this processor.
Definition at line 44 of file ddMd/storage/AtomStorage.h.
#include <AtomStorage.h>
Public Member Functions | |
AtomStorage () | |
Constructor. More... | |
~AtomStorage () | |
Destructor. More... | |
void | associate (Domain &domain, Boundary &boundary, Buffer &buffer) |
Create associations for distributor and collector. More... | |
void | initialize (int atomCapacity, int ghostCapacity, int totalAtomCapacity) |
Set parameters, allocate memory and initialize. More... | |
virtual void | readParameters (std::istream &in) |
Read parameters, allocate memory and initialize. More... | |
void | zeroForces (bool zeroGhosts) |
Set all forces to zero. More... | |
Serialization (Checkpoint \& Restart) | |
virtual void | loadParameters (Serializable::IArchive &ar) |
Load internal state from an archive. More... | |
virtual void | save (Serializable::OArchive &ar) |
Save internal state to an archive. More... | |
Local Atom Management | |
Atom * | newAtomPtr () |
Returns pointer an address available for a new Atom. More... | |
void | addNewAtom () |
Finalize addition of the most recent new atom. More... | |
Atom * | addAtom (int id) |
Add atom with specified global id. More... | |
void | removeAtom (Atom *atomPtr) |
Remove a specific Atom. More... | |
void | clearAtoms () |
Clear all local atoms. More... | |
int | nAtom () const |
Return number of local atoms on this procesor (excluding ghosts) More... | |
int | atomCapacity () const |
Return capacity for local atoms on this processor (excluding ghosts). More... | |
Ghost Atom Management | |
Atom * | newGhostPtr () |
Returns pointer an address available for a new ghost Atom. More... | |
void | addNewGhost () |
Register the most recent new ghost atom. More... | |
Atom * | addGhost (int id) |
Add ghost atom with specified global id. More... | |
void | removeGhost (Atom *atomPtr) |
Remove a specific ghost Atom. More... | |
void | clearGhosts () |
Clear all ghost atoms. More... | |
int | nGhost () const |
Return current number of ghost atoms on this processor. More... | |
int | ghostCapacity () const |
Return capacity for ghost atoms on this processor. More... | |
Coordinate Systems | |
void | transformCartToGen (const Boundary &boundary) |
Transform positions from Cartesian to generalized coordinates. More... | |
void | transformGenToCart (const Boundary &boundary) |
Transform positions from generalized to Cartesian coordinates. More... | |
bool | isCartesian () const |
Are atom coordinates Cartesian (true) or generalized (false)? More... | |
Displacement Measurement | |
void | makeSnapshot () |
Record current positions of all local atoms and lock storage. More... | |
void | clearSnapshot () |
Clear previous snapshot. More... | |
double | maxSqDisplacement () |
Return max-squared displacement since the last snapshot. More... | |
Iteration | |
void | begin (AtomIterator &iterator) |
Set iterator to beginning of the set of atoms. More... | |
void | begin (ConstAtomIterator &iterator) const |
Set iterator to beginning of the set of atoms. More... | |
void | begin (GhostIterator &iterator) |
Set iterator to beginning of the set of ghost atoms. More... | |
void | begin (ConstGhostIterator &iterator) const |
Set iterator to beginning of the set of ghost atoms. More... | |
Global Atom Counting | |
int | totalAtomCapacity () const |
Return maximum number of atoms on all processors. More... | |
void | computeNAtomTotal (MPI::Intracomm &communicator) |
Compute the total number of local atoms on all processors. More... | |
int | nAtomTotal () const |
Get total number of atoms on all processors. More... | |
void | unsetNAtomTotal () |
Unset value of NAtomTotal (mark as unknown). More... | |
Accessors for Member Objects | |
const AtomMap & | map () const |
Return the AtomMap by const reference. More... | |
AtomDistributor & | distributor () |
Get the AtomDistributor by reference. More... | |
AtomCollector & | collector () |
Get the AtomCollector by reference. More... | |
Miscellaneous Accessors | |
bool | isInitialized () const |
Has this object been initialized? More... | |
bool | isValid () const |
Return true if the container is valid, or throw an Exception. More... | |
bool | isValid (MPI::Intracomm &communicator) const |
Return true if the container is valid, or throw an Exception. More... | |
Statistics | |
virtual void | computeStatistics (MPI::Intracomm &communicator) |
Compute statistics (reduce from all processors). More... | |
void | clearStatistics () |
Clear statistical accumulators (call on all processors). More... | |
void | outputStatistics (std::ostream &out) |
Output statistics. More... | |
int | maxNAtom () const |
Get the maximum number of local atoms encountered thus far. More... | |
int | maxNGhost () const |
Get the maximum number of ghost atoms encountered thus far. More... | |
![]() | |
ParamComposite () | |
Constructor. More... | |
ParamComposite (const ParamComposite &other) | |
Copy constructor. More... | |
ParamComposite (int capacity) | |
Constructor. More... | |
virtual | ~ParamComposite () |
Virtual destructor. More... | |
void | resetParam () |
Resets ParamComposite to its empty state. More... | |
virtual void | readParam (std::istream &in) |
Read the parameter file block. More... | |
virtual void | readParamOptional (std::istream &in) |
Read optional parameter file block. More... | |
virtual void | writeParam (std::ostream &out) |
Write all parameters to an output stream. More... | |
virtual void | load (Serializable::IArchive &ar) |
Load all parameters from an input archive. More... | |
virtual void | loadOptional (Serializable::IArchive &ar) |
Load an optional ParamComposite. More... | |
void | saveOptional (Serializable::OArchive &ar) |
Saves isActive flag, and then calls save() iff isActive is true. More... | |
void | readParamComposite (std::istream &in, ParamComposite &child, bool next=true) |
Add and read a required child ParamComposite. More... | |
void | readParamCompositeOptional (std::istream &in, ParamComposite &child, bool next=true) |
Add and attempt to read an optional child ParamComposite. More... | |
template<typename Type > | |
ScalarParam< Type > & | read (std::istream &in, const char *label, Type &value) |
Add and read a new required ScalarParam < Type > object. More... | |
template<typename Type > | |
ScalarParam< Type > & | readOptional (std::istream &in, const char *label, Type &value) |
Add and read a new optional ScalarParam < Type > object. More... | |
template<typename Type > | |
CArrayParam< Type > & | readCArray (std::istream &in, const char *label, Type *value, int n) |
Add and read a required C array parameter. More... | |
template<typename Type > | |
CArrayParam< Type > & | readOptionalCArray (std::istream &in, const char *label, Type *value, int n) |
Add and read an optional C array parameter. More... | |
template<typename Type > | |
DArrayParam< Type > & | readDArray (std::istream &in, const char *label, DArray< Type > &array, int n) |
Add and read a required DArray < Type > parameter. More... | |
template<typename Type > | |
DArrayParam< Type > & | readOptionalDArray (std::istream &in, const char *label, DArray< Type > &array, int n) |
Add and read an optional DArray < Type > parameter. More... | |
template<typename Type , int N> | |
FArrayParam< Type, N > & | readFArray (std::istream &in, const char *label, FArray< Type, N > &array) |
Add and read a required FArray < Type, N > array parameter. More... | |
template<typename Type , int N> | |
FArrayParam< Type, N > & | readOptionalFArray (std::istream &in, const char *label, FArray< Type, N > &array) |
Add and read an optional FArray < Type, N > array parameter. More... | |
template<typename Type > | |
CArray2DParam< Type > & | readCArray2D (std::istream &in, const char *label, Type *value, int m, int n, int np) |
Add and read a required CArray2DParam < Type > 2D C-array. More... | |
template<typename Type > | |
CArray2DParam< Type > & | readOptionalCArray2D (std::istream &in, const char *label, Type *value, int m, int n, int np) |
Add and read an optional CArray2DParam < Type > 2D C-array parameter. More... | |
template<typename Type > | |
DMatrixParam< Type > & | readDMatrix (std::istream &in, const char *label, DMatrix< Type > &matrix, int m, int n) |
Add and read a required DMatrix < Type > matrix parameter. More... | |
template<typename Type > | |
DMatrixParam< Type > & | readOptionalDMatrix (std::istream &in, const char *label, DMatrix< Type > &matrix, int m, int n) |
Add and read an optional DMatrix < Type > matrix parameter. More... | |
template<typename Type > | |
DSymmMatrixParam< Type > & | readDSymmMatrix (std::istream &in, const char *label, DMatrix< Type > &matrix, int n) |
Add and read a required symmetrix DMatrix. More... | |
template<typename Type > | |
DSymmMatrixParam< Type > & | readOptionalDSymmMatrix (std::istream &in, const char *label, DMatrix< Type > &matrix, int n) |
Add and read an optional DMatrix matrix parameter. More... | |
Begin & | readBegin (std::istream &in, const char *label, bool isRequired=true) |
Add and read a class label and opening bracket. More... | |
End & | readEnd (std::istream &in) |
Add and read the closing bracket. More... | |
Blank & | readBlank (std::istream &in) |
Add and read a new Blank object, representing a blank line. More... | |
void | loadParamComposite (Serializable::IArchive &ar, ParamComposite &child, bool next=true) |
Add and load a required child ParamComposite. More... | |
void | loadParamCompositeOptional (Serializable::IArchive &ar, ParamComposite &child, bool next=true) |
Add and load an optional child ParamComposite if isActive. More... | |
template<typename Type > | |
ScalarParam< Type > & | loadParameter (Serializable::IArchive &ar, const char *label, Type &value, bool isRequired) |
Add and load a new ScalarParam < Type > object. More... | |
template<typename Type > | |
ScalarParam< Type > & | loadParameter (Serializable::IArchive &ar, const char *label, Type &value) |
Add and load new required ScalarParam < Type > object. More... | |
template<typename Type > | |
CArrayParam< Type > & | loadCArray (Serializable::IArchive &ar, const char *label, Type *value, int n, bool isRequired) |
Add a C array parameter and load its elements. More... | |
template<typename Type > | |
CArrayParam< Type > & | loadCArray (Serializable::IArchive &ar, const char *label, Type *value, int n) |
Add and load a required CArrayParam< Type > array parameter. More... | |
template<typename Type > | |
DArrayParam< Type > & | loadDArray (Serializable::IArchive &ar, const char *label, DArray< Type > &array, int n, bool isRequired) |
Add an load a DArray < Type > array parameter. More... | |
template<typename Type > | |
DArrayParam< Type > & | loadDArray (Serializable::IArchive &ar, const char *label, DArray< Type > &array, int n) |
Add and load a required DArray< Type > array parameter. More... | |
template<typename Type , int N> | |
FArrayParam< Type, N > & | loadFArray (Serializable::IArchive &ar, const char *label, FArray< Type, N > &array, bool isRequired) |
Add and load an FArray < Type, N > fixed-size array parameter. More... | |
template<typename Type , int N> | |
FArrayParam< Type, N > & | loadFArray (Serializable::IArchive &ar, const char *label, FArray< Type, N > &array) |
Add and load a required FArray < Type > array parameter. More... | |
template<typename Type > | |
CArray2DParam< Type > & | loadCArray2D (Serializable::IArchive &ar, const char *label, Type *value, int m, int n, int np, bool isRequired) |
Add and load a CArray2DParam < Type > C 2D array parameter. More... | |
template<typename Type > | |
CArray2DParam< Type > & | loadCArray2D (Serializable::IArchive &ar, const char *label, Type *value, int m, int n, int np) |
Add and load a required < Type > matrix parameter. More... | |
template<typename Type > | |
DMatrixParam< Type > & | loadDMatrix (Serializable::IArchive &ar, const char *label, DMatrix< Type > &matrix, int m, int n, bool isRequired) |
Add and load a DMatrixParam < Type > matrix parameter. More... | |
template<typename Type > | |
DMatrixParam< Type > & | loadDMatrix (Serializable::IArchive &ar, const char *label, DMatrix< Type > &matrix, int m, int n) |
Add and load a required DMatrixParam < Type > matrix parameter. More... | |
template<typename Type > | |
DSymmMatrixParam< Type > & | loadDSymmMatrix (Serializable::IArchive &ar, const char *label, DMatrix< Type > &matrix, int n, bool isRequired) |
Add and load a symmetric DSymmMatrixParam < Type > matrix parameter. More... | |
template<typename Type > | |
DSymmMatrixParam< Type > & | loadDSymmMatrix (Serializable::IArchive &ar, const char *label, DMatrix< Type > &matrix, int n) |
Add and load a required DSymmMatrixParam < Type > matrix parameter. More... | |
void | addParamComposite (ParamComposite &child, bool next=true) |
Add a child ParamComposite object to the format array. More... | |
Begin & | addBegin (const char *label) |
Add a Begin object representing a class name and bracket. More... | |
End & | addEnd () |
Add a closing bracket. More... | |
Blank & | addBlank () |
Create and add a new Blank object, representing a blank line. More... | |
std::string | className () const |
Get class name string. More... | |
bool | isRequired () const |
Is this ParamComposite required in the input file? More... | |
bool | isActive () const |
Is this parameter active? More... | |
![]() | |
virtual | ~ParamComponent () |
Destructor. More... | |
void | setIndent (const ParamComponent &parent, bool next=true) |
Set indent level. More... | |
std::string | indent () const |
Return indent string for this object (string of spaces). More... | |
template<class Archive > | |
void | serialize (Archive &ar, const unsigned int version) |
Serialize this ParamComponent as a string. More... | |
![]() | |
virtual | ~Serializable () |
Destructor. More... | |
![]() | |
MpiFileIo () | |
Constructor. More... | |
MpiFileIo (const MpiFileIo &other) | |
Copy constructor. More... | |
bool | isIoProcessor () const |
Can this processor do file I/O ? More... | |
void | setIoCommunicator (MPI::Intracomm &communicator) |
Set the communicator. More... | |
void | clearCommunicator () |
Clear (nullify) the communicator. More... | |
bool | hasIoCommunicator () const |
Does this object have an associated MPI communicator? More... | |
MPI::Intracomm & | ioCommunicator () const |
Get the MPI communicator by reference. More... | |
Additional Inherited Members | |
![]() | |
typedef BinaryFileOArchive | OArchive |
Type of output archive used by save method. More... | |
typedef BinaryFileIArchive | IArchive |
Type of input archive used by load method. More... | |
![]() | |
static void | initStatic () |
Initialize static echo member to false. More... | |
static void | setEcho (bool echo=true) |
Enable or disable echoing for all subclasses of ParamComponent. More... | |
static bool | echo () |
Get echo parameter. More... | |
![]() | |
void | setClassName (const char *className) |
Set class name string. More... | |
void | setIsRequired (bool isRequired) |
Set or unset the isActive flag. More... | |
void | setIsActive (bool isActive) |
Set or unset the isActive flag. More... | |
void | setParent (ParamComponent ¶m, bool next=true) |
Set this to the parent of a child component. More... | |
void | addComponent (ParamComponent ¶m, bool isLeaf=true) |
Add a new ParamComponent object to the format array. More... | |
template<typename Type > | |
ScalarParam< Type > & | add (std::istream &in, const char *label, Type &value, bool isRequired=true) |
Add a new required ScalarParam < Type > object. More... | |
template<typename Type > | |
CArrayParam< Type > & | addCArray (std::istream &in, const char *label, Type *value, int n, bool isRequired=true) |
Add (but do not read) a required C array parameter. More... | |
template<typename Type > | |
DArrayParam< Type > & | addDArray (std::istream &in, const char *label, DArray< Type > &array, int n, bool isRequired=true) |
Add (but do not read) a DArray < Type > parameter. More... | |
template<typename Type , int N> | |
FArrayParam< Type, N > & | addFArray (std::istream &in, const char *label, FArray< Type, N > &array, bool isRequired=true) |
Add (but do not read) a FArray < Type, N > array parameter. More... | |
template<typename Type > | |
CArray2DParam< Type > & | addCArray2D (std::istream &in, const char *label, Type *value, int m, int n, int np, bool isRequired=true) |
Add (but do not read) a CArray2DParam < Type > 2D C-array. More... | |
template<typename Type > | |
DMatrixParam< Type > & | addDMatrix (std::istream &in, const char *label, DMatrix< Type > &matrix, int m, int n, bool isRequired=true) |
Add and read a required DMatrix < Type > matrix parameter. More... | |
![]() | |
ParamComponent () | |
Constructor. More... | |
ParamComponent (const ParamComponent &other) | |
Copy constructor. More... | |
DdMd::AtomStorage::AtomStorage | ( | ) |
Constructor.
Definition at line 26 of file ddMd/storage/AtomStorage.cpp.
References Util::ParamComposite::setClassName().
DdMd::AtomStorage::~AtomStorage | ( | ) |
Destructor.
Definition at line 54 of file ddMd/storage/AtomStorage.cpp.
Create associations for distributor and collector.
domain | Domain object (defines processor grid) |
boundary | Boundary object (defines periodic unit cell) |
buffer | Buffer object (holds memory for communication) |
Definition at line 60 of file ddMd/storage/AtomStorage.cpp.
References DdMd::AtomCollector::associate(), and DdMd::AtomDistributor::associate().
void DdMd::AtomStorage::initialize | ( | int | atomCapacity, |
int | ghostCapacity, | ||
int | totalAtomCapacity | ||
) |
Set parameters, allocate memory and initialize.
Call this or (read|load)Parameters to initialize, but not both.
atomCapacity | max number of atoms owned by processor. |
ghostCapacity | max number of ghosts on this processor. |
totalAtomCapacity | max number of atoms on all processors. |
Definition at line 70 of file ddMd/storage/AtomStorage.cpp.
References atomCapacity(), ghostCapacity(), and totalAtomCapacity().
|
virtual |
Read parameters, allocate memory and initialize.
Call either this or initialize(), but not both.
Parameters (file format):
in | input parameter stream. |
Reimplemented from Util::ParamComposite.
Definition at line 82 of file ddMd/storage/AtomStorage.cpp.
void DdMd::AtomStorage::zeroForces | ( | bool | zeroGhosts | ) |
Set all forces to zero.
Sets forces on all local atoms to zero. Also zeros forces for ghost atoms iff parameter zeroGhosts is true.
zeroGhosts | if true, zero forces on ghost atoms. |
Definition at line 150 of file ddMd/storage/AtomStorage.cpp.
References begin(), nAtom(), nGhost(), Util::PArrayIterator< Data >::notEnd(), and DdMd::AtomArray::zeroForces().
|
virtual |
Load internal state from an archive.
ar | input/loading archive |
Reimplemented from Util::ParamComposite.
Definition at line 93 of file ddMd/storage/AtomStorage.cpp.
|
virtual |
Save internal state to an archive.
Call only on ioProcessor (master).
ar | output/saving archive |
Reimplemented from Util::ParamComposite.
Definition at line 107 of file ddMd/storage/AtomStorage.cpp.
References DdMd::AtomMap::allocate(), DdMd::AtomArray::allocate(), and UTIL_THROW.
Atom * DdMd::AtomStorage::newAtomPtr | ( | ) |
Returns pointer an address available for a new Atom.
This function returns the address of an Atom object that can be used for a new local Atom. The Atom::clear() function is applied to the new atom before it is returned, so that the id, typeId, isGhost flag, mask, and plan have default values. After this function is called, the storage retains the address of the new atom. This new atom pointer remains ``active" until a matching call to addNewAtom(), as discussed below.
This function does not add the new Atom to the atom set, and so must be followed by a matching call to addNewAtom() to do so. Usage:
The matching call to addNewAtom() adds the new atom to the storage and deactivates the internal new atom pointer.
Definition at line 187 of file ddMd/storage/AtomStorage.cpp.
References DdMd::Atom::clear(), and UTIL_THROW.
Referenced by DdMd::AtomDistributor::addAtom(), addAtom(), DdMd::Exchanger::exchange(), and DdMd::AtomDistributor::receive().
void DdMd::AtomStorage::addNewAtom | ( | ) |
Finalize addition of the most recent new atom.
This function adds the atom that was returned by the most recent call to newAtomPtr to the atom set. Upon return there is no active new atom pointer. The global atom id must be set before calling this function, by calling Atom::setId(int), because the algorithm uses the global id returned by Atom::id().
Definition at line 208 of file ddMd/storage/AtomStorage.cpp.
References DdMd::AtomMap::addLocal(), DdMd::Atom::setIsGhost(), and UTIL_THROW.
Referenced by DdMd::AtomDistributor::addAtom(), addAtom(), DdMd::Exchanger::exchange(), and DdMd::AtomDistributor::receive().
Atom * DdMd::AtomStorage::addAtom | ( | int | id | ) |
Add atom with specified global id.
This function adds a new atom to the atom set with a specified atom id, and returns a pointer to the address of the new atom. It is equivalent to the following, in which storage is an instance of AtomStorage and ptr is an Atom pointer:
The pointer returned by this function can then be used to set other properties of the new atom.
id | global index for the new Atom. |
Definition at line 229 of file ddMd/storage/AtomStorage.cpp.
References addNewAtom(), newAtomPtr(), and DdMd::Atom::setId().
void DdMd::AtomStorage::removeAtom | ( | Atom * | atomPtr | ) |
Remove a specific Atom.
Exception | if atomPtr is not address of a local Atom. |
atomPtr | pointer to the atom to be removed |
Definition at line 240 of file ddMd/storage/AtomStorage.cpp.
References DdMd::AtomMap::removeLocal().
Referenced by DdMd::Exchanger::exchange().
void DdMd::AtomStorage::clearAtoms | ( | ) |
Clear all local atoms.
Definition at line 250 of file ddMd/storage/AtomStorage.cpp.
References DdMd::AtomMap::nLocal(), DdMd::AtomMap::removeLocal(), and UTIL_THROW.
|
inline |
Return number of local atoms on this procesor (excluding ghosts)
Definition at line 611 of file ddMd/storage/AtomStorage.h.
Referenced by DdMd::PairPotential::buildCellList(), computeNAtomTotal(), isValid(), DdMd::AtomDistributor::send(), transformCartToGen(), transformGenToCart(), DdMd::AtomDistributor::validate(), and zeroForces().
|
inline |
Return capacity for local atoms on this processor (excluding ghosts).
Definition at line 625 of file ddMd/storage/AtomStorage.h.
Referenced by initialize(), and DdMd::PairPotential::save().
Atom * DdMd::AtomStorage::newGhostPtr | ( | ) |
Returns pointer an address available for a new ghost Atom.
This function returns the address of an Atom object that can be used for a new ghost Atom. It must be followed by a call to addNewGhost(). Usage:
Definition at line 278 of file ddMd/storage/AtomStorage.cpp.
References DdMd::Atom::clear(), DdMd::Atom::setIsGhost(), and UTIL_THROW.
Referenced by addGhost(), and DdMd::Exchanger::exchange().
void DdMd::AtomStorage::addNewGhost | ( | ) |
Register the most recent new ghost atom.
This function adds the atom that was returned by the most recent call to newGhostPtr to the ghost atom set. The global atom id must be set before calling this function, by calling Atom::setId(int), because an data structure uses the global id returned by Atom::id().
Definition at line 297 of file ddMd/storage/AtomStorage.cpp.
References DdMd::AtomMap::addGhost(), DdMd::Atom::setIsGhost(), and UTIL_THROW.
Referenced by addGhost(), and DdMd::Exchanger::exchange().
Atom * DdMd::AtomStorage::addGhost | ( | int | id | ) |
Add ghost atom with specified global id.
This function adds a new atom to the ghost atom set and returns a pointer to the address of the new atom. It is equivalent to the following, in which storage is an AtomStorage object and ptr is an Atom pointer:
id | global index for the new Atom. |
Definition at line 320 of file ddMd/storage/AtomStorage.cpp.
References addNewGhost(), newGhostPtr(), and DdMd::Atom::setId().
void DdMd::AtomStorage::removeGhost | ( | Atom * | atomPtr | ) |
Remove a specific ghost Atom.
Exception | if atomPtr is not address of a ghost Atom. |
atomPtr | pointer to the ghost atom to be removed |
Definition at line 331 of file ddMd/storage/AtomStorage.cpp.
References DdMd::AtomMap::removeGhost(), and UTIL_THROW.
void DdMd::AtomStorage::clearGhosts | ( | ) |
Clear all ghost atoms.
Definition at line 344 of file ddMd/storage/AtomStorage.cpp.
References DdMd::AtomMap::clearGhosts(), DdMd::AtomMap::nGhost(), DdMd::AtomMap::nGhostDistinct(), and UTIL_THROW.
Referenced by DdMd::Exchanger::exchange().
|
inline |
Return current number of ghost atoms on this processor.
Definition at line 614 of file ddMd/storage/AtomStorage.h.
Referenced by DdMd::GroupDistributor< N >::add(), DdMd::PairPotential::buildCellList(), DdMd::Exchanger::exchange(), isValid(), DdMd::GroupDistributor< N >::receive(), transformCartToGen(), transformGenToCart(), and zeroForces().
|
inline |
Return capacity for ghost atoms on this processor.
Definition at line 628 of file ddMd/storage/AtomStorage.h.
Referenced by initialize(), and DdMd::PairPotential::save().
void DdMd::AtomStorage::transformCartToGen | ( | const Boundary & | boundary | ) |
Transform positions from Cartesian to generalized coordinates.
Transforms position coordinates of all local and ghost atoms.
boundary | periodic boundary conditions |
Definition at line 456 of file ddMd/storage/AtomStorage.cpp.
References begin(), isCartesian(), nAtom(), nGhost(), Util::PArrayIterator< Data >::notEnd(), Simp::OrthorhombicBoundary::transformCartToGen(), and UTIL_THROW.
Referenced by DdMd::TwoStepIntegrator::run().
void DdMd::AtomStorage::transformGenToCart | ( | const Boundary & | boundary | ) |
Transform positions from generalized to Cartesian coordinates.
Transforms position coordinates of all local and ghost atoms.
boundary | periodic boundary conditions |
Definition at line 482 of file ddMd/storage/AtomStorage.cpp.
References begin(), isCartesian(), nAtom(), nGhost(), Util::PArrayIterator< Data >::notEnd(), Simp::OrthorhombicBoundary::transformGenToCart(), and UTIL_THROW.
Referenced by DdMd::TwoStepIntegrator::run(), and DdMd::Integrator::setupAtoms().
|
inline |
Are atom coordinates Cartesian (true) or generalized (false)?
Definition at line 634 of file ddMd/storage/AtomStorage.h.
Referenced by DdMd::AtomDistributor::addAtom(), DdMd::PairPotential::buildCellList(), DdMd::Exchanger::exchange(), makeSnapshot(), maxSqDisplacement(), DdMd::SerializeConfigIo::saveConfig(), transformCartToGen(), transformGenToCart(), DdMd::Exchanger::update(), DdMd::DdMdConfigIo::writeConfig(), DdMd::LammpsConfigIo::writeConfig(), DdMd::DdMdOrderedConfigIo::writeConfig(), DdMd::LammpsDumpWriter::writeFrame(), DdMd::DdMdTrajectoryWriter::writeFrame(), and DdMd::DdMdGroupTrajectoryWriter::writeFrame().
void DdMd::AtomStorage::makeSnapshot | ( | ) |
Record current positions of all local atoms and lock storage.
This function stores positions of local atoms and locks the storage, prohibiting addition or removal of atoms or ghosts until clearSnapshot is called.
Definition at line 376 of file ddMd/storage/AtomStorage.cpp.
References begin(), isCartesian(), Util::PArrayIterator< Data >::notEnd(), and UTIL_THROW.
Referenced by DdMd::TwoStepIntegrator::run(), and DdMd::Integrator::setupAtoms().
void DdMd::AtomStorage::clearSnapshot | ( | ) |
Clear previous snapshot.
This function removes the lock imposed by a previous call to makeSnapshot(), allowing changes to atom and ghost sets.
Definition at line 395 of file ddMd/storage/AtomStorage.cpp.
Referenced by DdMd::TwoStepIntegrator::run(), and DdMd::Integrator::setupAtoms().
double DdMd::AtomStorage::maxSqDisplacement | ( | ) |
Return max-squared displacement since the last snapshot.
Note: This is a local operation, and returns only the maximum on this processor.
Throws exception if no valid snapshot is available.
Definition at line 403 of file ddMd/storage/AtomStorage.cpp.
References begin(), isCartesian(), Util::PArrayIterator< Data >::notEnd(), Util::Vector::square(), Util::Vector::subtract(), and UTIL_THROW.
Referenced by DdMd::Integrator::isExchangeNeeded().
void DdMd::AtomStorage::begin | ( | AtomIterator & | iterator | ) |
Set iterator to beginning of the set of atoms.
iterator | iterator for all atoms. |
Definition at line 432 of file ddMd/storage/AtomStorage.cpp.
Referenced by DdMd::PairPotential::buildCellList(), DdMd::ExternalPotentialImpl< Interaction >::computeEnergy(), DdMd::PairPotentialImpl< Interaction >::computeEnergy(), DdMd::Exchanger::exchange(), DdMd::NvtIntegrator::integrateStep1(), DdMd::NphIntegrator::integrateStep1(), DdMd::NveIntegrator::integrateStep1(), DdMd::NptIntegrator::integrateStep1(), DdMd::NvtLangevinIntegrator::integrateStep1(), DdMd::NvtIntegrator::integrateStep2(), DdMd::NphIntegrator::integrateStep2(), DdMd::NveIntegrator::integrateStep2(), DdMd::NptIntegrator::integrateStep2(), DdMd::NvtLangevinIntegrator::integrateStep2(), isValid(), makeSnapshot(), maxSqDisplacement(), DdMd::PairPotential::nPair(), DdMd::OrderParamNucleation::sample(), DdMd::StructureFactor::sample(), DdMd::VanHove::sample(), DdMd::AtomCollector::send(), DdMd::ConfigIo::setAtomMasks(), DdMd::AtomCollector::setup(), transformCartToGen(), transformGenToCart(), DdMd::AtomDistributor::validate(), and zeroForces().
void DdMd::AtomStorage::begin | ( | ConstAtomIterator & | iterator | ) | const |
Set iterator to beginning of the set of atoms.
iterator | iterator for all atoms. |
Definition at line 438 of file ddMd/storage/AtomStorage.cpp.
void DdMd::AtomStorage::begin | ( | GhostIterator & | iterator | ) |
Set iterator to beginning of the set of ghost atoms.
iterator | iterator for all ghost atoms. |
Definition at line 444 of file ddMd/storage/AtomStorage.cpp.
void DdMd::AtomStorage::begin | ( | ConstGhostIterator & | iterator | ) | const |
Set iterator to beginning of the set of ghost atoms.
iterator | iterator for all ghost atoms. |
Definition at line 450 of file ddMd/storage/AtomStorage.cpp.
|
inline |
Return maximum number of atoms on all processors.
The return value is one greater than the maximum allowed atom id value, i.e. atom ids are assigned values in the range 0 <= id <= totalAtomCapacity-1.
Definition at line 631 of file ddMd/storage/AtomStorage.h.
Referenced by initialize(), DdMd::GroupStorage< N >::isValid(), DdMd::SerializeConfigIo::loadConfig(), DdMd::DdMdConfigIo::readConfig(), DdMd::LammpsConfigIo::readConfig(), and DdMd::DdMdOrderedConfigIo::readConfig().
void DdMd::AtomStorage::computeNAtomTotal | ( | MPI::Intracomm & | communicator | ) |
Compute the total number of local atoms on all processors.
This is an MPI reduce operation, and thus must be called on all processors. The resulting sum is stored only on the master processor, with rank 0. It may be retrieved by a subsequent call to nAtomTotal() on the master (rank 0) processor. A null value is stored on all other processors.
Upon return, the value is marked as set (i.e., known) on all processors in the communicator. This can be cleared by calling the unSetNAtomTotal() function on all processors.
If computeNAtomTotal function is called when the value of nAtomTotal is already set (and thus presumably already known), the function will return without doing anything.
communicator | MPI communicator for this system. |
Definition at line 509 of file ddMd/storage/AtomStorage.cpp.
References nAtom(), nAtomTotal(), and Util::Setable< T >::set().
Referenced by DdMd::Exchanger::exchange(), DdMd::AtomDistributor::receive(), DdMd::TwoStepIntegrator::run(), DdMd::OutputTemperature::sample(), DdMd::SerializeConfigIo::saveConfig(), DdMd::AtomDistributor::send(), DdMd::NvtIntegrator::setup(), DdMd::NphIntegrator::setup(), DdMd::NptIntegrator::setup(), DdMd::AtomDistributor::validate(), DdMd::DdMdConfigIo::writeConfig(), DdMd::LammpsConfigIo::writeConfig(), DdMd::DdMdOrderedConfigIo::writeConfig(), DdMd::LammpsDumpWriter::writeFrame(), and DdMd::DdMdTrajectoryWriter::writeHeader().
|
inline |
Get total number of atoms on all processors.
This function should only be called on the master (rank = 0). The return value is computed by a previous invocation of computeNAtomTotal(), which must be called on all processors.
Definition at line 643 of file ddMd/storage/AtomStorage.h.
Referenced by computeNAtomTotal(), DdMd::Exchanger::exchange(), DdMd::Integrator::outputStatistics(), DdMd::Exchanger::outputStatistics(), DdMd::OutputTemperature::sample(), DdMd::SerializeConfigIo::saveConfig(), DdMd::AtomDistributor::send(), DdMd::NvtIntegrator::setup(), DdMd::NphIntegrator::setup(), DdMd::NptIntegrator::setup(), DdMd::AtomDistributor::validate(), DdMd::LammpsConfigIo::writeConfig(), DdMd::DdMdOrderedConfigIo::writeConfig(), DdMd::LammpsDumpWriter::writeFrame(), and DdMd::DdMdTrajectoryWriter::writeHeader().
void DdMd::AtomStorage::unsetNAtomTotal | ( | ) |
Unset value of NAtomTotal (mark as unknown).
Thus function must be called simultaneously on all processors. It should be called immediately after any operation that changes the number of atoms per processor.
Definition at line 524 of file ddMd/storage/AtomStorage.cpp.
References Util::Setable< T >::unset().
Referenced by DdMd::AtomDistributor::receive(), DdMd::TwoStepIntegrator::run(), and DdMd::AtomDistributor::send().
|
inline |
Return the AtomMap by const reference.
Definition at line 637 of file ddMd/storage/AtomStorage.h.
Referenced by DdMd::GroupDistributor< N >::add(), DdMd::GroupStorage< N >::findGhosts(), DdMd::GroupStorage< N >::isValid(), DdMd::GroupStorage< N >::markGhosts(), DdMd::GroupDistributor< N >::receive(), DdMd::ConfigIo::setAtomMasks(), and DdMd::GroupStorage< N >::unpack().
|
inline |
Get the AtomDistributor by reference.
Definition at line 618 of file ddMd/storage/AtomStorage.h.
|
inline |
Get the AtomCollector by reference.
Definition at line 621 of file ddMd/storage/AtomStorage.h.
bool DdMd::AtomStorage::isInitialized | ( | ) | const |
Has this object been initialized?
An AtomStorage is initialized by calling readParam or setParam.
bool DdMd::AtomStorage::isValid | ( | ) | const |
Return true if the container is valid, or throw an Exception.
Definition at line 592 of file ddMd/storage/AtomStorage.cpp.
References begin(), DdMd::AtomMap::find(), Util::ConstPArrayIterator< Data >::get(), DdMd::AtomMap::isValid(), nAtom(), DdMd::AtomMap::nGhost(), nGhost(), Util::ConstPArrayIterator< Data >::notEnd(), and UTIL_THROW.
Referenced by DdMd::Exchanger::exchange(), isValid(), and DdMd::AtomDistributor::validate().
bool DdMd::AtomStorage::isValid | ( | MPI::Intracomm & | communicator | ) | const |
Return true if the container is valid, or throw an Exception.
Return true if the internal state is valid, or throw an Exception.
communicator | communicator for all domain processors. |
communicator | domain communicator for all domain processors. |
Definition at line 660 of file ddMd/storage/AtomStorage.cpp.
References Util::Setable< T >::isValid(), and isValid().
|
virtual |
Compute statistics (reduce from all processors).
Call on all processors.
Definition at line 532 of file ddMd/storage/AtomStorage.cpp.
References Util::Setable< T >::set().
void DdMd::AtomStorage::clearStatistics | ( | ) |
Clear statistical accumulators (call on all processors).
Definition at line 561 of file ddMd/storage/AtomStorage.cpp.
References Util::Setable< T >::unset().
Referenced by DdMd::Integrator::clear().
void DdMd::AtomStorage::outputStatistics | ( | std::ostream & | out | ) |
Output statistics.
Call on master, after calling computeStatistics on all procs.
out | output stream |
Definition at line 572 of file ddMd/storage/AtomStorage.cpp.
References Util::Setable< T >::value().
int DdMd::AtomStorage::maxNAtom | ( | ) | const |
Get the maximum number of local atoms encountered thus far.
Call only on master.
int DdMd::AtomStorage::maxNGhost | ( | ) | const |
Get the maximum number of ghost atoms encountered thus far.
Call only on master.