CASM
AClustersApproachtoStatisticalMechanics
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Modules
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 
10 #include "casm/casm_io/Log.hh"
13 
14 namespace CASM {
15 
16  class Configuration;
17 
18 
20 
21  public:
22 
24  m_formatter(_formatter) {}
25 
26  double operator()(const Configuration &config) {
27  return m_formatter.evaluate_as_scalar<double>(config);
28  }
29 
30  private:
31 
33  };
34 
35 
37 
38  public:
39 
41  m_formatter(_formatter) {}
42 
43  bool operator()(const Configuration &config) {
44  return m_formatter.evaluate_as_scalar<bool>(config);
45  }
46 
47  private:
48 
50  };
51 
52 
54 
55  public:
56 
58 
59  template<typename MonteTypeSettings, typename MonteCarloType>
60  MonteCarloEnum(PrimClex &primclex, const MonteTypeSettings &settings, Log &log, MonteCarloType &mc);
61 
63  const PrimClex &primclex() const {
64  return m_primclex;
65  }
66 
68  bool on_accept() const {
70  }
71 
73  bool on_sample() const {
75  }
76 
78  HallOfFameType::InsertResult insert(const Configuration &config);
79 
81  void clear() {
82  if(m_halloffame) {
83  m_halloffame->clear();
84  }
85  }
86 
88  const HallOfFameType &halloffame() const;
89 
91  void save_configs();
92 
93  std::string check_args() const {
94  return m_check_args;
95  }
96 
97  std::string metric_args() const {
98  return m_metric_args;
99  }
100 
101  void print_info() const;
102 
104  bool debug() const {
105  return m_debug;
106  }
107 
111  bool check_existence() const {
112  return m_check_existence;
113  }
114 
116  bool insert_canonical() const {
117  return m_insert_canonical;
118  }
119 
121  void reset();
122 
123  private:
124 
127 
128  HallOfFameType &_halloffame();
129 
131  PrimClex &_primclex() const {
132  return m_primclex;
133  }
134 
135  Log &_log() const {
136  return m_log;
137  }
138 
139 
142 
145 
148 
149  // in debug mode, allow printing or checking extra things
150  bool m_debug;
151 
152  std::string m_check_args;
153  std::string m_metric_args;
154 
157 
160 
163 
168 
170  mutable std::map<std::string, Supercell *> m_canon_scel;
171 
174 
176  std::map<std::string, std::pair<bool, double> > m_data;
177 
178 
179  };
180 }
181 
182 #endif
bool on_sample() const
Check if enumeration is requested after every sample.
MonteCarloEnum(PrimClex &primclex, const MonteTypeSettings &settings, Log &log, MonteCarloType &mc)
HallOfFame< Configuration, MonteCarloEnumMetric > HallOfFameType
void clear()
Clear hall of fame.
Monte::ENUM_SAMPLE_MODE m_sample_mode
when to attempt to insert configurations in the hall of fame
const HallOfFameType & halloffame() const
const Access the enumeration hall of fame
void reset()
Clear hall of fame and reset excluded.
notstd::cloneable_ptr< HallOfFameType > m_halloffame
Use for enumerating configurations via Monte Carlo.
std::string metric_args() const
bool debug() const
return true if running in debug mode
std::map< std::string, std::pair< bool, double > > m_data
holds 'is_new, score' data
const PrimClex & primclex() const
const Access the PrimClex that *this is based on
MonteCarloEnum::HallOfFameType::InsertResult _insert(const Configuration &config)
Insert in hall of fame if 'check' passes.
bool on_accept() const
Check if enumeration is requested after every acceptance.
Results data structure for HallOfFame::insert.
Definition: HallOfFame.hh:58
Log & m_log
Target for messages.
A container for storing best scoring objects.
Definition: HallOfFame.hh:19
PrimClex & m_primclex
PrimClex for this system.
bool m_check_existence
If true, only keep configurations that are not enumerated already.
Main CASM namespace.
Definition: complete.cpp:8
Log & log
Definition: settings.cc:105
DataFormatter< Configuration > m_formatter
MonteCarloEnumCheck(const DataFormatter< Configuration > &_formatter)
MonteCarloEnumMetric(const DataFormatter< Configuration > &_formatter)
std::string check_args() const
void save_configs()
Save configurations in the hall of fame to the config list.
bool insert_canonical() const
Map for faster? access of PrimClex's supercells.
HallOfFameType::InsertResult insert(const Configuration &config)
Attempt to insert (canonical) Configuration into enumeration hall of fame.
bool operator()(const Configuration &config)
PrimClex is the top-level data structure for a CASM project.
Definition: PrimClex.hh:52
HallOfFameType & _halloffame()
ENUM_SAMPLE_MODE
How often to sample runs.
bool check_existence() const
If true, insert configurations in canonical form.
notstd::cloneable_ptr< MonteCarloEnumCheck > m_enum_check
Use for enumerating configurations via Monte Carlo.
PrimClex & _primclex() const
Access the PrimClex that *this is based on.
std::map< std::string, Supercell * > m_canon_scel
Map for faster? access of PrimClex's supercells.
void print_info() const
Extract data from objects of 'DataObject' class.
DataFormatterDictionary< Configuration > m_dict
Used for various purposes.
double operator()(const Configuration &config)
A 'cloneable_ptr' can be used in place of 'unique_ptr'.
DataFormatter< Configuration > m_formatter
Definition: Log.hh:9
bool m_insert_canonical
If true, insert configurations in canonical form.
Parsing dictionary for constructing a DataFormatter object.
A Configuration represents the values of all degrees of freedom in a Supercell.