8 #include "DdMdConfigWriter.h" 10 #include <tools/chemistry/Atom.h> 11 #include <tools/chemistry/Group.h> 12 #include <tools/chemistry/Species.h> 14 #include <tools/storage/Configuration.h> 16 #include <util/space/Vector.h> 17 #include <util/format/Int.h> 18 #include <util/format/Dbl.h> 30 hasMolecules_(hasMolecules)
37 int DdMdConfigWriter::writeGroups(std::ofstream& file,
const char* sectionLabel,
41 int nGroup = configuration().
bonds().
size();
44 file << sectionLabel << std::endl;
45 file << nGroupLabel <<
Int(nGroup, 10) << std::endl;
47 file << *iter << std::endl;
58 if (!file.is_open()) {
63 file <<
"BOUNDARY" << std::endl << std::endl;
64 file << configuration().
boundary() << std::endl;
68 file <<
"ATOMS" << std::endl;
69 int nAtom = configuration().
atoms().
size();
70 file <<
"nAtom" <<
Int(nAtom, 10) << std::endl;
74 for (; iter.
notEnd(); ++iter) {
75 file <<
Int(iter->id, 10)
76 <<
Int(iter->typeId, 6);
79 file << Int(iter->speciesId, 6)
80 << Int(iter->moleculeId, 10)
81 << Int(iter->atomId, 6);
84 <<
"\n" << iter->velocity <<
"\n";
89 if (configuration().bonds().capacity()) {
90 writeGroups(file,
"BONDS",
"nBond", configuration().bonds());
95 if (configuration().angles().capacity()) {
96 writeGroups(file,
"ANGLES",
"nAngle", configuration().angles());
101 if (configuration().dihedrals().capacity()) {
102 writeGroups(file,
"DIHEDRALS",
"nDihedral", configuration().dihedrals());
int size() const
Return logical size of this array (i.e., number of elements).
A Vector is a Cartesian vector.
bool notEnd() const
Is the current pointer not at the end of the array?
#define UTIL_THROW(msg)
Macro for throwing an Exception, reporting function, file and line number.
Utility classes for scientific computation.
Wrapper for an int, for formatted ostream output.
Forward iterator for an Array or a C array.
void begin(ArrayIterator< Group< N > > &iterator)
Set an ArrayIterator to the beginning of this Array.
void setClassName(const char *className)
Set class name string.