8 #include "TypeDistribution.h" 10 #include <mcMd/simulation/Simulation.h> 11 #include <mcMd/species/SpeciesMutator.h> 12 #include <simp/species/Species.h> 13 #include <util/format/Dbl.h> 14 #include <util/format/Int.h> 15 #include <util/misc/FileMaster.h> 42 read<int>(in,
"speciesId", speciesId_);
45 if (!speciesPtr_->isMutable()) {
48 mutatorPtr_ = &speciesPtr_->mutator();
49 nState_ = mutatorPtr_->
nState();
53 for (
int i = 0; i < nState_; ++i) {
65 loadParameter<int>(ar,
"speciesId", speciesId_);
77 mutatorPtr_ = &speciesPtr_->
mutator();
78 if (nState_ != mutatorPtr_->
nState()) {
96 for (
int i = 0; i < nState_; ++i) {
113 double norm = 1.0/double(nSample_);
114 for (
int i = 0; i < nState_; ++i) {
115 outputFile_ <<
Int(i,5)
116 <<
Dbl(distribution_[i]*norm, 15) << std::endl;
virtual void readParameters(std::istream &in)
Read output file and nStepPerSample.
A System for use in a Markov chain Monte Carlo simulation.
int nState() const
Get the number of possible molecule states.
void sample(long iStep)
Calculate, analyze and/or output a physical quantity.
TypeDistribution(McSystem &system)
Constructor.
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.
McSystem & system()
Return reference to parent system.
Wrapper for a double precision number, for formatted ostream output.
virtual void save(Serializable::OArchive &ar)
Save state to an archive.
Classes used by all simpatico molecular simulations.
void readOutputFileName(std::istream &in)
Read outputFileName from file.
Saving / output archive for binary ostream.
#define UTIL_THROW(msg)
Macro for throwing an Exception, reporting function, file and line number.
virtual void output()
Output any results at the end of the simulation.
Simulation & simulation() const
Get the parent Simulation by reference.
void readInterval(std::istream &in)
Read interval from file, with error checking.
Utility classes for scientific computation.
Wrapper for an int, for formatted ostream output.
Template for Analyzer associated with one System.
int stateOccupancy(int stateId) const
Get the number of molecules with a specified state.
Saving archive for binary istream.
Single-processor Monte Carlo (MC) and molecular dynamics (MD).
int nSpecies() const
Get the number of Species in this Simulation.
bool isMutable() const
Is this a mutable Species?
void setClassName(const char *className)
Set class name string.
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.
void allocate(int capacity)
Allocate the underlying C array.
McMd::SpeciesMutator & mutator()
Return the species mutator object by reference.
Species & species(int i)
Get a specific Species by reference.
virtual void loadParameters(Serializable::IArchive &ar)
Load state from an archive.