16 void parse(InputParser<BasisFunctionSpecs> &parser, Structure
const &prim,
87 ParsingDictionary<DoFType::Traits>
const *dof_dict) {
89 parser.value = notstd::make_unique<BasisFunctionSpecs>();
90 auto &basis_function_specs = *parser.value;
94 parser.optional_else(basis_function_specs.dof_keys,
"dofs", all_dof_keys);
97 parser.optional_else(basis_function_specs.global_max_poly_order,
98 "global_max_poly_order",
Index{-1});
101 if (parser.self.contains(
"orbit_branch_max_poly_order")) {
102 std::stringstream err_msg;
103 err_msg <<
"Error: could not read 'orbit_branch_max_poly_order': Expected "
105 "pairs of \"<branch>\":<max_poly_order>, where <branch> is the "
106 "number of sites in a cluster "
107 "(as a string), and <max_poly_order> is an integer.";
109 auto const &json = parser.self[
"orbit_branch_max_poly_order"];
112 for (
auto it = json.begin(); it != json.end(); ++it) {
113 Index branch = std::stoi(it.name());
115 parser.value->orbit_branch_max_poly_order[branch] = max_poly_order;
117 }
catch (std::exception &e) {
118 parser.error.insert(err_msg.str());
123 parser.optional(basis_function_specs.include_functions,
"include_functions");
124 parser.optional(basis_function_specs.exclude_functions,
"exclude_functions");
127 parser.optional_else(basis_function_specs.param_pack_type,
"param_pack_type",
131 for (
const auto &key : all_dof_keys) {
132 dof_dict->lookup(key).parse_dof_specs(parser, prim);
140 json[
"dofs"] = basis_function_specs.
dof_keys;
156 for (
const auto &key : all_dof_keys) {
157 dof_dict->
lookup(key).dof_specs_to_json(basis_function_specs, json, prim);
#define ENUM_JSON_IO_DEF(ENUM)
Parsing dictionary for obtaining the correct MoleculeAttribute given a name.
T const & lookup(const key_type &_name) const
Equivalent to find, but set 'home' and throws error with suggestion if.
Structure specifies the lattice and atomic basis of a crystal.
const xtal::BasicStructure & structure() const
static jsonParser object()
Returns an empty json object.
std::string to_string(ENUM val)
Return string representation of enum class.
std::vector< DoFKey > all_dof_types(BasicStructure const &_struc)
jsonParser & to_json(const ClexDescription &desc, jsonParser &json)
INDEX_TYPE Index
For long integer indexing:
void parse(InputParser< ConfigEnumOptions > &parser, std::string method_name, PrimClex const &primclex, DataFormatterDictionary< Configuration > const &dict)
Specify how to construct basis functions.
PARAM_PACK_TYPE param_pack_type
Specify the Clexulator underlying data structure type.
std::vector< Index > include_functions
MaxPolyOrder global_max_poly_order
std::map< OrbitBranchSize, MaxPolyOrder > orbit_branch_max_poly_order
std::vector< Index > exclude_functions
std::vector< DoFKey > dof_keys
Which DoF types to include in the basis functions.