1 #ifndef CASM_MonteCarlo_HH
2 #define CASM_MonteCarlo_HH
10 #include "casm/external/MersenneTwister/MersenneTwister.h"
19 class SuperNeighborList;
33 bool operator()(
const std::string &A,
const std::string &B)
const;
63 typedef std::map<std::string, notstd::cloneable_ptr<MonteSampler>,
69 typedef std::vector<std::pair<size_type, size_type> >
SampleTimes;
167 template <
typename MonteTypeSettings>
Interface base class for all types of Monte Carlo simulations (not meant to be used polymorphically)
double & _scalar_property(std::string property_name)
Access a particular scalar property.
void _set_check_convergence_time() const
Set the next time convergence is due to be checked.
std::pair< bool, 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
std::map< std::string, double > ScalarPropertyMap
a map of keyname to property value
void clear_samples()
Clear all data from all samplers.
std::map< std::string, notstd::cloneable_ptr< MonteSampler >, SamplerNameCompare > SamplerMap
a map of keyname to MonteSampler
Supercell m_scel
Supercell for the calculation.
SamplerMap m_sampler
a map of pair<keyname, index> to MonteSampler
const SuperNeighborList * m_nlist
Pointer to SuperNeighborList.
bool check_convergence_time() const
Returns true if a convergence check is due.
ConfigDoF & _configdof() const
Access current microstate.
const double & scalar_property(std::string property_name) const
const Access a particular scalar property
Log & m_log
Target for messages.
size_type m_next_convergence_check
void sample_data(const MonteCounter &counter)
Samples all requested property data, and stores pass and step number sample was taken at.
const VectorPropertyMap & vector_properties() const
const Access vector properties map
const Supercell & _supercell() const
Access the Supercell that *this is based on.
bool m_write_trajectory
Save trajectory?
const PrimClex & _primclex() const
Access the PrimClex that *this is based on.
std::vector< std::pair< size_type, size_type > > SampleTimes
a vector of std::pair(pass, step) indicating when samples were taken
SampleTimes m_sample_time
a vector of std::pair(pass, step) indicating when samples were taken
const ScalarPropertyMap & scalar_properties() const
const Access scalar properties map
void set_nlist()
Set a pointer to the SuperNeighborList once it is ready.
const PrimClex & m_primclex
PrimClex for this system.
const SuperNeighborList & nlist() const
const Access the SuperNeighborList via pointer stored by 'set_nlist'
bool m_is_converged_uptodate
ScalarPropertyMap m_scalar_property
a map of keyname to property value
const MonteSettings & m_settings
Contains all input settings.
ScalarPropertyMap & _scalar_properties()
Access scalar properties map.
std::vector< ConfigDoF > m_trajectory
Snapshots of the Monte Carlo simulation, taken by sample_data() if m_write_trajectory is true.
const Supercell & supercell() const
const Access the Supercell that *this is based on
const MonteSettings & settings() const
const Access settings used for construction
bool is_converged() const
Check to see if all the properties required to converge have converged.
void reset(const ConfigDoF &dof)
Set current microstate and clear samplers.
const Configuration & config() const
const Access current microstate
const PrimClex & primclex() const
const Access the PrimClex that *this is based on
Configuration & _config() const
Access current microstate.
Monte::size_type size_type
size_type m_convergence_check_period
Eigen::VectorXd & _vector_property(std::string property_name)
const Access a particular vector property
VectorPropertyMap m_vector_property
a map of keyname to property value Eigen::VectorXd
const Eigen::VectorXd & vector_property(std::string property_name) const
const Access a particular vector property
Configuration m_config
Stores all degrees of freedom of the current microstate.
MonteCarlo(const PrimClex &primclex, const MonteTypeSettings &settings, Log &_log)
Construct with a starting ConfigDoF as specified the given MonteSettings and prepare data samplers.
const std::vector< ConfigDoF > & trajectory() const
const Access snapshots of the Monte Carlo calculation
const ConfigDoF & configdof() const
const Access current microstate
std::map< std::string, Eigen::VectorXd > VectorPropertyMap
a map of keyname to property value Eigen::VectorXd
bool debug() const
return true if running in debug mode
MTRand m_twister
Random number generator.
const SamplerMap & samplers() const
const Access sampler map
std::pair< bool, size_type > m_is_equil
bool must_converge() const
Return true if convergence is requested.
bool m_must_converge
True if any MonteSampler must converge.
const SampleTimes & sample_times() const
const Access a vector of std::pair<pass, step> indicating when samples were taken
Track the number of passes, steps and samples taken in a Monte Carlo calculation.
Settings for Monte Carlo calculations.
PrimClex is the top-level data structure for a CASM project.
Represents a supercell of the primitive parent crystal structure.
const SuperNeighborList & nlist() const
Returns the SuperNeighborList.
bool operator()(const std::string &A, const std::string &B) const