20 std::shared_ptr<const Structure>
const &
shared_prim) {
30 std::shared_ptr<const Structure>
const &
shared_prim) {
33 std::runtime_error error_if_invalid{
34 "Error reading Configuration from JSON input"};
37 parser.require(T,
"transformation_matrix_to_supercell");
39 auto shared_supercell = std::make_shared<Supercell const>(
shared_prim, T);
42 parser.optional(configdof,
"dof");
44 if (configdof.
n_vol() != shared_supercell->volume()) {
45 std::stringstream msg;
46 msg <<
"Error reading Configuration from JSON: "
47 <<
"supercell size (" << shared_supercell->volume() <<
") and "
48 <<
"configdof size (" << configdof.
n_vol() <<
") are inconsistent.";
49 msg <<
"supercell_name: " << json[
"supercell_name"].
get<std::string>();
50 parser.error.insert(msg.str());
54 return notstd::make_unique<Configuration>(shared_supercell, configdof);
87 throw std::runtime_error(
88 "Error inserting configuration to json: not an object");
92 json[
"supercell_name"] = supercell.
name();
93 json[
"transformation_matrix_to_supercell"] =
std::shared_ptr< Structure const > shared_prim
Index n_vol() const
Integer volume of ConfigDoF.
const ConfigDoF & configdof() const
const Access the DoF
const Supercell & supercell() const
Get the Supercell for this Configuration.
Represents a supercell of the primitive parent crystal structure.
std::shared_ptr< Structure const > const & shared_prim() const
const SupercellSymInfo & sym_info() const
A class that collects all symmetry information for for performing symmetry transformations on the sit...
Eigen::Matrix3l transformation_matrix_to_super() const
long-int transformation from primitive lattice vectors to supercell lattice vectors supercell_lattice...
bool is_obj() const
Check if object type.
T get(Args &&... args) const
Get data from json, using one of several alternatives.
jsonParser & to_json(const ClexDescription &desc, jsonParser &json)
void from_json(ClexDescription &desc, const jsonParser &json)
ConfigDoF make_configdof(Structure const &prim, Index volume)
Construct zero-valued ConfigDoF.
void report_and_throw_if_invalid(KwargsParser const &parser, Log &log, ErrorType error)
Matrix< long int, 3, 3 > Matrix3l
static ReturnType from_json(const jsonParser &json)
Default from_json is equivalent to.
Helper struct for constructing objects that need additional data.
static std::unique_ptr< ValueType > make_from_json(const jsonParser &json)
Default make_from_json is equivalent to.