CASM  1.1.0
A Clusters Approach to Statistical Mechanics
MonteCarloEnum.hh
Go to the documentation of this file.
1 #ifndef CASM_MonteCarloEnum
2 #define CASM_MonteCarloEnum
3 
4 #include <functional>
5 #include <utility>
6 
7 #include "casm/casm_io/Log.hh"
10 #include "casm/misc/HallOfFame.hh"
13 
14 namespace CASM {
15 namespace Monte {
16 
18  public:
20  : m_formatter(_formatter) {}
21 
22  double operator()(const Configuration &config) {
23  return m_formatter.evaluate_as_scalar<double>(config);
24  }
25 
26  private:
28 };
29 
31  public:
33  : m_formatter(_formatter) {}
34 
36  return m_formatter.evaluate_as_scalar<bool>(config);
37  }
38 
39  private:
41 };
42 
44  public:
46 
47  template <typename MonteTypeSettings, typename MonteCarloType>
48  MonteCarloEnum(const PrimClex &primclex, const MonteTypeSettings &settings,
49  Log &log, MonteCarloType &mc);
50 
52  const PrimClex &primclex() const { return m_primclex; }
53 
55  bool on_accept() const {
57  }
58 
60  bool on_sample() const {
62  }
63 
66  HallOfFameType::InsertResult insert(const Configuration &config);
67 
69  void clear() {
70  if (m_halloffame) {
71  m_halloffame->clear();
72  }
73  }
74 
76  const HallOfFameType &halloffame() const;
77 
79  void save_configs();
80 
81  std::string check_args() const { return m_check_args; }
82 
83  std::string metric_args() const { return m_metric_args; }
84 
85  void print_info() const;
86 
88  bool debug() const { return m_debug; }
89 
93  bool check_existence() const { return m_check_existence; }
94 
96  bool insert_canonical() const { return m_insert_canonical; }
97 
99  void reset();
100 
101  private:
104  const Configuration &config);
105 
107 
108  Log &_log() const { return m_log; }
109 
112 
115 
118 
119  // in debug mode, allow printing or checking extra things
120  bool m_debug;
121 
122  std::string m_check_args;
123  std::string m_metric_args;
124 
127 
130 
133 
138 
140  mutable std::map<std::string, Supercell *> m_canon_scel;
141 
144 
146  std::map<std::string, std::pair<bool, double> > m_data;
147 };
148 
149 } // namespace Monte
150 } // namespace CASM
151 
152 #endif
Parsing dictionary for constructing a DataFormatter<DataObject> object.
Extract data from objects of 'DataObject' class.
A container for storing best scoring objects.
Definition: HallOfFame.hh:21
Definition: Log.hh:48
DataFormatter< Configuration > m_formatter
bool operator()(const Configuration &config)
MonteCarloEnumCheck(const DataFormatter< Configuration > &_formatter)
std::map< std::string, std::pair< bool, double > > m_data
holds 'is_new, score' data
const HallOfFameType & halloffame() const
const Access the enumeration hall of fame
bool m_check_existence
If true, only keep configurations that are not enumerated already.
MonteCarloEnum(const PrimClex &primclex, const MonteTypeSettings &settings, Log &log, MonteCarloType &mc)
MonteCarloEnum::HallOfFameType::InsertResult _insert(const Configuration &config)
Insert in hall of fame if 'check' passes.
bool debug() const
return true if running in debug mode
void save_configs()
Save configurations in the hall of fame to the config list.
ENUM_SAMPLE_MODE m_sample_mode
when to attempt to insert configurations in the hall of fame
bool check_existence() const
If true, insert configurations in canonical form.
std::string metric_args() const
const PrimClex & primclex() const
const Access the PrimClex that *this is based on
bool on_sample() const
Check if enumeration is requested after every sample.
notstd::cloneable_ptr< HallOfFameType > m_halloffame
Use for enumerating configurations via Monte Carlo.
bool insert_canonical() const
Map for faster? access of PrimClex's supercells.
void clear()
Clear hall of fame.
notstd::cloneable_ptr< MonteCarloEnumCheck > m_enum_check
Use for enumerating configurations via Monte Carlo.
void reset()
Clear hall of fame and reset excluded.
HallOfFame< Configuration, MonteCarloEnumMetric > HallOfFameType
Log & m_log
Target for messages.
const PrimClex & m_primclex
PrimClex for this system.
std::map< std::string, Supercell * > m_canon_scel
Map for faster? access of PrimClex's supercells.
DataFormatterDictionary< Configuration > m_dict
Used for various purposes.
HallOfFameType & _halloffame()
std::string check_args() const
bool on_accept() const
Check if enumeration is requested after every acceptance.
bool m_insert_canonical
If true, insert configurations in canonical form.
HallOfFameType::InsertResult insert(const Configuration &config)
Attempt to insert (canonical) Configuration into enumeration hall of fame.
double operator()(const Configuration &config)
DataFormatter< Configuration > m_formatter
MonteCarloEnumMetric(const DataFormatter< Configuration > &_formatter)
PrimClex is the top-level data structure for a CASM project.
Definition: PrimClex.hh:55
A 'cloneable_ptr' can be used in place of 'unique_ptr'.
ConfigIO::GenericConfigFormatter< jsonParser > config()
Definition: ConfigIO.cc:777
ENUM_SAMPLE_MODE
How often to sample runs.
Main CASM namespace.
Definition: APICommand.hh:8
Log & log()
Definition: Log.hh:424
Results data structure for HallOfFame::insert.
Definition: HallOfFame.hh:53