20 std::string custom_options =
21 " n_config: integer (optional, default=100) \n"
22 " How many random configurations to generate. Includes duplicate and "
24 " existing configurations. "
27 std::string examples =
29 " To enumerate 200 random occupations in supercells up to and "
31 " casm enum --method ConfigEnumRandomOccupations -i \n"
32 " '{\"supercells\":{\"max\":4}, \"n_config\": 200}' \n"
34 " To enumerate 200 random occupations in all existing supercells:\n"
35 " casm enum --method ConfigEnumRandomOccupations --all -i "
36 "'{\"n_config\": 200}' \n"
38 " To enumerate 100 random occupations in all existing supercells:\n"
39 " casm enum --method ConfigEnumRandomOccupations --all \n"
41 " To enumerate 200 random occupations in particular supercells:\n"
42 " casm enum --method ConfigEnumRandomOccupations -i \n"
45 " \"SCEL1_1_1_1_0_0_0\",\n"
46 " \"SCEL2_1_2_1_0_0_0\",\n"
47 " \"SCEL4_1_4_1_0_0_0\"\n"
49 " \"n_config\": 200\n"
66 notstd::make_unique<ConfigEnumRandomOccupationsParams>(mtrand, n_config);
77 std::runtime_error error_if_invalid{
78 "Error reading ConfigEnumRandomOccupations JSON input"};
94 auto input_parser_ptr =
95 parser.
parse_as<std::vector<std::pair<std::string, ConfigEnumInput>>>(
99 auto const &named_initial_states = *input_parser_ptr->value;
105 auto random_occ_params_parser_ptr =
109 *random_occ_params_parser_ptr->value;
113 auto make_enumerator_f = [&](
Index index, std::string
name,
121 formatter.
push_back(ConfigEnumIO::name<ConfigEnumDataType>(),
122 ConfigEnumIO::selected<ConfigEnumDataType>(),
123 ConfigEnumIO::is_new<ConfigEnumDataType>(),
124 ConfigEnumIO::is_existing<ConfigEnumDataType>());
127 ConfigEnumIO::is_excluded_by_filter<ConfigEnumDataType>());
130 ConfigEnumIO::initial_state_index<ConfigEnumDataType>(),
131 ConfigEnumIO::initial_state_name<ConfigEnumDataType>(),
132 ConfigEnumIO::initial_state_configname<ConfigEnumDataType>(),
133 ConfigEnumIO::n_selected_sites<ConfigEnumDataType>());
136 log.
begin(
"ConfigEnumRandomOccupations enumeration");
139 named_initial_states.begin(),
140 named_initial_states.end(), formatter);
Enumerate n random occupations in a particular Supercell.
static const std::string enumerator_name
std::string desc() const override
void run(PrimClex &primclex, jsonParser const &json_options, jsonParser const &cli_options_as_json) const override
std::string name() const override
Enumeration method name (i.e. "ConfigEnumAllOccupations")
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.
Represents a supercell of the primitive parent crystal structure.
ConfigEnumData< ConfigEnumSiteDoFs, ConfigEnumInput > ConfigEnumDataType
std::string standard_ConfigEnumInput_help()
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.
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 parse(InputParser< ConfigEnumOptions > &parser, std::string method_name, PrimClex const &primclex, DataFormatterDictionary< Configuration > const &dict)
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.
Parameters controlling ConfigEnumRandomOccupations.