8 #include "SerializeConfigIo.h" 10 #include <ddMd/simulation/Simulation.h> 11 #include <ddMd/communicate/Domain.h> 13 #include <ddMd/storage/AtomStorage.h> 15 #include <ddMd/storage/BondStorage.h> 18 #include <ddMd/storage/AngleStorage.h> 21 #include <ddMd/storage/DihedralStorage.h> 24 #include <ddMd/communicate/GroupCollector.tpp> 25 #include <ddMd/communicate/GroupDistributor.tpp> 27 #include <ddMd/communicate/Buffer.h> 28 #include <ddMd/chemistry/Atom.h> 29 #include <ddMd/chemistry/Bond.h> 30 #include <ddMd/chemistry/MaskPolicy.h> 31 #include <util/space/Vector.h> 33 #include <util/format/Int.h> 34 #include <util/format/Dbl.h> 67 for (
int i = 0; i < nGroup; ++i) {
68 groupPtr = distributor.
newPtr();
88 UTIL_THROW(
"Atom storage is not empty (has local atoms)");
91 UTIL_THROW(
"Atom storage is not empty (has ghost atoms)");
94 UTIL_THROW(
"Atom storage set for Cartesian coordinates");
107 if (
domain().isMaster()) {
123 for (
int i = 0; i < nAtom; ++i) {
130 if (id < 0 || id >= totalAtomCapacity) {
140 contextPtr = &atomPtr->
context();
164 if (
domain().isMaster()) {
165 if (nAtomAll != nAtom) {
166 UTIL_THROW(
"nAtomAll != nAtom after distribution");
171 bool hasGhosts =
false;
177 if (maskPolicy == MaskBonded) {
209 nGroup = storage.
nTotal();
210 if (
domain().isMaster()) {
213 groupPtr = collector.
nextPtr();
216 groupPtr = collector.
nextPtr();
230 if (
domain().isMaster()) {
237 if (
domain().isMaster()) {
250 typeId = atomPtr->
typeId();
255 contextPtr = &atomPtr->
context();
298 if (
domain().isMaster() && !file.is_open()) {
299 UTIL_THROW(
"Error: File is not open on master");
313 if (
domain().isMaster() && !file.is_open()) {
314 UTIL_THROW(
"Error: File is not open on master");
void computeNTotal(MPI::Intracomm &communicator)
Compute and store the number of distinct groups on all processors.
void setup()
Setup master processor for receiving.
GroupDistributor< 2 > & bondDistributor()
Get the bondDistributor by reference.
int typeId() const
Get atom type index.
GroupCollector< 4 > & dihedralCollector()
Get the dihedral collector by reference.
A Vector is a Cartesian vector.
AtomStorage & atomStorage()
Get AtomStorage by reference.
Atom * newAtomPtr()
Returns pointer an address available for a new Atom.
virtual void writeConfig(std::ofstream &file)
Write configuration file.
int nAtomTotal() const
Get total number of atoms on all processors.
void add()
Add a group to the cache for sending, send if necessary.
int moleculeId
Index of molecule within its molecular species.
Group< N > * nextPtr()
Return a pointer to the next available atom, or null.
BondStorage & bondStorage()
Get BondStorage by reference.
void setTypeId(int Id)
Set the atom type index.
void setId(int Id)
Set unique global id for this Atom.
Domain & domain()
Get the Domain by reference.
Vector & position()
Get position Vector by reference.
AtomCollector & atomCollector()
Get the AtomCollector by reference.
void send()
Send all atoms to the master.
GroupDistributor< 3 > & angleDistributor()
Get the angle distributor by reference.
A point particle in an MD simulation.
Parallel domain decomposition (DD) MD simulation.
Main object for a domain-decomposition MD simulation.
int id() const
Get unique global index for this atom.
int capacity() const
Return capacity for groups on this processor.
Saving / output archive for binary ostream.
#define UTIL_THROW(msg)
Macro for throwing an Exception, reporting function, file and line number.
AtomDistributor & atomDistributor()
Get the AtomDistributor by reference.
void bcast(MPI::Intracomm &comm, T &data, int root)
Broadcast a single T value.
unsigned int & groups()
Get groups bit field by non-const reference.
int addAtom()
Process the active atom for sending.
Descriptor for context of an Atom within a molecule and species.
Class for collecting Groups from processors to master processor.
int speciesId
Index of the species of molecule.
void loadConfig(Serializable::IArchive &ar, MaskPolicy maskPolicy)
Load configuration from an archive.
Utility classes for scientific computation.
void setAtomMasks()
Set Mask data on all atoms.
virtual void readConfig(std::ifstream &file, MaskPolicy maskPolicy)
Read configuration file.
Atom * nextPtr()
Return a pointer to the next available atom, or null.
GroupDistributor< 4 > & dihedralDistributor()
Get the dihedral distributor by reference.
MaskPolicy
Enumeration of policies for suppressing ("masking") some pair interactions.
virtual bool isValid(AtomStorage &atomStorage, MPI::Intracomm &communicator, bool hasGhosts)
Return true if the container is valid, or throw an Exception.
static bool hasAtomContext()
Is AtomContext data enabled?
Group< N > * newPtr()
Returns pointer an address available for a new Group<N>.
Boundary & boundary()
Get Boundary by reference.
void receive()
Receive all atoms sent by master processor.
A container for all the Group<N> objects on this processor.
void send()
Send all atoms that have not be sent previously.
void transformGenToCart(const Vector &Rg, Vector &Rc) const
Transform Vector of generalized coordinates to Cartesian Vector.
GroupCollector< 2 > & bondCollector()
Get the bond collector by reference.
void computeNAtomTotal(MPI::Intracomm &communicator)
Compute the total number of local atoms on all processors.
int totalAtomCapacity() const
Return maximum number of atoms on all processors.
void setup()
Initialization before the loop over atoms on master processor.
int nTotal() const
Return total number of distinct groups on all processors.
AtomContext & context()
Get the AtomContext struct by non-const reference.
int validate()
Validate distribution of atoms after completion.
Saving archive for binary istream.
Abstract reader/writer for configuration files.
Vector & velocity()
Get velocity Vector by reference.
void send()
Send all groups on this processor to the master processor.
void setup()
Initialize Buffer for sending.
bool isCartesian() const
Are atom coordinates Cartesian (true) or generalized (false)?
This file contains templates for global functions send<T>, recv<T> and bcast<T>.
void receive()
Receive all atoms sent by master processor.
AngleStorage & angleStorage()
Get AngleStorage by reference.
void setClassName(const char *className)
Set class name string.
A group of covalently interacting atoms.
void setup()
Setup master processor for receiving.
int atomId
Index of atom within its parent molecule.
GroupCollector< 3 > & angleCollector()
Get the angle collector by reference.
DihedralStorage & dihedralStorage()
Get DihedralStorage by reference.
void saveConfig(Serializable::OArchive &ar)
Save configuration.
void send()
Send all atoms that have not be sent previously.
SerializeConfigIo()
Default constructor.
void transformCartToGen(const Vector &Rc, Vector &Rg) const
Transform Cartesian Vector to scaled / generalized coordinates.
Class template for distributing Group<N> objects among processors.