14 config.in_canonical_supercell().canonical_form());
35 _log() <<
"enum check: " << std::boolalpha <<
check << std::endl;
42 m_halloffame->end(),
false, std::numeric_limits<double>::quiet_NaN(),
50 _log() <<
"enum check: " << std::boolalpha <<
check << std::endl;
51 _log() <<
"score: " << res.score << std::endl;
52 _log() <<
"insert config in hall of fame: " << std::boolalpha << res.success
56 _log() <<
"already in config list: " << res.excluded_pos->second.name()
59 _log() <<
"already in hall of fame: #"
60 << std::distance(
m_halloffame->begin(), res.pos) << std::endl;
62 _log() <<
"score not good enough" << std::endl;
77 throw std::runtime_error(
78 "Error accessing Monte Carlo HallOfFame: was not initialized");
85 _log().
write(
"Enumerated configurations to master config list");
86 _log() <<
"No configurations in hall of fame\n";
91 std::vector<Configuration> output;
97 double score = val.first;
98 auto insert_res = val.second.insert();
102 std::stringstream ss;
103 ss << std::setprecision(6) <<
score;
104 json_src[
"monte_carlo_enumeration"][
"metric"] =
m_metric_args;
105 json_src[
"monte_carlo_enumeration"][
"score"] = ss.str();
115 tconfig.push_back_source(json_src);
123 lambda(*insert_res.canonical_it, insert_res.insert_canonical);
125 if (insert_res.canonical_it != insert_res.primitive_it) {
126 lambda(*insert_res.primitive_it, insert_res.insert_primitive);
132 auto formatter =
m_dict.parse(
133 "configname is_primitive is_new score comp potential_energy");
136 _log().
write(
"Enumerated configurations to master config list");
139 _log() << flag << formatter(output.begin(), output.end());
144 _log().
custom(
"Enumerated configurations hall of fame");
147 _log() << std::setw(16) <<
"position" << std::setw(16) <<
"score"
149 _log() << std::setw(16) << std::string(
"-", 12) << std::setw(16)
150 << std::string(
"-", 12) <<
"\n";
154 _log() << std::setw(16) << i << std::setw(16) << val.first <<
"\n";
175 throw std::runtime_error(
176 "Error accessing Monte Carlo HallOfFame: was not initialized");
A container for storing best scoring objects.
void exclude(const ObjectType &obj)
Add an object that should not be included in the hall of fame.
void custom(const std::string &what)
void write(const std::string &what)
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
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.
bool check_existence() const
If true, insert configurations in canonical form.
std::string m_metric_args
const PrimClex & primclex() const
const Access the PrimClex that *this is based on
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 reset()
Clear hall of fame and reset excluded.
DataFormatterDictionary< Configuration > m_dict
Used for various purposes.
HallOfFameType & _halloffame()
HallOfFameType::InsertResult insert(const Configuration &config)
Attempt to insert (canonical) Configuration into enumeration hall of fame.
DB::Database< T > & db() const
void commit(ProjectSettings const &set)
GenericDatumFormatter< bool, ConfigEnumDataType > is_new()
ConfigIO::GenericConfigFormatter< jsonParser > config()
GenericDatumFormatter< double, Result > score()
bool check(const Lattice &lat)
INDEX_TYPE Index
For long integer indexing:
Results data structure for HallOfFame::insert.