1 #ifndef CASM_Enumerator_impl
2 #define CASM_Enumerator_impl
23 template<
typename ScelIterator,
typename ConfigEnumConstructor>
29 ConfigEnumConstructor f,
30 std::vector<std::string> filter_expr) {
35 log <<
"# configurations in this project: " << Ninit <<
"\n" << std::endl;
39 for(
auto scel_it = begin; scel_it != end; ++scel_it) {
41 log <<
"Enumerate configurations for " << scel.
get_name() <<
" ... " << std::flush;
43 auto enumerator_ptr = f(scel);
44 auto &enumerator = *enumerator_ptr;
46 if(!filter_expr.empty()) {
57 catch(std::exception &e) {
58 primclex.
err_log() <<
"Cannot filter configurations using the expression provided: \n" << e.what() <<
"\nExiting...\n";
66 log << (scel.
get_config_list().size() - num_before) <<
" configs." << std::endl;
68 log <<
" DONE." << std::endl << std::endl;
72 log <<
"# new configurations: " << Nfinal - Ninit <<
"\n";
73 log <<
"# configurations in this project: " << Nfinal <<
"\n" << std::endl;
75 log <<
"Write SCEL..." << std::endl;
77 log <<
" DONE" << std::endl << std::endl;
79 log <<
"Writing config_list..." << std::endl;
81 log <<
" DONE" << std::endl;
99 template<
typename ScelIterator,
typename ConfigEnumConstructor>
105 ConfigEnumConstructor f,
106 std::vector<std::string> filter_expr,
107 bool primitive_only) {
112 log <<
"# configurations in this project: " << Ninit <<
"\n" << std::endl;
116 for(
auto scel_it = begin; scel_it != end; ++scel_it) {
118 log <<
"Enumerate configurations for " << scel.
get_name() <<
" ... " << std::flush;
120 auto enumerator_ptr = f(scel);
121 auto &enumerator = *enumerator_ptr;
123 if(!filter_expr.empty()) {
131 for(; it != end; ++it) {
132 it->insert(primitive_only);
135 catch(std::exception &e) {
136 primclex.
err_log() <<
"Cannot filter configurations using the expression provided: \n" << e.what() <<
"\nExiting...\n";
141 auto it = enumerator.begin();
142 auto end = enumerator.end();
143 for(; it != end; ++it) {
144 it->insert(primitive_only);
148 log << (scel.
get_config_list().size() - num_before) <<
" configs." << std::endl;
150 log <<
" DONE." << std::endl << std::endl;
154 log <<
"# new configurations: " << Nfinal - Ninit <<
"\n";
155 log <<
"# configurations in this project: " << Nfinal <<
"\n" << std::endl;
157 log <<
"Write SCEL..." << std::endl;
159 log <<
" DONE" << std::endl << std::endl;
161 log <<
"Writing config_list..." << std::endl;
163 log <<
" DONE" << std::endl;
181 template<
typename LatticeIterator,
typename ConfigEnumConstructor>
185 LatticeIterator begin,
187 ConfigEnumConstructor f,
188 std::vector<std::string> filter_expr,
189 bool primitive_only) {
194 log <<
"# configurations in this project: " << Ninit <<
"\n" << std::endl;
198 for(
auto scel_lat_it = begin; scel_lat_it != end; ++scel_lat_it) {
201 log <<
"Enumerate configurations for " << canon_scel.
get_name() <<
" ... " << std::flush;
203 auto enumerator_ptr = f(scel);
204 auto &enumerator = *enumerator_ptr;
206 if(!filter_expr.empty()) {
214 for(; it != end; ++it) {
215 it->insert(primitive_only);
218 catch(std::exception &e) {
219 primclex.
err_log() <<
"Cannot filter configurations using the expression provided: \n" << e.what() <<
"\nExiting...\n";
224 auto it = enumerator.begin();
225 auto end = enumerator.end();
226 for(; it != end; ++it) {
227 it->insert(primitive_only);
231 log << (canon_scel.
get_config_list().size() - num_before) <<
" configs." << std::endl;
233 log <<
" DONE." << std::endl << std::endl;
237 log <<
"# new configurations: " << Nfinal - Ninit <<
"\n";
238 log <<
"# configurations in this project: " << Nfinal <<
"\n" << std::endl;
240 log <<
"Write SCEL..." << std::endl;
242 log <<
" DONE" << std::endl << std::endl;
244 log <<
"Writing config_list..." << std::endl;
246 log <<
" DONE" << std::endl;
std::string get_name() const
Return supercell name.
void write_config_list(std::set< std::string > scel_to_delete={})
FilteredConfigIterator< IteratorType > filter_end(const IteratorType &it_end)
Supercell & canonical_form() const
ConfigList & get_config_list()
Represents a supercell of the primitive parent crystal structure.
config_iterator config_begin()
Configuration iterator: begin.
config_iterator config_end()
Configuration iterator: end.
int insert_configs(std::string method, PrimClex &primclex, ScelIterator begin, ScelIterator end, ConfigEnumConstructor f, std::vector< std::string > filter_expr, bool primitive_only)
Standardizes insertion from enumerators that construct configurations.
void begin(const std::string &what)
int insert_configs_via_lattice_enum(std::string method, PrimClex &primclex, LatticeIterator begin, LatticeIterator end, ConfigEnumConstructor f, std::vector< std::string > filter_expr, bool primitive_only)
Standardizes insertion from enumerators that construct configurations.
EigenIndex Index
For long integer indexing:
QueryHandler< DataObject > & query_handler()
ProjectSettings & settings()
PrimClex is the top-level data structure for a CASM project.
void print_supercells(std::set< std::string > scel_to_delete={}) const
FilteredConfigIterator< IteratorType > filter_begin(const IteratorType &it, const IteratorType &it_end, const std::vector< std::string > &filter_expr, const DataFormatterDictionary< Configuration > &_dict)
void add_unique_canon_configs(ConfigIterType it_begin, ConfigIterType it_end)
int insert_unique_canon_configs(std::string method, PrimClex &primclex, ScelIterator begin, ScelIterator end, ConfigEnumConstructor f, std::vector< std::string > filter_expr)
Standardizes insertion from enumerators that construct unique primitive canonical configurations...
A Configuration represents the values of all degrees of freedom in a Supercell.