34 if (invariants.displacement().size()) {
35 json[
"min_length"] = invariants.displacement().front();
36 json[
"max_length"] = invariants.displacement().back();
38 json[
"min_length"] = 0.0;
39 json[
"max_length"] = 0.0;
70 ss <<
"Error: Invalid cluster JSON object";
94 }
else if (json.
contains(
"prototype")) {
98 "Error reading IntegralCluster from JSON: Expected 'sites' or "
99 "'prototype' containing a list of cluster site coordinates.");
107 parser.
value = notstd::make_unique<IntegralCluster>(prim);
108 auto &clust = *parser.
value;
113 std::vector<Eigen::Vector3d> coord_vec;
117 for (
const auto &coord : coord_vec) {
119 clust.elements().emplace_back(
122 }
catch (std::exception &e) {
123 parser.
error.insert(
"Error: could not read coordinates from '" +
name +
Stores cluster invariants: number of sites and site distances.
iterator end()
Iterator to the past-the-last element in the cluster.
iterator begin()
Iterator to first element in the cluster.
const PrimType & prim() const
Structure specifies the lattice and atomic basis of a crystal.
const Lattice & lattice() const
bool contains(const std::string &name) const
Return true if JSON object contains 'name'.
jsonParser & put_obj()
Puts new empty JSON object.
jsonParser & put_array()
Puts new empty JSON array.
Represents cartesian and fractional coordinates.
static UnitCellCoord from_coordinate(const PrimType &, const Coordinate &coord, double tol)
jsonParser & to_json(const ClexDescription &desc, jsonParser &json)
GenericDatumFormatter< std::string, DataObject > name()
const COORD_TYPE INTEGRAL
void from_json(ClexDescription &desc, const jsonParser &json)
void report_and_throw_if_invalid(KwargsParser const &parser, Log &log, ErrorType error)
void parse(InputParser< ConfigEnumOptions > &parser, std::string method_name, PrimClex const &primclex, DataFormatterDictionary< Configuration > const &dict)
std::set< std::string > error
static ReturnType from_json(const jsonParser &json)
Default from_json is equivalent to.