8 #include "OutputEnergy.h" 9 #include <ddMd/potentials/pair/PairPotential.h> 11 #include <ddMd/potentials/bond/BondPotential.h> 14 #include <ddMd/potentials/angle/AnglePotential.h> 17 #include <ddMd/potentials/dihedral/DihedralPotential.h> 20 #include <ddMd/potentials/external/ExternalPotential.h> 22 #include <util/format/Int.h> 23 #include <util/format/Dbl.h> 24 #include <util/mpi/MpiLoader.h> 25 #include <util/misc/ioUtil.h> 54 isInitialized_ =
true;
65 loader.
load(nSample_);
70 isInitialized_ =
true;
112 outputFile_ <<
Int(iStep, 10)
114 double potential = 0.0;
117 outputFile_ << Dbl(pair, 15);
122 outputFile_ << Dbl(bond, 15);
129 outputFile_ << Dbl(angle, 15);
135 potential += dihedral;
136 outputFile_ << Dbl(dihedral, 15);
142 potential += external;
143 outputFile_ << Dbl(external, 15);
146 outputFile_ << Dbl(kinetic + potential, 20)
virtual void readParameters(std::istream &in)
Read dumpPrefix and interval.
Abstract base for periodic output and/or analysis actions.
Simulation & simulation()
Get the parent Simulation by reference.
virtual void sample(long iStep)
Write energy to file.
const BondPotential & bondPotential() const
Get the PairPotential by const reference.
void readOutputFileName(std::istream &in)
Read outputFileName from file.
void saveInterval(Serializable::OArchive &ar)
Save interval parameter to an archive.
double kineticEnergy()
Return precomputed total kinetic energy.
void openOutputFile(const std::string &filename, std::ofstream &out, std::ios_base::openmode mode=std::ios_base::out) const
Open an output file.
void readInterval(std::istream &in)
Read parameter interval from file.
Wrapper for a double precision number, for formatted ostream output.
OutputEnergy(Simulation &simulation)
Constructor.
int nBondType()
Get maximum number of bond types.
Parallel domain decomposition (DD) MD simulation.
Main object for a domain-decomposition MD simulation.
const ExternalPotential & externalPotential() const
Get the ExternalPotential by reference.
Saving / output archive for binary ostream.
void loadOutputFileName(Serializable::IArchive &ar)
Load output file name to an archive.
int nDihedralType()
Get maximum number of dihedral types.
FileMaster & fileMaster()
Get the associated FileMaster by reference.
const DihedralPotential & dihedralPotential() const
Get the DihedralPotential by const reference.
void computePotentialEnergies()
Calculate and store total potential energy on all processors.
bool isAtInterval(long counter) const
Return true iff counter is a multiple of the interval.
Utility classes for scientific computation.
void load(Data &value)
Load and broadcast a single Data value.
Wrapper for an int, for formatted ostream output.
virtual void clear()
Clear nSample counter.
virtual void save(Serializable::OArchive &ar)
Save internal state to an archive.
const std::string & outputFileName() const
Return outputFileName string.
virtual void setup()
Setup - open output file.
bool isMaster() const
Is this the master processor (gridRank == 0) ?
const PairPotential & pairPotential() const
Get the PairPotential by const reference.
double energy() const
Return the total potential, from all processors.
Saving archive for binary istream.
Provides methods for MPI-aware loading of data from input archive.
virtual void loadParameters(Serializable::IArchive &ar)
Load internal state from an archive.
void setClassName(const char *className)
Set class name string.
void loadInterval(Serializable::IArchive &ar)
Load parameter interval from input archive.
const AnglePotential & anglePotential() const
Get the AnglePotential by const reference.
int nAngleType()
Get maximum number of angle types.
void saveOutputFileName(Serializable::OArchive &ar)
Save output file name to an archive.
void computeKineticEnergy()
Compute total kinetic energy.
Domain & domain()
Get the Domain by reference.
bool hasExternal()
Does this simulation have an external potential?