9 #include "PerturbDerivative.h" 10 #include <mcMd/perturb/Perturbation.h> 11 #include <util/misc/FileMaster.h> 35 read<int>(in,
"nSamplePerBlock", nSamplePerBlock_);
39 read<int>(in,
"parameterIndex", parameterIndex_);
46 isInitialized_ =
true;
55 loadParameter<int>(ar,
"nSamplePerBlock", nSamplePerBlock_);
56 loadParameter<int>(ar,
"parameterIndex", parameterIndex_);
59 if (accumulator_.nSamplePerBlock()) {
62 isInitialized_ =
true;
76 if (!isInitialized_) {
89 accumulator_.
sample(
system().perturbation().derivative(parameterIndex_), outputFile_);
108 accumulator_.
output(outputFile_);
114 #endif // ifdef MCMD_PERTURB virtual void sample(long iStep)
Calculate, analyze and/or output a physical quantity.
void clear()
Clear all accumulators, set to empty initial state.
void openOutputFile(const std::string &filename, std::ofstream &out, std::ios_base::openmode mode=std::ios_base::out) const
Open an output file.
virtual void loadParameters(Serializable::IArchive &ar)
Load parameters from archive.
A set of interacting Molecules enclosed by a Boundary.
System & system()
Return reference to parent system.
void readOutputFileName(std::istream &in)
Read outputFileName from file.
virtual void loadParameters(Serializable::IArchive &ar)
Load internal state from an archive.
Saving / output archive for binary ostream.
#define UTIL_THROW(msg)
Macro for throwing an Exception, reporting function, file and line number.
virtual void writeParam(std::ostream &out)
Write all parameters to an output stream.
PerturbDerivative(System &system)
Constructor.
void readInterval(std::istream &in)
Read interval from file, with error checking.
Utility classes for scientific computation.
Template for Analyzer associated with one System.
void output(std::ostream &out) const
Output final statistical properties to file.
virtual void setup()
Clear accumulator.
void setNSamplePerBlock(int nSamplePerBlock)
Set nSamplePerBlock.
Saving archive for binary istream.
void sample(double value)
Add a sampled value to the ensemble.
Single-processor Monte Carlo (MC) and molecular dynamics (MD).
int nSamplePerBlock() const
Get number of samples per block average.
void setClassName(const char *className)
Set class name string.
virtual void save(Serializable::OArchive &ar)
Save internal state to an archive.
FileMaster & fileMaster()
Get the FileMaster by reference.
bool isAtInterval(long counter) const
Return true iff counter is a multiple of the interval.
const std::string & outputFileName() const
Return outputFileName string.
virtual void output()
Output results at end of simulation.
virtual void readParameters(std::istream &in)
Read parameters and initialize.