CASM
1.1.0
A Clusters Approach to Statistical Mechanics
|
#include <MonteCounter.hh>
Track the number of passes, steps and samples taken in a Monte Carlo calculation.
It's a convenience for figuring out which pass you're on by only having to think of incrementing after every step.
It also has information about the period at which certain routines should be called, such as how often to take a snapshot or write out the state of the run to a file.
Definition at line 23 of file MonteCounter.hh.
Public Types | |
typedef Index | size_type |
Public Member Functions | |
MonteCounter (const EquilibriumMonteSettings &settings, size_type _steps_per_pass) | |
Construct a MonteCounter and initialize to all counts to zero. More... | |
size_type | pass () const |
Number of complete passes performed. More... | |
size_type | step () const |
Number of steps into the current pass. More... | |
size_type | steps_per_pass () const |
Number of steps per pass. More... | |
size_type | samples () const |
Number of samples taken. More... | |
void | increment_samples () |
Increments the number of samples taken and resets counter until the next sample should be taken. More... | |
void | reset () |
Set all counter variables back to 0. More... | |
void | set (size_type _pass, size_type _step, size_type _samples) |
Set all counter variables for performing a restart. More... | |
bool | sample_time () const |
Returns true if based on period and current number of steps it is time to take a sample. More... | |
MonteCounter & | operator++ () |
Prefix increment step and updates pass. More... | |
MonteCounter | operator++ (int) |
Postfix increment step and updates pass. More... | |
bool | is_complete () const |
Check if requested number of pass, step, or samples has been met. More... | |
bool | minimums_met () const |
Check if minimum number of pass, step, and samples has been met. More... | |
bool | maximums_met () const |
Check if maximum number of pass, step, and samples has been met. More... | |
void | debugprint (std::ostream &sout) const |
Private Attributes | |
size_type | m_pass = 0 |
size_type | m_step = 0 |
Number of steps taken during the current pass. More... | |
size_type | m_samples = 0 |
Number of data samples taken. More... | |
size_type | m_since_last_sample = 0 |
Number of passes or steps since last sample. More... | |
bool | m_is_N_step = false |
Requested number of steps. More... | |
size_type | m_N_step = 0 |
bool | m_is_N_pass = false |
Requested number of passes. More... | |
size_type | m_N_pass = 0 |
bool | m_is_N_sample = false |
Requested number of samples. More... | |
size_type | m_N_sample = 0 |
bool | m_is_max_step = false |
Maximum allowed number of steps. More... | |
size_type | m_max_step = 0 |
bool | m_is_min_step = false |
Minimum allowed number of steps. More... | |
size_type | m_min_step = 0 |
bool | m_is_max_pass = false |
Maximum allowed number of passes. More... | |
size_type | m_max_pass = 0 |
bool | m_is_min_pass = false |
Minimum allowed number of passes. More... | |
size_type | m_min_pass = 0 |
bool | m_is_max_sample = false |
Maximum allowed number of samples to take. More... | |
size_type | m_max_sample = 0 |
bool | m_is_min_sample = false |
Minimum allowed number of samples to take. More... | |
size_type | m_min_sample = 0 |
SAMPLE_MODE | m_sample_mode = SAMPLE_MODE::PASS |
Whether sampling mode is by SAMPLE_MODE::PASS or SAMPLE_MODE::STEP. More... | |
int | m_sample_period |
int | m_steps_per_pass |
Definition at line 25 of file MonteCounter.hh.
CASM::Monte::MonteCounter::MonteCounter | ( | const EquilibriumMonteSettings & | settings, |
size_type | _steps_per_pass | ||
) |
Construct a MonteCounter and initialize to all counts to zero.
Requested number of steps
Requested number of passes
Requested number of samples
Maximum allowed number of steps
Minimum allowed number of steps
Maximum allowed number of passes
Minimum allowed number of passes
Maximum allowed number of samples
Minimum allowed number of samples
Whether sampling mode is by Monte::SAMPLE_MODE::PASS or Monte::SAMPLE_MODE::STEP
How often to sample data. In terms of m_sample_mode. If == 1 sample every pass/step.
Definition at line 12 of file MonteCounter.cc.
void CASM::Monte::MonteCounter::debugprint | ( | std::ostream & | sout | ) | const |
Definition at line 213 of file MonteCounter.cc.
void CASM::Monte::MonteCounter::increment_samples | ( | ) |
Increments the number of samples taken and resets counter until the next sample should be taken.
Definition at line 104 of file MonteCounter.cc.
bool CASM::Monte::MonteCounter::is_complete | ( | ) | const |
Check if requested number of pass, step, or samples has been met.
Definition at line 166 of file MonteCounter.cc.
bool CASM::Monte::MonteCounter::maximums_met | ( | ) | const |
Check if maximum number of pass, step, and samples has been met.
Definition at line 197 of file MonteCounter.cc.
bool CASM::Monte::MonteCounter::minimums_met | ( | ) | const |
Check if minimum number of pass, step, and samples has been met.
Definition at line 180 of file MonteCounter.cc.
MonteCounter & CASM::Monte::MonteCounter::operator++ | ( | ) |
Prefix increment step and updates pass.
Definition at line 138 of file MonteCounter.cc.
MonteCounter CASM::Monte::MonteCounter::operator++ | ( | int | ) |
Postfix increment step and updates pass.
Definition at line 157 of file MonteCounter.cc.
MonteCounter::size_type CASM::Monte::MonteCounter::pass | ( | ) | const |
Number of complete passes performed.
Definition at line 93 of file MonteCounter.cc.
void CASM::Monte::MonteCounter::reset | ( | ) |
Set all counter variables back to 0.
Definition at line 109 of file MonteCounter.cc.
bool CASM::Monte::MonteCounter::sample_time | ( | ) | const |
Returns true if based on period and current number of steps it is time to take a sample.
Definition at line 130 of file MonteCounter.cc.
MonteCounter::size_type CASM::Monte::MonteCounter::samples | ( | ) | const |
Number of samples taken.
Definition at line 102 of file MonteCounter.cc.
Set all counter variables for performing a restart.
Definition at line 121 of file MonteCounter.cc.
MonteCounter::size_type CASM::Monte::MonteCounter::step | ( | ) | const |
Number of steps into the current pass.
Definition at line 95 of file MonteCounter.cc.
MonteCounter::size_type CASM::Monte::MonteCounter::steps_per_pass | ( | ) | const |
Number of steps per pass.
Definition at line 98 of file MonteCounter.cc.
|
private |
Maximum allowed number of passes.
Definition at line 113 of file MonteCounter.hh.
|
private |
Maximum allowed number of samples to take.
Definition at line 121 of file MonteCounter.hh.
|
private |
Maximum allowed number of steps.
Definition at line 105 of file MonteCounter.hh.
|
private |
Minimum allowed number of passes.
Definition at line 117 of file MonteCounter.hh.
|
private |
Minimum allowed number of samples to take.
Definition at line 125 of file MonteCounter.hh.
|
private |
Minimum allowed number of steps.
Definition at line 109 of file MonteCounter.hh.
|
private |
Requested number of passes.
Definition at line 95 of file MonteCounter.hh.
|
private |
Requested number of samples.
Definition at line 99 of file MonteCounter.hh.
|
private |
Requested number of steps.
Definition at line 91 of file MonteCounter.hh.
|
private |
Definition at line 114 of file MonteCounter.hh.
|
private |
Definition at line 122 of file MonteCounter.hh.
|
private |
Definition at line 106 of file MonteCounter.hh.
|
private |
Definition at line 118 of file MonteCounter.hh.
|
private |
Definition at line 126 of file MonteCounter.hh.
|
private |
Definition at line 110 of file MonteCounter.hh.
|
private |
Definition at line 96 of file MonteCounter.hh.
|
private |
Definition at line 100 of file MonteCounter.hh.
|
private |
Definition at line 92 of file MonteCounter.hh.
|
private |
One pass is equal to the number of sites with variable degrees of freedom in the supercell
Definition at line 77 of file MonteCounter.hh.
|
private |
Whether sampling mode is by SAMPLE_MODE::PASS or SAMPLE_MODE::STEP.
Definition at line 131 of file MonteCounter.hh.
|
private |
How often to sample data. In terms of m_sample_mode. If == 1 sample every pass/step.
Definition at line 135 of file MonteCounter.hh.
|
private |
Number of data samples taken.
Definition at line 83 of file MonteCounter.hh.
|
private |
Number of passes or steps since last sample.
Definition at line 86 of file MonteCounter.hh.
|
private |
Number of steps taken during the current pass.
Definition at line 80 of file MonteCounter.hh.
|
private |
Number of steps per pass is equal to the number of sites with variable degrees of freedom in the supercell
Definition at line 139 of file MonteCounter.hh.