CASM
AClustersApproachtoStatisticalMechanics
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Modules
CASM::MonteCounter Class Reference

#include <MonteCounter.hh>

Detailed Description

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 20 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...
 
MonteCounteroperator++ ()
 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
 One pass is equal to the number of sites with variable degrees of freedom in the supercell. More...
 
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
 
Monte::SAMPLE_MODE m_sample_mode = Monte::SAMPLE_MODE::PASS
 Whether sampling mode is by Monte::SAMPLE_MODE::PASS or Monte::SAMPLE_MODE::STEP. More...
 
int m_sample_period
 How often to sample data. In terms of m_sample_mode. If == 1 sample every pass/step. More...
 
int m_steps_per_pass
 Number of steps per pass is equal to the number of sites with variable degrees of freedom in the supercell. More...
 

Member Typedef Documentation

Definition at line 23 of file MonteCounter.hh.

Constructor & Destructor Documentation

CASM::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 11 of file MonteCounter.cc.

Member Function Documentation

void CASM::MonteCounter::debugprint ( std::ostream &  sout) const

Definition at line 229 of file MonteCounter.cc.

void CASM::MonteCounter::increment_samples ( )

Increments the number of samples taken and resets counter until the next sample should be taken.

Definition at line 111 of file MonteCounter.cc.

bool CASM::MonteCounter::is_complete ( ) const

Check if requested number of pass, step, or samples has been met.

Definition at line 180 of file MonteCounter.cc.

bool CASM::MonteCounter::maximums_met ( ) const

Check if maximum number of pass, step, and samples has been met.

Definition at line 212 of file MonteCounter.cc.

bool CASM::MonteCounter::minimums_met ( ) const

Check if minimum number of pass, step, and samples has been met.

Definition at line 194 of file MonteCounter.cc.

MonteCounter & CASM::MonteCounter::operator++ ( )

Prefix increment step and updates pass.

Definition at line 149 of file MonteCounter.cc.

MonteCounter CASM::MonteCounter::operator++ ( int  )

Postfix increment step and updates pass.

Definition at line 169 of file MonteCounter.cc.

MonteCounter::size_type CASM::MonteCounter::pass ( ) const

Number of complete passes performed.

Definition at line 91 of file MonteCounter.cc.

void CASM::MonteCounter::reset ( )

Set all counter variables back to 0.

Definition at line 117 of file MonteCounter.cc.

bool CASM::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 141 of file MonteCounter.cc.

MonteCounter::size_type CASM::MonteCounter::samples ( ) const

Number of samples taken.

Definition at line 106 of file MonteCounter.cc.

void CASM::MonteCounter::set ( size_type  _pass,
size_type  _step,
size_type  _samples 
)

Set all counter variables for performing a restart.

Definition at line 129 of file MonteCounter.cc.

MonteCounter::size_type CASM::MonteCounter::step ( ) const

Number of steps into the current pass.

Definition at line 95 of file MonteCounter.cc.

MonteCounter::size_type CASM::MonteCounter::steps_per_pass ( ) const

Number of steps per pass.

Definition at line 101 of file MonteCounter.cc.

Member Data Documentation

bool CASM::MonteCounter::m_is_max_pass = false
private

Maximum allowed number of passes.

Definition at line 123 of file MonteCounter.hh.

bool CASM::MonteCounter::m_is_max_sample = false
private

Maximum allowed number of samples to take.

Definition at line 131 of file MonteCounter.hh.

bool CASM::MonteCounter::m_is_max_step = false
private

Maximum allowed number of steps.

Definition at line 115 of file MonteCounter.hh.

bool CASM::MonteCounter::m_is_min_pass = false
private

Minimum allowed number of passes.

Definition at line 127 of file MonteCounter.hh.

bool CASM::MonteCounter::m_is_min_sample = false
private

Minimum allowed number of samples to take.

Definition at line 135 of file MonteCounter.hh.

bool CASM::MonteCounter::m_is_min_step = false
private

Minimum allowed number of steps.

Definition at line 119 of file MonteCounter.hh.

bool CASM::MonteCounter::m_is_N_pass = false
private

Requested number of passes.

Definition at line 103 of file MonteCounter.hh.

bool CASM::MonteCounter::m_is_N_sample = false
private

Requested number of samples.

Definition at line 107 of file MonteCounter.hh.

bool CASM::MonteCounter::m_is_N_step = false
private

Requested number of steps.

Definition at line 99 of file MonteCounter.hh.

size_type CASM::MonteCounter::m_max_pass = 0
private

Definition at line 124 of file MonteCounter.hh.

size_type CASM::MonteCounter::m_max_sample = 0
private

Definition at line 132 of file MonteCounter.hh.

size_type CASM::MonteCounter::m_max_step = 0
private

Definition at line 116 of file MonteCounter.hh.

size_type CASM::MonteCounter::m_min_pass = 0
private

Definition at line 128 of file MonteCounter.hh.

size_type CASM::MonteCounter::m_min_sample = 0
private

Definition at line 136 of file MonteCounter.hh.

size_type CASM::MonteCounter::m_min_step = 0
private

Definition at line 120 of file MonteCounter.hh.

size_type CASM::MonteCounter::m_N_pass = 0
private

Definition at line 104 of file MonteCounter.hh.

size_type CASM::MonteCounter::m_N_sample = 0
private

Definition at line 108 of file MonteCounter.hh.

size_type CASM::MonteCounter::m_N_step = 0
private

Definition at line 100 of file MonteCounter.hh.

size_type CASM::MonteCounter::m_pass = 0
private

One pass is equal to the number of sites with variable degrees of freedom in the supercell.

Definition at line 83 of file MonteCounter.hh.

Monte::SAMPLE_MODE CASM::MonteCounter::m_sample_mode = Monte::SAMPLE_MODE::PASS
private

Whether sampling mode is by Monte::SAMPLE_MODE::PASS or Monte::SAMPLE_MODE::STEP.

Definition at line 142 of file MonteCounter.hh.

int CASM::MonteCounter::m_sample_period
private

How often to sample data. In terms of m_sample_mode. If == 1 sample every pass/step.

Definition at line 145 of file MonteCounter.hh.

size_type CASM::MonteCounter::m_samples = 0
private

Number of data samples taken.

Definition at line 90 of file MonteCounter.hh.

size_type CASM::MonteCounter::m_since_last_sample = 0
private

Number of passes or steps since last sample.

Definition at line 94 of file MonteCounter.hh.

size_type CASM::MonteCounter::m_step = 0
private

Number of steps taken during the current pass.

Definition at line 86 of file MonteCounter.hh.

int CASM::MonteCounter::m_steps_per_pass
private

Number of steps per pass is equal to the number of sites with variable degrees of freedom in the supercell.

Definition at line 148 of file MonteCounter.hh.


The documentation for this class was generated from the following files: