|
RASPA3 3.0.13
A molecular simulation code for computing adsorption and diffusion in nanoporous materials
|
Performs Monte Carlo simulations for molecular systems. More...

Public Types | |
| enum class | WeightingMethod : std::size_t { LambdaZero = 0 , AllLambdas = 1 } |
| Enumeration of weighting methods for sampling. More... | |
| enum class | SimulationStage : std::size_t { Uninitialized = 0 , Initialization = 1 , Equilibration = 2 , Production = 3 } |
| Enumeration of simulation stages. More... | |
Public Member Functions | |
| MonteCarlo () | |
| Default constructor for the MonteCarlo class. | |
| MonteCarlo (InputReader &reader) noexcept | |
| Constructs a MonteCarlo object with simulation parameters from an InputReader. | |
| MonteCarlo (std::size_t numberOfCycles, std::size_t numberOfInitializationCycles, std::size_t numberOfEquilibrationCycles, std::size_t printEvery, std::size_t writeBinaryRestartEvery, std::size_t rescaleWangLandauEvery, std::size_t optimizeMCMovesEvery, std::vector< System > &systems, RandomNumber &randomSeed, std::size_t numberOfBlocks, bool outputToFiles=false) | |
| Constructs a MonteCarlo object with specified simulation parameters. | |
| void | createOutputFiles () |
| Creates output files for writing simulation data. | |
| void | writeOutputHeader () |
| Write the output header. | |
| void | createInterpolationGrids () |
| Creates energy interpolation grids. | |
| void | run () |
| Runs the Monte Carlo simulation. | |
| void | performCycle () |
| Performs a single Monte Carlo cycle. | |
| void | initialize () |
| Performs the initialization stage of the simulation. | |
| void | equilibrate () |
| Performs the equilibration stage of the simulation. | |
| void | production () |
| Performs the production stage of the simulation. | |
| void | output () |
| Generates the final output of the simulation. | |
| System & | randomSystem () |
| Selects a random system from the list of systems. | |
| std::string | repr () const |
| Returns a string representation of the MonteCarlo object. | |
Public Attributes | |
| std::uint64_t | versionNumber {1} |
| Version number for serialization. | |
| bool | outputToFiles {true} |
| RandomNumber | random |
| Random number generator. | |
| std::size_t | numberOfCycles |
| Number of production cycles. | |
| std::size_t | numberOfSteps |
| Total number of steps performed. | |
| std::size_t | numberOfInitializationCycles |
| Number of initialization cycles. | |
| std::size_t | numberOfEquilibrationCycles |
| Number of equilibration cycles. | |
| std::size_t | printEvery |
| Frequency of printing status reports. | |
| std::size_t | writeRestartEvery |
| Frequency of writing restart files. | |
| std::size_t | writeBinaryRestartEvery |
| Frequency of writing binary restart files. | |
| std::size_t | rescaleWangLandauEvery |
| Frequency of rescaling Wang-Landau factors. | |
| std::size_t | optimizeMCMovesEvery |
| Frequency of optimizing MC moves. | |
| std::size_t | currentCycle {0} |
| Current cycle number. | |
| SimulationStage | simulationStage {SimulationStage::Uninitialized} |
| Current simulation stage. | |
| std::vector< System > | systems |
| Vector of systems to simulate. | |
| std::size_t | fractionalMoleculeSystem {0} |
| std::vector< std::ofstream > | streams |
| Output streams for writing data. | |
| std::vector< std::string > | outputJsonFileNames |
| Filenames for output JSON files. | |
| std::vector< nlohmann::json > | outputJsons |
| Output data in JSON format. | |
| BlockErrorEstimation | estimation {} |
| Block error estimation object. | |
| std::chrono::duration< double > | totalGridCreationTime {0} |
| Total time for calculating the interpolation grid. | |
| std::chrono::duration< double > | totalInitializationSimulationTime {0} |
| Total time for initialization stage. | |
| std::chrono::duration< double > | totalEquilibrationSimulationTime {0} |
| Total time for equilibration stage. | |
| std::chrono::duration< double > | totalProductionSimulationTime {0} |
| Total time for production stage. | |
| std::chrono::duration< double > | totalSimulationTime {0} |
| Total simulation time. | |
Friends | |
| Archive< std::ofstream > & | operator<< (Archive< std::ofstream > &archive, const MonteCarlo &mc) |
| Archive< std::ifstream > & | operator>> (Archive< std::ifstream > &archive, MonteCarlo &mc) |
Performs Monte Carlo simulations for molecular systems.
The MonteCarlo struct orchestrates the execution of Monte Carlo simulations, including initialization, equilibration, and production stages. It manages multiple systems, random number generation, simulation parameters, and output generation.
|
strong |
|
strong |
| MonteCarlo::MonteCarlo | ( | ) |
Default constructor for the MonteCarlo class.
Initializes a MonteCarlo object with default parameters.
|
noexcept |
Constructs a MonteCarlo object with simulation parameters from an InputReader.
| reader | InputReader containing simulation parameters. |
| MonteCarlo::MonteCarlo | ( | std::size_t | numberOfCycles, |
| std::size_t | numberOfInitializationCycles, | ||
| std::size_t | numberOfEquilibrationCycles, | ||
| std::size_t | printEvery, | ||
| std::size_t | writeBinaryRestartEvery, | ||
| std::size_t | rescaleWangLandauEvery, | ||
| std::size_t | optimizeMCMovesEvery, | ||
| std::vector< System > & | systems, | ||
| RandomNumber & | randomSeed, | ||
| std::size_t | numberOfBlocks, | ||
| bool | outputToFiles = false |
||
| ) |
Constructs a MonteCarlo object with specified simulation parameters.
| numberOfCycles | Number of production cycles. |
| numberOfInitializationCycles | Number of initialization cycles. |
| numberOfEquilibrationCycles | Number of equilibration cycles. |
| printEvery | Frequency of printing status reports. |
| writeBinaryRestartEvery | Frequency of writing binary restart files. |
| rescaleWangLandauEvery | Frequency of rescaling Wang-Landau factors. |
| optimizeMCMovesEvery | Frequency of optimizing MC moves. |
| systems | Vector of System objects to simulate. |
| randomSeed | Random number generator seed. |
| numberOfBlocks | Number of blocks for error estimation. |
| void MonteCarlo::equilibrate | ( | ) |
Performs the equilibration stage of the simulation.
Equilibrates the systems by running the specified number of equilibration cycles, and adjusts Wang-Landau biasing factors.
| void MonteCarlo::initialize | ( | ) |
Performs the initialization stage of the simulation.
Sets up the simulation systems, writes initial output, and runs the specified number of initialization cycles.
| void MonteCarlo::output | ( | ) |
Generates the final output of the simulation.
Writes energy statistics, move statistics, CPU timings, and other properties to output files.
| void MonteCarlo::performCycle | ( | ) |
Performs a single Monte Carlo cycle.
Executes a number of Monte Carlo steps, updates system properties, and handles output generation and restart file writing.
| void MonteCarlo::production | ( | ) |
Performs the production stage of the simulation.
Runs the main simulation cycles, collects statistics, and samples properties.
| System & MonteCarlo::randomSystem | ( | ) |
Selects a random system from the list of systems.
| std::string MonteCarlo::repr | ( | ) | const |
Returns a string representation of the MonteCarlo object.
| void MonteCarlo::run | ( | ) |
Runs the Monte Carlo simulation.
Orchestrates the simulation by executing initialization, equilibration, and production stages sequentially.