26 bool check = (*m_enum_check)(config);
31 _log() <<
"enum check: " << std::boolalpha << check << std::endl;
40 std::numeric_limits<double>::quiet_NaN(),
49 _log() <<
"enum check: " << std::boolalpha << check << std::endl;
50 _log() <<
"score: " << res.score << std::endl;
51 _log() <<
"insert config in hall of fame: " << std::boolalpha << res.success << std::endl;
54 _log() <<
"already in config list: " << res.excluded_pos->second.name() << std::endl;
57 _log() <<
"already in hall of fame: #" << std::distance(
m_halloffame->begin(), res.pos) << std::endl;
60 _log() <<
"score not good enough" << std::endl;
76 throw std::runtime_error(
"Error accessing Monte Carlo HallOfFame: was not initialized");
96 double vol_tol = 0.25;
97 double lattice_weight = 0.5;
98 ConfigMapper configmapper(primclex, lattice_weight, vol_tol, map_opt, tol);
100 std::string imported_name;
102 std::vector<Index> best_assignment;
104 bool is_new = configmapper.import_structure_occupation(prim,
110 return std::make_pair(imported_name, is_new);
118 _log().
write(
"Enumerated configurations to master config list");
119 _log() <<
"No configurations in hall of fame\n";
124 std::vector<Configuration> output;
129 bool is_new, is_prim;
142 is_new = canon_scel.
add_config(config, config_index, permute_it);
150 double score = val.first;
154 std::stringstream ss;
155 ss << std::setprecision(6) << score;
156 json_src[
"monte_carlo_enumeration"][
"metric"] =
m_metric_args;
157 json_src[
"monte_carlo_enumeration"][
"score"] = ss.str();
161 m_data[canon_config.
name()] = std::make_pair(is_new, score);
162 output.push_back(canon_config);
166 std::tie(configname, is_new) = _import_primitive(this->
_primclex(), canon_scel, config_index);
176 m_data[prim_canon_config.
name()] = std::make_pair(is_new, score);
177 output.push_back(prim_canon_config);
182 auto formatter =
m_dict.parse(
"configname is_primitive is_new score comp potential_energy");
185 _log().
write(
"Enumerated configurations to master config list");
188 _log() << flag << formatter(output.begin(), output.end());
195 _log().
custom(
"Enumerated configurations hall of fame");
198 _log() << std::setw(16) <<
"position" << std::setw(16) <<
"score" <<
"\n";
199 _log() << std::setw(16) << std::string(
"-", 12) << std::setw(16) << std::string(
"-", 12) <<
"\n";
203 _log() << std::setw(16) << i << std::setw(16) << val.first <<
"\n";
223 throw std::runtime_error(
"Error accessing Monte Carlo HallOfFame: was not initialized");
const Configuration & get_config(Index i) const
void exclude(const ObjectType &obj)
Add an object that should not be included in the hall of fame.
void write_config_list(std::set< std::string > scel_to_delete={})
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.
bool debug() const
return true if running in debug mode
void write(const std::string &what)
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
bool is_primitive(double prim_tol=TOL) const
Configuration canonical_form() const
Returns the canonical form Configuration in the same Supercell.
MonteCarloEnum::HallOfFameType::InsertResult _insert(const Configuration &config)
Insert in hall of fame if 'check' passes.
Results data structure for HallOfFame::insert.
void push_back_source(const jsonParser &source)
A container for storing best scoring objects.
Represents a supercell of the primitive parent crystal structure.
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.
void custom(const std::string &what)
HallOfFameType::InsertResult insert(const Configuration &config)
Attempt to insert (canonical) Configuration into enumeration hall of fame.
EigenIndex Index
For long integer indexing:
Structure superstructure() const
bool add_config(const Configuration &config)
PrimClex is the top-level data structure for a CASM project.
std::string name() const
SCELV_A_B_C_D_E_F/i.
const Configuration & configuration(const std::string &configname) const
access configuration by name (of the form "scellname/[NUMBER]", e.g., ("SCEL1_1_1_1_0_0_0/0") ...
HallOfFameType & _halloffame()
bool check_existence() const
If true, insert configurations in canonical form.
ConfigIO::GenericConfigFormatter< std::string > configname()
Constructs DataFormmaterDictionary containing all Configuration DatumFormatters.
bool check(std::string test, const jsonParser &expected, const jsonParser &calculated, fs::path test_cases_path, bool quiet, double tol=0.0)
Check expected JSON vs calculated JSON using BOOST_CHECK_EQUAL.
PrimClex & _primclex() const
Access the PrimClex that *this is based on.
Configuration in_canonical_supercell() const
Returns the canonical form Configuration in the canonical Supercell.
DataFormatterDictionary< Configuration > m_dict
Used for various purposes.
std::string m_metric_args
Supercell & get_supercell() const
Get the Supercell for this Configuration.
bool is_primitive(const Configuration &_config)
returns true if _config describes primitive cell of the configuration it describes ...
A Configuration represents the values of all degrees of freedom in a Supercell.