8 #include "LammpsDumpReader.h" 9 #include <mcMd/simulation/System.h> 10 #include <mcMd/simulation/Simulation.h> 11 #include <simp/species/Species.h> 12 #include <mcMd/chemistry/Molecule.h> 13 #include <mcMd/chemistry/Atom.h> 14 #include <util/space/Vector.h> 15 #include <util/space/IntVector.h> 16 #include <util/misc/ioUtil.h> 50 if (!positions_.isAllocated()) {
54 UTIL_THROW(
"Inconsistent values of atom capacity");
65 if (!positions_.isAllocated()) {
66 UTIL_THROW(
"positions_ array is not allocated");
70 std::stringstream line;
87 UTIL_THROW(
"EOF reading ITEM: NUMBER OF ATOMS");
96 UTIL_THROW(
"Inconsistent values: nAtom != nAtomTotal_");
109 file_ >> min[i] >> max[i];
110 lengths[i] = max[i] - min[i];
122 int id, typeId, molId, i, j;
123 for (i = 0; i < nAtom; ++i) {
132 file_ >> positions_[id][j];
149 for (iMol = 0; iMol < speciesPtr->
capacity(); ++iMol) {
151 for (molPtr->
begin(atomIter); atomIter.
notEnd(); ++atomIter) {
152 atomIter->position() = positions_[id];
System & system() const
Get a reference to the parent System.
const int Dimension
Dimensionality of space.
A Vector is a Cartesian vector.
bool readFrame()
Read a single frame.
bool notEnd() const
Is the current pointer not at the end of the array?
void setOrthorhombic(const Vector &lengths)
Set unit cell dimensions for orthorhombic boundary.
virtual ~LammpsDumpReader()
Destructor.
virtual void addMolecules()
Add all molecules to system.
void begin(AtomIterator &iterator)
Set an Molecule::AtomIterator to first Atom in this Molecule.
A set of interacting Molecules enclosed by a Boundary.
void openInputFile(const std::string &filename, std::ifstream &in, std::ios_base::openmode mode=std::ios_base::in) const
Open an input file.
void open(std::string filename)
Open file.
Simulation & simulation() const
Get a reference to the parent Simulation.
bool getNextLine(std::istream &in, std::string &line)
Read the next non-empty line into a string, strip trailing whitespace.
Molecule & molecule(int speciesId, int moleculeId)
Get a specific Molecule in this System, by integer index.
#define UTIL_THROW(msg)
Macro for throwing an Exception, reporting function, file and line number.
Utility classes for scientific computation.
void shift(Vector &r) const
Shift Cartesian Vector r to its primary image.
Trajectory file reader (base class).
void checkString(std::istream &in, const std::string &expected)
Extract string from stream, and compare to expected value.
Forward iterator for an Array or a C array.
int nAtomTotal_
Total number of atoms (all species)
Boundary & boundary() const
Get the Boundary.
Single-processor Monte Carlo (MC) and molecular dynamics (MD).
int nSpecies() const
Get the number of Species in this Simulation.
LammpsDumpReader(System &system)
Constructor.
An IntVector is an integer Cartesian vector.
int capacity() const
Maximum allowed number of molecules for this Species.
A physical molecule (a set of covalently bonded Atoms).
A Species represents a set of chemically similar molecules.
Species & species(int i)
Get a specific Species by reference.
FileMaster & fileMaster()
Get the FileMaster object.