CASM  1.1.0
A Clusters Approach to Statistical Mechanics
MonteCarlo_impl.hh
Go to the documentation of this file.
1 #ifndef CASM_MonteCarlo_impl
2 #define CASM_MonteCarlo_impl
3 
5 #include "casm/casm_io/Log.hh"
6 #include "casm/clex/ConfigDoF.hh"
8 #include "casm/clex/PrimClex.hh"
9 #include "casm/clex/Supercell.hh"
14 
15 namespace CASM {
16 namespace Monte {
17 
20 template <typename MonteTypeSettings>
22  const MonteTypeSettings &settings, Log &_log)
23  : m_settings(settings),
24  m_primclex(primclex),
25  m_scel(&primclex, settings.simulation_cell_matrix()),
26  m_config(m_scel),
27  m_configdof(m_config.configdof()),
28  m_write_trajectory(settings.write_trajectory()),
29  m_log(_log),
30  m_debug(m_settings.debug()) {
31  settings.samplers(primclex, std::inserter(m_sampler, m_sampler.begin()));
32 
33  m_must_converge = false;
34  for (auto it = m_sampler.cbegin(); it != m_sampler.cend(); ++it) {
35  if (it->second->must_converge()) {
36  m_must_converge = true;
37  break;
38  }
39  }
40 }
41 
42 } // namespace Monte
43 } // namespace CASM
44 
45 #endif
Definition: Log.hh:48
SamplerMap m_sampler
a map of pair<keyname, index> to MonteSampler
Definition: MonteCarlo.hh:266
const MonteSettings & settings() const
const Access settings used for construction
Definition: MonteCarlo.hh:74
const PrimClex & primclex() const
const Access the PrimClex that *this is based on
Definition: MonteCarlo.hh:77
MonteCarlo(const PrimClex &primclex, const MonteTypeSettings &settings, Log &_log)
Construct with a starting ConfigDoF as specified the given MonteSettings and prepare data samplers.
bool m_must_converge
True if any MonteSampler must converge.
Definition: MonteCarlo.hh:253
PrimClex is the top-level data structure for a CASM project.
Definition: PrimClex.hh:55
void write_trajectory(const MonteSettings &settings, const MonteCarlo &mc, size_type cond_index, Log &_log)
Will create (and possibly overwrite) new file with all observations from run with conditions....
Definition: MonteIO.cc:325
Main CASM namespace.
Definition: APICommand.hh:8
PrimClex * primclex
Definition: settings.cc:135