Simpatico  v1.10
List of all members | Public Member Functions
DdMd::AtomStorage Class Reference

Detailed Description

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>

Inheritance diagram for DdMd::AtomStorage:
Util::ParamComposite Util::ParamComponent Util::Serializable Util::MpiFileIo

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
AtomnewAtomPtr ()
 Returns pointer an address available for a new Atom. More...
 
void addNewAtom ()
 Finalize addition of the most recent new atom. More...
 
AtomaddAtom (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
AtomnewGhostPtr ()
 Returns pointer an address available for a new ghost Atom. More...
 
void addNewGhost ()
 Register the most recent new ghost atom. More...
 
AtomaddGhost (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 AtomMapmap () const
 Return the AtomMap by const reference. More...
 
AtomDistributordistributor ()
 Get the AtomDistributor by reference. More...
 
AtomCollectorcollector ()
 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...
 
- Public Member Functions inherited from Util::ParamComposite
 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...
 
BeginreadBegin (std::istream &in, const char *label, bool isRequired=true)
 Add and read a class label and opening bracket. More...
 
EndreadEnd (std::istream &in)
 Add and read the closing bracket. More...
 
BlankreadBlank (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...
 
BeginaddBegin (const char *label)
 Add a Begin object representing a class name and bracket. More...
 
EndaddEnd ()
 Add a closing bracket. More...
 
BlankaddBlank ()
 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...
 
- Public Member Functions inherited from Util::ParamComponent
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...
 
- Public Member Functions inherited from Util::Serializable
virtual ~Serializable ()
 Destructor. More...
 
- Public Member Functions inherited from Util::MpiFileIo
 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

- Public Types inherited from Util::Serializable
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 Public Member Functions inherited from Util::ParamComponent
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...
 
- Protected Member Functions inherited from Util::ParamComposite
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 &param, bool next=true)
 Set this to the parent of a child component. More...
 
void addComponent (ParamComponent &param, 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...
 
- Protected Member Functions inherited from Util::ParamComponent
 ParamComponent ()
 Constructor. More...
 
 ParamComponent (const ParamComponent &other)
 Copy constructor. More...
 

Constructor & Destructor Documentation

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.

Member Function Documentation

void DdMd::AtomStorage::associate ( Domain domain,
Boundary boundary,
Buffer buffer 
)

Create associations for distributor and collector.

Parameters
domainDomain object (defines processor grid)
boundaryBoundary object (defines periodic unit cell)
bufferBuffer 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.

Parameters
atomCapacitymax number of atoms owned by processor.
ghostCapacitymax number of ghosts on this processor.
totalAtomCapacitymax number of atoms on all processors.

Definition at line 70 of file ddMd/storage/AtomStorage.cpp.

References atomCapacity(), ghostCapacity(), and totalAtomCapacity().

void DdMd::AtomStorage::readParameters ( std::istream &  in)
virtual

Read parameters, allocate memory and initialize.

Call either this or initialize(), but not both.

Parameters (file format):

  • atomCapacity [int] max number of atoms owned by processor.
  • ghostCapacity [int] max number of ghosts on this processor.
  • totalatomCapacity [int] max number of atoms on all processors.
Parameters
ininput 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.

Parameters
zeroGhostsif 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().

void DdMd::AtomStorage::loadParameters ( Serializable::IArchive ar)
virtual

Load internal state from an archive.

Parameters
arinput/loading archive

Reimplemented from Util::ParamComposite.

Definition at line 93 of file ddMd/storage/AtomStorage.cpp.

void DdMd::AtomStorage::save ( Serializable::OArchive ar)
virtual

Save internal state to an archive.

Call only on ioProcessor (master).

Parameters
aroutput/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:

AtomStorage storage;
Atom* ptr;
ptr = storage.newAtomPtr;
ptr->setId(id);
// Set other properties of the new Atom.
storage.addNewAtom();

The matching call to addNewAtom() adds the new atom to the storage and deactivates the internal new atom pointer.

Returns
address for a new atom

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:

ptr = storage.newAtomPtr;
ptr->setId(id);
storage.addNewAtom();

The pointer returned by this function can then be used to set other properties of the new atom.

Parameters
idglobal index for the new Atom.
Returns
address for 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.

Exceptions
Exceptionif atomPtr is not address of a local Atom.
Parameters
atomPtrpointer 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.

int DdMd::AtomStorage::nAtom ( ) const
inline
int DdMd::AtomStorage::atomCapacity ( ) const
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:

AtomStorage storage;
Atom* ptr;
ptr = storage.newGhostPtr;
ptr->setId(id);
// Set other properties of the new Atom.
storage.addNewGhost();
Returns
address for new ghost atom.

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:

ptr = storage.newGhostPtr;
ptr->setId(id);
storage.addNewGhost();
Parameters
idglobal index for the new Atom.
Returns
address for new ghost 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.

Exceptions
Exceptionif atomPtr is not address of a ghost Atom.
Parameters
atomPtrpointer 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 ( )
int DdMd::AtomStorage::nGhost ( ) const
inline
int DdMd::AtomStorage::ghostCapacity ( ) const
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.

Parameters
boundaryperiodic 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.

Parameters
boundaryperiodic 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().

bool DdMd::AtomStorage::isCartesian ( ) const
inline
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)
void DdMd::AtomStorage::begin ( ConstAtomIterator iterator) const

Set iterator to beginning of the set of atoms.

Parameters
iteratoriterator 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.

Parameters
iteratoriterator 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.

Parameters
iteratoriterator for all ghost atoms.

Definition at line 450 of file ddMd/storage/AtomStorage.cpp.

int DdMd::AtomStorage::totalAtomCapacity ( ) const
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.

Parameters
communicatorMPI 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().

int DdMd::AtomStorage::nAtomTotal ( ) const
inline
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().

const AtomMap & DdMd::AtomStorage::map ( ) const
inline
AtomDistributor & DdMd::AtomStorage::distributor ( )
inline

Get the AtomDistributor by reference.

Definition at line 618 of file ddMd/storage/AtomStorage.h.

AtomCollector & DdMd::AtomStorage::collector ( )
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
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.

Parameters
communicatorcommunicator for all domain processors.
communicatordomain communicator for all domain processors.

Definition at line 660 of file ddMd/storage/AtomStorage.cpp.

References Util::Setable< T >::isValid(), and isValid().

void DdMd::AtomStorage::computeStatistics ( MPI::Intracomm &  communicator)
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.

Parameters
outoutput 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.


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