8 #include "SemiGrandDistribution.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> 31 moleculeCapacity_(-1),
43 read<int>(in,
"speciesId", speciesId_);
46 moleculeCapacity_ = speciesPtr_->capacity();
47 if (moleculeCapacity_ <= 0) {
50 if (!speciesPtr_->isMutable()) {
53 mutatorPtr_ = &speciesPtr_->mutator();
56 distribution_.
setParam(0, moleculeCapacity_);
57 distribution_.
clear();
66 loadParameter<int>(ar,
"speciesId", speciesId_);
67 ar & moleculeCapacity_;
74 if (moleculeCapacity_ <= 0) {
78 if (moleculeCapacity_ != speciesPtr_->
capacity()) {
84 mutatorPtr_ = &speciesPtr_->
mutator();
110 distribution_.
output(outputFile_);
A System for use in a Markov chain Monte Carlo simulation.
SemiGrandDistribution(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.
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.
virtual void output()
Output final summary and file format.
void output(std::ostream &out)
Output the distribution to file.
#define UTIL_THROW(msg)
Macro for throwing an Exception, reporting function, file and line number.
void clear()
Clear (i.e., zero) previously allocated histogram.
void setParam(int min, int max)
Set parameters and initialize.
Simulation & simulation() const
Get the parent Simulation by reference.
void sample(int value)
Sample a value.
void readInterval(std::istream &in)
Read interval from file, with error checking.
Utility classes for scientific computation.
virtual void loadParameters(Serializable::IArchive &ar)
Load state from an archive.
Template for Analyzer associated with one System.
int stateOccupancy(int stateId) const
Get the number of molecules with a specified state.
void sample(long iStep)
Evaluate energy and print.
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?
virtual void readParameters(std::istream &in)
Read output file and nStepPerSample.
void setClassName(const char *className)
Set class name string.
int capacity() const
Maximum allowed number of molecules for this Species.
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.
McMd::SpeciesMutator & mutator()
Return the species mutator object by reference.
Species & species(int i)
Get a specific Species by reference.