1 #ifndef CASM_MonteCarlo_HH
2 #define CASM_MonteCarlo_HH
6 #include "casm/external/MersenneTwister/MersenneTwister.h"
21 bool operator()(
const std::string &A,
const std::string &B)
const;
57 typedef std::vector<std::pair<MonteCounter::size_type, MonteCounter::size_type> >
SampleTimes;
179 template<
typename MonteTypeSettings>
317 template<
typename MonteTypeSettings>
319 m_settings(settings),
320 m_primclex(primclex),
321 m_scel(&primclex, settings.simulation_cell_matrix()),
323 m_configdof(m_config.configdof()),
326 m_debug(m_settings.debug()) {
332 if(it->second->must_converge()) {
void clear_samples()
Clear all data from all samplers.
const SuperNeighborList & nlist() const
const Access the SuperNeighborList via pointer stored by 'set_nlist'
std::pair< bool, MonteSampler::size_type > m_is_equil
bool m_is_converged_uptodate
std::vector< std::pair< MonteCounter::size_type, MonteCounter::size_type > > SampleTimes
a vector of std::pair(pass, step) indicating when samples were taken
std::pair< bool, MonteSampler::size_type > is_equilibrated() const
Returns pair(true, equil_samples) if required equilibration has occured for all samplers that must co...
VectorPropertyMap & _vector_properties()
const Access vector properties map
const MonteSettings & m_settings
Contains all input settings.
ConfigDoF & _configdof() const
Access current microstate.
SampleTimes m_sample_time
a vector of std::pair(pass, step) indicating when samples were taken
bool m_must_converge
True if any Sampler must converge.
const double & scalar_property(std::string property_name) const
const Access a particular scalar property
const Configuration & config() const
const Access current microstate
const ConfigDoF & configdof() const
const Access current microstate
void reset(const ConfigDoF &dof)
Set current microstate and clear samplers.
Represents a supercell of the primitive parent crystal structure.
MonteCarlo(PrimClex &primclex, const MonteTypeSettings &settings, Log &_log)
Construct with a starting ConfigDoF as specified the given MonteSettings and prepare data samplers...
bool debug() const
return true if running in debug mode
bool operator()(const std::string &A, const std::string &B) const
Track the number of passes, steps and samples taken in a Monte Carlo calculation. ...
MonteSampler::size_type m_next_convergence_check
Configuration & _config() const
Access current microstate.
The SuperNeighborList gives the linear indices of neighboring sites and unitcells in a particular Sup...
ScalarPropertyMap m_scalar_property
a map of keyname to property value
PrimClex & m_primclex
PrimClex for this system.
PrimClex & _primclex() const
Access the PrimClex that *this is based on.
Configuration m_config
Stores all degrees of freedom of the current microstate.
void set_nlist()
Set a pointer to the SuperNeighborList once it is ready.
const SuperNeighborList & nlist() const
Returns the SuperNeighborList.
SamplerMap m_sampler
a map of pair to MonteSampler
const SampleTimes & sample_times() const
const Access a vector of std::pair
indicating when samples were taken ...
const Supercell & supercell() const
const Access the Supercell that *this is based on
void write_trajectory(const MonteSettings &settings, const MonteCarlo &mc, Index cond_index, Log &_log)
Will create (and possibly overwrite) new file with all observations from run with conditions...
MTRand m_twister
Random number generator.
A container class for the different degrees of freedom a Configuration might have.
Supercell m_scel
Supercell for the calculation.
const PrimClex & primclex() const
const Access the PrimClex that *this is based on
const std::vector< ConfigDoF > & trajectory() const
const Access snapshots of the Monte Carlo calculation
Eigen::VectorXd & _vector_property(std::string property_name)
const Access a particular vector property
std::map< std::string, notstd::cloneable_ptr< MonteSampler >, SamplerNameCompare > SamplerMap
a map of keyname to MonteSampler
PrimClex is the top-level data structure for a CASM project.
bool is_converged() const
Check to see if all the properties required to converge have converged.
ConfigDoF & m_configdof
Reference to m_config.configdof(), to avoid invalidating id every time used.
const VectorPropertyMap & vector_properties() const
const Access vector properties map
MCData::size_type size_type
std::map< std::string, Eigen::VectorXd > VectorPropertyMap
a map of keyname to property value Eigen::VectorXd
void sample_data(const MonteCounter &counter)
Samples all requested property data, and stores pass and step number sample was taken at...
const Eigen::VectorXd & vector_property(std::string property_name) const
const Access a particular vector property
Interface base class for all types of Monte Carlo simulations (not meant to be used polymorphically) ...
Log & m_log
Target for messages.
MonteSampler::size_type size_type
const SuperNeighborList * m_nlist
Pointer to SuperNeighborList.
std::map< std::string, double > ScalarPropertyMap
a map of keyname to property value
Supercell & _supercell() const
Access the Supercell that *this is based on.
const ScalarPropertyMap & scalar_properties() const
const Access scalar properties map
bool must_converge() const
Return true if convergence is requested.
void _set_check_convergence_time() const
Set the next time convergence is due to be checked.
double & _scalar_property(std::string property_name)
Access a particular scalar property.
Settings for Monte Carlo calculations.
bool check_convergence_time() const
Returns true if a convergence check is due.
ScalarPropertyMap & _scalar_properties()
Access scalar properties map.
MonteSampler::size_type m_convergence_check_period
std::vector< ConfigDoF > m_trajectory
Snapshots of the Monte Carlo simulation, taken by sample_data() if m_write_trajectory is true...
const SamplerMap & samplers() const
const Access sampler map
bool m_write_trajectory
Save trajectory?
const MonteSettings & settings() const
const Access settings used for construction
VectorPropertyMap m_vector_property
a map of keyname to property value Eigen::VectorXd
A Configuration represents the values of all degrees of freedom in a Supercell.