9 #include <mcMd/mcMoves/McMoveManager.h> 10 #include <mcMd/mcMoves/McMoveFactory.h> 11 #include <mcMd/mcSimulation/McSimulation.h> 13 #include <util/random/Random.h> 23 simulationPtr_(&simulation),
24 systemPtr_(&simulation.system()),
25 randomPtr_(&simulation.random())
47 double totalProbability = 0.0;
49 for (iMove = 0; iMove <
size(); ++iMove) {
50 probabilities_[iMove] = (*this)[iMove].probability();
51 totalProbability += probabilities_[iMove];
55 for (iMove = 0; iMove <
size(); ++iMove) {
56 probabilities_[iMove] = probabilities_[iMove]/totalProbability;
57 (*this)[iMove].setProbability(probabilities_[iMove]);
84 for (
int iMove = 0; iMove <
size(); ++iMove) {
85 (*this)[iMove].setup();
95 iMove = randomPtr_->
drawFrom(&probabilities_[0],
size());
96 return (*
this)[iMove];
104 for (
int i=0; i<
size(); i++) {
virtual void loadParameters(Serializable::IArchive &ar)
Load a set of objects to an output archive.
virtual void save(Serializable::OArchive &ar)
Save a set of objects to an output archive.
virtual void loadParameters(Serializable::IArchive &ar)
Load internal state from an archive.
virtual void readParameters(std::istream &in)
Read instructions for creating McMove objects.
McMove is an abstract base class for Monte Carlo moves.
File containing preprocessor macros for error handling.
long drawFrom(double probability[], long size)
Choose one of several outcomes with a specified set of probabilities.
Saving / output archive for binary ostream.
A Monte-Carlo simulation of one McSystem.
void setup()
Initialize at beginning of simulation run.
void output()
Output statistics for all moves.
Template container for pointers to objects with a common base class.
Utility classes for scientific computation.
virtual void save(Serializable::OArchive &ar)
Save internal state to an archive.
virtual void readParameters(std::istream &in)
Read child blocks, return when closing bracket encountered.
McMoveFactory for an McSimulation.
~McMoveManager()
Destructor.
Saving archive for binary istream.
Single-processor Monte Carlo (MC) and molecular dynamics (MD).
void setClassName(const char *className)
Set class name string.
void allocate(int capacity)
Allocate the underlying C array.
int size() const
Get logical size.
McMoveManager(McSimulation &simulation)
Constructor.
McMove & chooseMove()
Choose an McMove at random, using specified probabilities.