Simpatico
v1.10
|
A Monte-Carlo simulation of one McSystem.
Definition at line 32 of file McSimulation.h.
#include <McSimulation.h>
Public Member Functions | |
McSimulation (MPI::Intracomm &communicator) | |
Constructor. More... | |
McSimulation () | |
Constructor. More... | |
virtual | ~McSimulation () |
Destructor. More... | |
Initialization | |
void | setOptions (int argc, char **argv) |
Process command line options. More... | |
void | readParam () |
Read parameters from the default parameter istream. More... | |
virtual void | readParam (std::istream &in) |
Read specified parameter file. More... | |
virtual void | readParameters (std::istream &in) |
Read body of parameter block from a specific file. More... | |
Serialization and Restarting | |
virtual void | loadParameters (Serializable::IArchive &ar) |
Load parameters from an archive. More... | |
void | load (const std::string &filename) |
Read restart file to continue simulation. More... | |
virtual void | save (Serializable::OArchive &ar) |
Save internal state to an archive. More... | |
void | save (const std::string &filename) |
Write internal state to a restart file. More... | |
template<class Archive > | |
void | serialize (Archive &ar, unsigned int version) |
Serialize to/from an archive. More... | |
Command Script Interface | |
void | readCommands (std::istream &in) |
Read and execute commands from a command file input stream. More... | |
void | readCommands () |
Read and execute commands from the default parameter file. More... | |
bool | readCommand (std::string command, std::istream &in) |
Read and execute a single command from an input stream. More... | |
Simulation and Analysis Operations | |
void | simulate (int endStep, bool isContinuation=false) |
Run an MC simulation of specified length. More... | |
void | analyzeConfigs (int min, int max, std::string basename) |
Read and analyze a sequence of configuration files. More... | |
void | analyzeTrajectory (int min, int max, std::string classname, std::string filename) |
Read and analyze a trajectory file. More... | |
Miscellaneous | |
McSystem & | system () |
Get the McSystem by reference. More... | |
const McSystem & | system () const |
Get the McSystem by const refererence. More... | |
Factory< McMove > & | mcMoveFactory () |
Get the McMove factory by reference. More... | |
virtual bool | isValid () const |
Return true if valid, or throw an Exception. More... | |
![]() | |
Simulation (MPI::Intracomm &communicator) | |
Constructor. More... | |
Simulation () | |
Constructor. More... | |
virtual | ~Simulation () |
Destructor. More... | |
void | outputOptions (std::ostream &out) const |
Output a list of options enabled and disabled during compilation. More... | |
virtual void | setIoCommunicator (MPI::Intracomm &communicator) |
Set MPI job to read one parameter file and one command file. More... | |
void | setIoCommunicator () |
Set MPI job to read one parameter file and one command file. More... | |
void | writeParam (std::string filename) |
Open output, write and close an output parameter file. More... | |
void | allocateMoleculeSet (Util::ArraySet< Molecule > &set, int speciesId) const |
Allocate and initialize a molecule set for one Species. More... | |
Molecule & | getMolecule (int speciesId) |
Get a new molecule from a reservoir of unused Molecule objects. More... | |
void | returnMolecule (Molecule &molecule) |
Return a molecule to a reservoir of unused molecules. More... | |
Random & | random () |
Get the random number generator by reference. More... | |
Species & | species (int i) |
Get a specific Species by reference. More... | |
Factory< Analyzer > & | analyzerFactory () |
Return the Analyzer factory by reference. More... | |
Factory< Species > & | speciesFactory () |
Return the Species Factory by reference. More... | |
FileMaster & | fileMaster () |
Get the FileMaster object. More... | |
MPI::Intracomm & | communicator () |
Get the MPI communicator by reference. More... | |
int | iStep () const |
Get value of step index for main MC or MD loop. More... | |
int | nAtomType () const |
Get the number of atom types. More... | |
const AtomType & | atomType (int i) const |
Get a single AtomType object by const reference. More... | |
const Array< AtomType > & | atomTypes () const |
Get a const Array of all AtomType objects. More... | |
int | nSpecies () const |
Get the number of Species in this Simulation. More... | |
const Species & | species (int i) const |
Get a specific Species by const reference. More... | |
int | moleculeCapacity () const |
Get the total number of Molecules allocated. More... | |
int | atomCapacity () const |
Get the total number of Atoms allocated. More... | |
int | nSystem () const |
Get the number of Systems in this Simulation. More... | |
bool | hasSpecies () const |
Has data for all species structures and capacities. More... | |
MaskPolicy | maskedPairPolicy () const |
Return the value of the mask policy (MaskNone or MaskBonded). More... | |
int | nBondType () const |
Get the number of bond types. More... | |
int | bondCapacity () const |
Get the total number of Bonds allocated. More... | |
int | nAngleType () const |
Get the number of angle types. More... | |
int | angleCapacity () const |
Get the total number of Angles allocated. More... | |
int | nDihedralType () const |
Get the number of dihedral types. More... | |
int | dihedralCapacity () const |
Get the total number of Dihedrals allocated. More... | |
int | hasCoulomb () const |
Does a Coulomb potential exist? More... | |
int | hasExternal () const |
Does an external potential exist? More... | |
int | nLinkType () const |
Get the number of link types. More... | |
bool | hasCommunicator () const |
Does the simulation have an associated MPI communicator? More... | |
![]() | |
ParamComposite () | |
Constructor. More... | |
ParamComposite (const ParamComposite &other) | |
Copy constructor. More... | |
ParamComposite (int capacity) | |
Constructor. More... | |
virtual | ~ParamComposite () |
Virtual destructor. More... | |
void | resetParam () |
Resets ParamComposite to its empty state. More... | |
virtual void | readParamOptional (std::istream &in) |
Read optional parameter file block. More... | |
virtual void | writeParam (std::ostream &out) |
Write all parameters to an output stream. More... | |
virtual void | load (Serializable::IArchive &ar) |
Load all parameters from an input archive. More... | |
virtual void | loadOptional (Serializable::IArchive &ar) |
Load an optional ParamComposite. More... | |
void | saveOptional (Serializable::OArchive &ar) |
Saves isActive flag, and then calls save() iff isActive is true. More... | |
void | readParamComposite (std::istream &in, ParamComposite &child, bool next=true) |
Add and read a required child ParamComposite. More... | |
void | readParamCompositeOptional (std::istream &in, ParamComposite &child, bool next=true) |
Add and attempt to read an optional child ParamComposite. More... | |
template<typename Type > | |
ScalarParam< Type > & | read (std::istream &in, const char *label, Type &value) |
Add and read a new required ScalarParam < Type > object. More... | |
template<typename Type > | |
ScalarParam< Type > & | readOptional (std::istream &in, const char *label, Type &value) |
Add and read a new optional ScalarParam < Type > object. More... | |
template<typename Type > | |
CArrayParam< Type > & | readCArray (std::istream &in, const char *label, Type *value, int n) |
Add and read a required C array parameter. More... | |
template<typename Type > | |
CArrayParam< Type > & | readOptionalCArray (std::istream &in, const char *label, Type *value, int n) |
Add and read an optional C array parameter. More... | |
template<typename Type > | |
DArrayParam< Type > & | readDArray (std::istream &in, const char *label, DArray< Type > &array, int n) |
Add and read a required DArray < Type > parameter. More... | |
template<typename Type > | |
DArrayParam< Type > & | readOptionalDArray (std::istream &in, const char *label, DArray< Type > &array, int n) |
Add and read an optional DArray < Type > parameter. More... | |
template<typename Type , int N> | |
FArrayParam< Type, N > & | readFArray (std::istream &in, const char *label, FArray< Type, N > &array) |
Add and read a required FArray < Type, N > array parameter. More... | |
template<typename Type , int N> | |
FArrayParam< Type, N > & | readOptionalFArray (std::istream &in, const char *label, FArray< Type, N > &array) |
Add and read an optional FArray < Type, N > array parameter. More... | |
template<typename Type > | |
CArray2DParam< Type > & | readCArray2D (std::istream &in, const char *label, Type *value, int m, int n, int np) |
Add and read a required CArray2DParam < Type > 2D C-array. More... | |
template<typename Type > | |
CArray2DParam< Type > & | readOptionalCArray2D (std::istream &in, const char *label, Type *value, int m, int n, int np) |
Add and read an optional CArray2DParam < Type > 2D C-array parameter. More... | |
template<typename Type > | |
DMatrixParam< Type > & | readDMatrix (std::istream &in, const char *label, DMatrix< Type > &matrix, int m, int n) |
Add and read a required DMatrix < Type > matrix parameter. More... | |
template<typename Type > | |
DMatrixParam< Type > & | readOptionalDMatrix (std::istream &in, const char *label, DMatrix< Type > &matrix, int m, int n) |
Add and read an optional DMatrix < Type > matrix parameter. More... | |
template<typename Type > | |
DSymmMatrixParam< Type > & | readDSymmMatrix (std::istream &in, const char *label, DMatrix< Type > &matrix, int n) |
Add and read a required symmetrix DMatrix. More... | |
template<typename Type > | |
DSymmMatrixParam< Type > & | readOptionalDSymmMatrix (std::istream &in, const char *label, DMatrix< Type > &matrix, int n) |
Add and read an optional DMatrix matrix parameter. More... | |
Begin & | readBegin (std::istream &in, const char *label, bool isRequired=true) |
Add and read a class label and opening bracket. More... | |
End & | readEnd (std::istream &in) |
Add and read the closing bracket. More... | |
Blank & | readBlank (std::istream &in) |
Add and read a new Blank object, representing a blank line. More... | |
void | loadParamComposite (Serializable::IArchive &ar, ParamComposite &child, bool next=true) |
Add and load a required child ParamComposite. More... | |
void | loadParamCompositeOptional (Serializable::IArchive &ar, ParamComposite &child, bool next=true) |
Add and load an optional child ParamComposite if isActive. More... | |
template<typename Type > | |
ScalarParam< Type > & | loadParameter (Serializable::IArchive &ar, const char *label, Type &value, bool isRequired) |
Add and load a new ScalarParam < Type > object. More... | |
template<typename Type > | |
ScalarParam< Type > & | loadParameter (Serializable::IArchive &ar, const char *label, Type &value) |
Add and load new required ScalarParam < Type > object. More... | |
template<typename Type > | |
CArrayParam< Type > & | loadCArray (Serializable::IArchive &ar, const char *label, Type *value, int n, bool isRequired) |
Add a C array parameter and load its elements. More... | |
template<typename Type > | |
CArrayParam< Type > & | loadCArray (Serializable::IArchive &ar, const char *label, Type *value, int n) |
Add and load a required CArrayParam< Type > array parameter. More... | |
template<typename Type > | |
DArrayParam< Type > & | loadDArray (Serializable::IArchive &ar, const char *label, DArray< Type > &array, int n, bool isRequired) |
Add an load a DArray < Type > array parameter. More... | |
template<typename Type > | |
DArrayParam< Type > & | loadDArray (Serializable::IArchive &ar, const char *label, DArray< Type > &array, int n) |
Add and load a required DArray< Type > array parameter. More... | |
template<typename Type , int N> | |
FArrayParam< Type, N > & | loadFArray (Serializable::IArchive &ar, const char *label, FArray< Type, N > &array, bool isRequired) |
Add and load an FArray < Type, N > fixed-size array parameter. More... | |
template<typename Type , int N> | |
FArrayParam< Type, N > & | loadFArray (Serializable::IArchive &ar, const char *label, FArray< Type, N > &array) |
Add and load a required FArray < Type > array parameter. More... | |
template<typename Type > | |
CArray2DParam< Type > & | loadCArray2D (Serializable::IArchive &ar, const char *label, Type *value, int m, int n, int np, bool isRequired) |
Add and load a CArray2DParam < Type > C 2D array parameter. More... | |
template<typename Type > | |
CArray2DParam< Type > & | loadCArray2D (Serializable::IArchive &ar, const char *label, Type *value, int m, int n, int np) |
Add and load a required < Type > matrix parameter. More... | |
template<typename Type > | |
DMatrixParam< Type > & | loadDMatrix (Serializable::IArchive &ar, const char *label, DMatrix< Type > &matrix, int m, int n, bool isRequired) |
Add and load a DMatrixParam < Type > matrix parameter. More... | |
template<typename Type > | |
DMatrixParam< Type > & | loadDMatrix (Serializable::IArchive &ar, const char *label, DMatrix< Type > &matrix, int m, int n) |
Add and load a required DMatrixParam < Type > matrix parameter. More... | |
template<typename Type > | |
DSymmMatrixParam< Type > & | loadDSymmMatrix (Serializable::IArchive &ar, const char *label, DMatrix< Type > &matrix, int n, bool isRequired) |
Add and load a symmetric DSymmMatrixParam < Type > matrix parameter. More... | |
template<typename Type > | |
DSymmMatrixParam< Type > & | loadDSymmMatrix (Serializable::IArchive &ar, const char *label, DMatrix< Type > &matrix, int n) |
Add and load a required DSymmMatrixParam < Type > matrix parameter. More... | |
void | addParamComposite (ParamComposite &child, bool next=true) |
Add a child ParamComposite object to the format array. More... | |
Begin & | addBegin (const char *label) |
Add a Begin object representing a class name and bracket. More... | |
End & | addEnd () |
Add a closing bracket. More... | |
Blank & | addBlank () |
Create and add a new Blank object, representing a blank line. More... | |
std::string | className () const |
Get class name string. More... | |
bool | isRequired () const |
Is this ParamComposite required in the input file? More... | |
bool | isActive () const |
Is this parameter active? More... | |
![]() | |
virtual | ~ParamComponent () |
Destructor. More... | |
void | setIndent (const ParamComponent &parent, bool next=true) |
Set indent level. More... | |
std::string | indent () const |
Return indent string for this object (string of spaces). More... | |
template<class Archive > | |
void | serialize (Archive &ar, const unsigned int version) |
Serialize this ParamComponent as a string. More... | |
![]() | |
virtual | ~Serializable () |
Destructor. More... | |
![]() | |
MpiFileIo () | |
Constructor. More... | |
MpiFileIo (const MpiFileIo &other) | |
Copy constructor. More... | |
bool | isIoProcessor () const |
Can this processor do file I/O ? More... | |
void | setIoCommunicator (MPI::Intracomm &communicator) |
Set the communicator. More... | |
void | clearCommunicator () |
Clear (nullify) the communicator. More... | |
bool | hasIoCommunicator () const |
Does this object have an associated MPI communicator? More... | |
MPI::Intracomm & | ioCommunicator () const |
Get the MPI communicator by reference. More... | |
Protected Member Functions | |
McMoveManager & | mcMoveManager () |
Get the McMoveManager by reference. More... | |
![]() | |
void | setAnalyzerManager (AnalyzerManager *ptr) |
Set the associated AnalyzerManager. More... | |
AnalyzerManager & | analyzerManager () |
Get the associated AnalyzerManager by reference. More... | |
void | setCommandManager (CommandManager *ptr) |
Set the associated CommandManager. More... | |
CommandManager & | commandManager () |
Get the associated CommandManager by reference. More... | |
![]() | |
void | setClassName (const char *className) |
Set class name string. More... | |
void | setIsRequired (bool isRequired) |
Set or unset the isActive flag. More... | |
void | setIsActive (bool isActive) |
Set or unset the isActive flag. More... | |
void | setParent (ParamComponent ¶m, bool next=true) |
Set this to the parent of a child component. More... | |
void | addComponent (ParamComponent ¶m, bool isLeaf=true) |
Add a new ParamComponent object to the format array. More... | |
template<typename Type > | |
ScalarParam< Type > & | add (std::istream &in, const char *label, Type &value, bool isRequired=true) |
Add a new required ScalarParam < Type > object. More... | |
template<typename Type > | |
CArrayParam< Type > & | addCArray (std::istream &in, const char *label, Type *value, int n, bool isRequired=true) |
Add (but do not read) a required C array parameter. More... | |
template<typename Type > | |
DArrayParam< Type > & | addDArray (std::istream &in, const char *label, DArray< Type > &array, int n, bool isRequired=true) |
Add (but do not read) a DArray < Type > parameter. More... | |
template<typename Type , int N> | |
FArrayParam< Type, N > & | addFArray (std::istream &in, const char *label, FArray< Type, N > &array, bool isRequired=true) |
Add (but do not read) a FArray < Type, N > array parameter. More... | |
template<typename Type > | |
CArray2DParam< Type > & | addCArray2D (std::istream &in, const char *label, Type *value, int m, int n, int np, bool isRequired=true) |
Add (but do not read) a CArray2DParam < Type > 2D C-array. More... | |
template<typename Type > | |
DMatrixParam< Type > & | addDMatrix (std::istream &in, const char *label, DMatrix< Type > &matrix, int m, int n, bool isRequired=true) |
Add and read a required DMatrix < Type > matrix parameter. More... | |
![]() | |
ParamComponent () | |
Constructor. More... | |
ParamComponent (const ParamComponent &other) | |
Copy constructor. More... | |
Additional Inherited Members | |
![]() | |
typedef BinaryFileOArchive | OArchive |
Type of output archive used by save method. More... | |
typedef BinaryFileIArchive | IArchive |
Type of input archive used by load method. More... | |
![]() | |
static void | initStatic () |
Initialize static echo member to false. More... | |
static void | setEcho (bool echo=true) |
Enable or disable echoing for all subclasses of ParamComponent. More... | |
static bool | echo () |
Get echo parameter. More... | |
![]() | |
int | iStep_ |
Step index for main MC or MD loop. More... | |
int | nSystem_ |
Number of Systems of interacting molecules (> 1 in Gibbs ensemble). More... | |
McMd::McSimulation::McSimulation | ( | MPI::Intracomm & | communicator | ) |
Constructor.
Definition at line 62 of file McSimulation.cpp.
References McMd::Simulation::fileMaster(), McMd::Simulation::setAnalyzerManager(), Util::ParamComposite::setClassName(), McMd::Simulation::setCommandManager(), McMd::System::setFileMaster(), McMd::System::setId(), McMd::System::setSimulation(), and system().
McMd::McSimulation::McSimulation | ( | ) |
Constructor.
Definition at line 90 of file McSimulation.cpp.
References McMd::Simulation::fileMaster(), McMd::Simulation::setAnalyzerManager(), Util::ParamComposite::setClassName(), McMd::Simulation::setCommandManager(), McMd::System::setFileMaster(), McMd::System::setId(), McMd::System::setSimulation(), and system().
|
virtual |
Destructor.
Definition at line 117 of file McSimulation.cpp.
void McMd::McSimulation::setOptions | ( | int | argc, |
char ** | argv | ||
) |
Process command line options.
Main options:
-q Query: Print enabled/disabled features
-e Echo: Enable echoing of parameter file
-r filename Restart: restart from specified file
-p filename Parameter: Specify a parameter file
-c filename Command: Specify a command file
-i path Input: Specify path prefix for input files
-o path Input: Specify path prefix for output files
The -p and -r options are mutually exclusive: When a simulation is restarted, all information required from a parameter file is in the restart file.
argc | number of arguments |
argv | vector of pointers to char* string arguments |
Definition at line 123 of file McSimulation.cpp.
References Util::Log::file(), McMd::Simulation::fileMaster(), load(), McMd::Simulation::outputOptions(), Util::FileMaster::setCommandFileName(), Util::ParamComponent::setEcho(), McMd::System::setExpectPerturbation(), Util::FileMaster::setInputPrefix(), McMd::Simulation::setIoCommunicator(), Util::FileMaster::setOutputPrefix(), Util::FileMaster::setParamFileName(), system(), and UTIL_THROW.
void McMd::McSimulation::readParam | ( | ) |
Read parameters from the default parameter istream.
Calls readParam(std::istream&) internally, with a default parameter file istream given by the return value of FileMaster::paramFile().
Single parameter file: If compiled as a serial program (ifndef UTIL_MPI) or as a parallel program in mode that uses a single parameter file (i.e., with option -f), the parameter file name is the argument passed to the -p command line option, if the main program is invoked with the -p option, or the parameter file is read from standard input, std::cin, if not invoked with a -p option.
Multiple parameter files: If compiled as a parallel program (ifdef UITL_MPI) and used in a mode with separate parameter files for independent simulations (i.e., without the -f option), then the parameter file for the simulation performed by processor number n is file named n/filename, where "filename" is either the argument of the -p command line option, if invoked with that option, or the default string filename = "param".
Definition at line 311 of file McSimulation.cpp.
References McMd::Simulation::fileMaster().
|
virtual |
Read specified parameter file.
Returns and does nothing if in process of restarting (i.e., if the main program was invoked with -r option). This calls readParameters(std::istream& ) internally.
in | parameter file stream |
Reimplemented from Util::ParamComposite.
Definition at line 296 of file McSimulation.cpp.
References Util::ParamComposite::className(), Util::ParamComposite::readBegin(), Util::ParamComposite::readEnd(), and readParameters().
|
virtual |
Read body of parameter block from a specific file.
in | parameter file input stream. |
Reimplemented from McMd::Simulation.
Definition at line 259 of file McSimulation.cpp.
References McMd::Simulation::analyzerManager(), McMd::Analyzer::baseInterval, McMd::Simulation::commandManager(), isValid(), mcMoveManager(), Util::ParamComposite::readParamComposite(), Util::ParamComposite::readParamCompositeOptional(), McMd::Simulation::readParameters(), system(), and UTIL_THROW.
Referenced by readParam().
|
virtual |
Load parameters from an archive.
ar | input/loading archive |
Reimplemented from McMd::Simulation.
Definition at line 317 of file McSimulation.cpp.
References McMd::Simulation::analyzerManager(), McMd::Simulation::commandManager(), Util::MpiFileIo::hasIoCommunicator(), McMd::Simulation::iStep_, isValid(), McMd::McSystem::loadConfig(), Util::ParamComposite::loadParamComposite(), McMd::Simulation::loadParameters(), mcMoveManager(), system(), and UTIL_THROW.
void McMd::McSimulation::load | ( | const std::string & | filename | ) |
Read restart file to continue simulation.
filename | name of input restart file |
Definition at line 363 of file McSimulation.cpp.
References Util::Log::file(), Util::BinaryFileIArchive::file(), McMd::Simulation::fileMaster(), Util::FileMaster::openRestartIFile(), McMd::Simulation::setIoCommunicator(), system(), and UTIL_THROW.
Referenced by setOptions().
|
virtual |
Save internal state to an archive.
ar | output/saving archive |
Reimplemented from McMd::Simulation.
Definition at line 347 of file McSimulation.cpp.
References McMd::Simulation::analyzerManager(), McMd::Simulation::commandManager(), McMd::Simulation::iStep_, mcMoveManager(), McMd::AnalyzerManager::save(), McMd::McMoveManager::save(), Util::Manager< Data >::save(), McMd::Simulation::save(), McMd::System::saveConfig(), McMd::McSystem::saveParameters(), and system().
Referenced by save(), and simulate().
void McMd::McSimulation::save | ( | const std::string & | filename | ) |
Write internal state to a restart file.
filename | name of output restart file |
Definition at line 393 of file McSimulation.cpp.
References Util::BinaryFileOArchive::file(), McMd::Simulation::fileMaster(), Util::FileMaster::openRestartOFile(), and save().
void McMd::McSimulation::serialize | ( | Archive & | ar, |
unsigned int | version | ||
) |
Serialize to/from an archive.
ar | saving or loading archive |
version | archive version id |
void McMd::McSimulation::readCommands | ( | std::istream & | in | ) |
Read and execute commands from a command file input stream.
in | command file input stream |
Definition at line 405 of file McSimulation.cpp.
References McMd::Simulation::commandManager(), McMd::Simulation::communicator(), Util::Log::file(), Util::getNextLine(), Util::MpiFileIo::hasIoCommunicator(), Util::MpiFileIo::isIoProcessor(), McMd::Simulation::iStep_, McMd::CommandManager::readCommand(), simulate(), and UTIL_THROW.
void McMd::McSimulation::readCommands | ( | ) |
Read and execute commands from the default parameter file.
This method opens the file with the name commandFile read by the FileMaster.
Definition at line 482 of file McSimulation.cpp.
References McMd::Simulation::fileMaster(), and UTIL_THROW.
bool McMd::McSimulation::readCommand | ( | std::string | command, |
std::istream & | in | ||
) |
Read and execute a single command from an input stream.
Usage: The capitalized command name string must have been read from istream "in" and passed as the "command" argument. If the command name is recognized, any additional arguments are read from stream "in", the command is executed, and a value of true is returned. A value of false is returned iff the command name string is not recognized.
Implementation: Calls CommandManager::readCommand().
command | command name string |
in | command input stream |
Definition at line 493 of file McSimulation.cpp.
References McMd::Simulation::commandManager(), and McMd::CommandManager::readCommand().
void McMd::McSimulation::simulate | ( | int | endStep, |
bool | isContinuation = false |
||
) |
Run an MC simulation of specified length.
This method implements the main MC loop. The step counter iStep is incremented until it reaches endStep. Each step involves a random selection and attempt of one Markov MC move. Upon exit, iStep_ = endStep.
If isContinuation is false, the step counter iStep is initialized to zero, and analyzers and mcmoves are set to default initial states before entering the main loop. If isContinuation is true, no such initialization is done for iStep_, analyzers, or the MC moves.
endStep | Final value of MC step counter iStep_. |
isContinuation | Is this a continuation of a previous run? |
Definition at line 499 of file McSimulation.cpp.
References McMd::Simulation::analyzerManager(), McMd::Analyzer::baseInterval, McMd::McPairPotential::buildCellList(), McMd::McMoveManager::chooseMove(), Util::Manager< Data >::className(), Util::Log::file(), McMd::Simulation::iStep_, mcMoveManager(), McMd::McMove::move(), McMd::ReplicaMove::move(), McMd::ReplicaMove::nAccept(), McMd::ReplicaMove::nAttempt(), Util::Signal< T >::notify(), McMd::AnalyzerManager::output(), McMd::McMoveManager::output(), McMd::McSystem::pairPotential(), McMd::McSystem::positionSignal(), McMd::System::replicaMove(), McMd::AnalyzerManager::sample(), save(), McMd::AnalyzerManager::setup(), Util::Manager< Data >::size(), Util::Timer::start(), Util::Timer::stop(), system(), Util::Timer::time(), and UTIL_THROW.
Referenced by readCommands(), and McMd::McCommandManager::readStandardCommand().
void McMd::McSimulation::analyzeConfigs | ( | int | min, |
int | max, | ||
std::string | basename | ||
) |
Read and analyze a sequence of configuration files.
This method reads and analyzes a sequence of configuration files, which were normally generated by running a previous simulation using ConfigWriter, and applies the sample() method of every Analyzer to each such configuration.
The method reads a sequence of configuration files with names of the form inputPrefix + basename + n for integer suffixes in the range min <= n <= max. This is consistent with the output format format used by the WriteConfig class. The inputPrefix used in an analysis simulation is often a directory name, with a trailing directory separator "/", that is equal to the outputPrefix used in the earlier simulation run.
In parallel mode, for processor with MPI rank m, the path "m/" is prepended to the fileMaster input prefix, so that paths to all files associated with processor m begin with the string "m/inputPrefix" + basename.
min | integer suffix of first configuration file name |
max | integer suffix of last configuration file name |
basename | root name for dump files (without integer suffix) |
Definition at line 655 of file McSimulation.cpp.
References McMd::Simulation::analyzerManager(), McMd::Analyzer::baseInterval, McMd::McPairPotential::buildCellList(), Util::Log::file(), McMd::Simulation::fileMaster(), McMd::Simulation::iStep_, isValid(), Util::FileMaster::openInputFile(), McMd::AnalyzerManager::output(), McMd::McSystem::pairPotential(), McMd::McSystem::readConfig(), McMd::System::removeAllMolecules(), McMd::AnalyzerManager::sample(), McMd::AnalyzerManager::setup(), Util::Timer::start(), Util::Timer::stop(), system(), Util::Timer::time(), and UTIL_CHECK.
Referenced by McMd::McCommandManager::readStandardCommand().
void McMd::McSimulation::analyzeTrajectory | ( | int | min, |
int | max, | ||
std::string | classname, | ||
std::string | filename | ||
) |
Read and analyze a trajectory file.
This function uses an instance of the TrajectoryReader class specified by the "classname" argument to read a trajectory file with a path of the form inputPrefix + filename.
min | start at this frame number |
max | end at this frame number |
classname | name of the TrajectoryReader class to use |
filename | name of the trajectory file |
Definition at line 726 of file McSimulation.cpp.
References McMd::Simulation::analyzerManager(), McMd::McPairPotential::buildCellList(), McMd::TrajectoryReader::close(), Util::Factory< Data >::factory(), Util::Log::file(), McMd::Simulation::iStep_, isValid(), McMd::TrajectoryReader::open(), McMd::AnalyzerManager::output(), McMd::McSystem::pairPotential(), McMd::TrajectoryReader::readFrame(), McMd::AnalyzerManager::sample(), McMd::AnalyzerManager::setup(), Util::Timer::start(), Util::Timer::stop(), system(), Util::Timer::time(), McMd::System::trajectoryReaderFactory(), and UTIL_THROW.
Referenced by McMd::McCommandManager::readStandardCommand().
|
inline |
Get the McSystem by reference.
Definition at line 347 of file McSimulation.h.
Referenced by analyzeConfigs(), analyzeTrajectory(), isValid(), load(), loadParameters(), McSimulation(), readParameters(), save(), setOptions(), and simulate().
|
inline |
Get the McSystem by const refererence.
Definition at line 353 of file McSimulation.h.
Get the McMove factory by reference.
Definition at line 792 of file McSimulation.cpp.
References Util::Manager< Data >::factory(), and mcMoveManager().
Referenced by McMd::SliplinkMcModule::SliplinkMcModule().
|
virtual |
Return true if valid, or throw an Exception.
Reimplemented from McMd::Simulation.
Definition at line 798 of file McSimulation.cpp.
References McMd::McSystem::isValid(), McMd::Simulation::isValid(), system(), and UTIL_THROW.
Referenced by analyzeConfigs(), analyzeTrajectory(), loadParameters(), and readParameters().
|
inlineprotected |
Get the McMoveManager by reference.
Definition at line 360 of file McSimulation.h.
Referenced by loadParameters(), mcMoveFactory(), readParameters(), save(), and simulate().