24 "The SuperConfigEnum method generates tilings of sub-configurations in "
26 "supercells. The method works as follows: \n"
27 "- Select a unit cell which all configurations tile into \n"
28 "- Generate all unit-cell-filling equivalents of the input "
30 "- Generate supercells of the unit cell and tile the supercells with all "
32 " combinations of the unit-cell-filling sub-configurations. Any global "
34 " set to zero value. \n\n";
36 std::string custom_options =
37 " supercells: object, ScelEnum JSON settings (required)\n"
38 " Supercells to be tiled with selected configuration, specified in "
40 " size and unit cell via a JSON object conforming to the format of "
42 " JSON settings \"min\", \"max\", \"dirs\", and \"unit_cell\". See "
44 " description for more details. The \"unit_cell\" must be a supercell "
46 " all sub-configurations. \n\n"
48 " confignames: Array of strings (required) \n"
49 " Names of the sub-configurations that can be tiled into the "
51 " Ex: \"confignames\" : "
52 "[\"SCEL1_1_1_1_0_0_0/1\",\"SCEL2_2_1_1_0_0_0/3\"]\n\n"
54 " config_selection: string (optional) \n"
55 " Name of a selection of configurations to be tiled into selected "
58 std::string examples =
61 " To enumerate super-configurations of listed sub-configurations:\n"
62 " casm enum --method SuperConfigEnum -i \n"
64 " \"supercells\": { \n"
66 " \"unit_cell\": \"SCEL2_1_2_1_0_0_0\" \n"
68 " \"confignames\": [\n"
69 " \"SCEL1_1_1_1_0_0_0/0\",\n"
70 " \"SCEL2_1_2_1_0_0_0/0\",\n"
71 " \"SCEL2_1_2_1_0_0_0/1\"\n"
75 " To enumerate super-configurations of listed sub-configurations from "
78 " casm enum --method SuperConfigEnum -i \n"
80 " \"supercells\": { \n"
82 " \"unit_cell\": \"SCEL2_1_2_1_0_0_0\" \n"
84 " \"config_selection\": \"selection_filename\"\n"
100 auto it = config_selection.
selected().begin();
101 auto end = config_selection.
selected().end();
102 for (; it != end; ++it) {
104 std::stringstream msg;
105 msg << it.name() <<
" is not a valid sub configuration.";
106 parser.
error.insert(msg.str());
113 jsonParser const &cli_options_as_json)
const {
119 std::runtime_error error_if_invalid{
120 "Error reading SuperConfigEnum JSON input"};
136 auto scel_enum_props_subparser =
143 *scel_enum_props_subparser->value;
147 auto shared_unit_supercell = std::make_shared<Supercell>(
152 typedef std::string SupercellName;
153 std::map<SupercellName, std::shared_ptr<Supercell const>> target_supercells;
156 for (
auto const &supercell : enumerator) {
157 target_supercells.emplace(supercell.name(),
158 std::make_shared<Supercell const>(supercell));
167 config_selection = DB::make_selection<Configuration>(
170 }
catch (std::exception &e) {
171 std::stringstream msg;
172 msg <<
"Error reading configurations: " << e.what();
173 parser.
error.insert(msg.str());
178 *shared_unit_supercell);
188 std::vector<Configuration> sub_configs;
190 auto it = config_selection.
selected().begin();
191 auto end = config_selection.
selected().end();
193 for (; it != end; ++it) {
194 log <<
"Making equivalents of " << it.name() <<
": " << std::flush;
196 std::back_inserter(sub_configs));
197 log << sub_configs.size() - n_before << std::endl;
198 n_before = sub_configs.size();
202 log <<
"Total sub-configurations, including all equivalents: "
203 << sub_configs.size() << std::flush;
209 auto make_enumerator_f =
211 std::shared_ptr<Supercell const>
const &target_supercell) {
219 formatter.
push_back(ConfigEnumIO::name<ConfigEnumDataType>(),
220 ConfigEnumIO::selected<ConfigEnumDataType>(),
221 ConfigEnumIO::is_new<ConfigEnumDataType>(),
222 ConfigEnumIO::is_existing<ConfigEnumDataType>());
225 ConfigEnumIO::is_excluded_by_filter<ConfigEnumDataType>());
227 formatter.
push_back(ConfigEnumIO::initial_state_index<ConfigEnumDataType>(),
228 ConfigEnumIO::initial_state_name<ConfigEnumDataType>());
231 log.
begin(
"SuperConfigEnum enumeration");
234 target_supercells.begin(), target_supercells.end(),
std::shared_ptr< Structure const > shared_prim
boost::iterator_range< iterator > selected()
void end_section()
End a section.
void set_verbosity(int _verbosity)
void custom(const std::string &what)
Log & subsection()
Create a subsection.
void begin(const std::string &what)
PrimClex is the top-level data structure for a CASM project.
Given a selection of Configurations, enumerate all tilings into some supercell.
static const std::string enumerator_name
void run(PrimClex &primclex, jsonParser const &json_options, jsonParser const &cli_options_as_json) const override
std::string desc() const override
std::string name() const override
Enumeration method name (i.e. "ConfigEnumAllOccupations")
Represents a supercell of the primitive parent crystal structure.
Data structure for holding supercell enumeration properties.
Eigen::Matrix3i generating_matrix() const
ConfigEnumData< ConfigEnumSiteDoFs, ConfigEnumInput > ConfigEnumDataType
std::string description(const SymOp &op, const xtal::Lattice &lat, SymInfoOptions opt=SymInfoOptions())
Print SymInfo to string.
void print_initial_states(Log &log, NamedInitialStatesType const &named_initial_states)
ParentInputParser make_enum_parent_parser(Log &log, jsonParser const &json_options, jsonParser const &cli_options_as_json)
Combine –input / –settings JSON with CLI options.
bool is_valid_sub_configuration(xtal::Lattice const &sub_configuration_lattice, Supercell const &supercell)
void enumerate_configurations(PrimClex const &primclex, ConfigEnumOptions const &options, MakeEnumeratorFunction make_enumerator_f, InputNameValuePairIterator name_value_pairs_begin, InputNameValuePairIterator name_value_pairs_end, DataFormatter< ConfigEnumDataType > const &formatter)
Enumerate configurations.
void report_and_throw_if_invalid(KwargsParser const &parser, Log &log, ErrorType error)
void print_options(Log &log, ConfigEnumOptions const &options)
INDEX_TYPE Index
For long integer indexing:
void require_valid_sub_configurations(ParentInputParser &parser, DB::Selection< Configuration > const &config_selection, Supercell const &supercell)
ConfigOutputIterator make_all_super_configurations(Configuration const &configuration, std::shared_ptr< Supercell const > shared_supercell, ConfigOutputIterator result)
Make all super configurations that fill a particular supercell.
Options for the enumerate_configurations function.
int verbosity
Printing verbosity level.
std::function< bool(Configuration const &)> filter
If filter(configuration)==true, keep configuration, else skip.
std::set< std::string > error