129 for (
auto const &local_dof : configdof.
local_dofs()) {
130 to_json(local_dof.second.standard_values().transpose(),
131 json[
"local_dofs"][local_dof.first][
"values"]);
135 for (
auto const &global_dof : configdof.
global_dofs()) {
137 json[
"global_dofs"][global_dof.first][
"values"]);
148 std::runtime_error error_if_invalid{
149 "Error reading ConfigDoF from JSON input"};
153 if (parser.self.contains(
"occupation")) {
154 parser.require(occ,
"occupation");
156 parser.require(occ,
"occ");
159 }
catch (std::exception
const &e) {
160 parser.insert_error(
"occ", e.what());
164 for (
auto const &local_dof : configdof.
local_dofs()) {
166 fs::path values_path = fs::path{
"local_dofs"} / local_dof.first /
"values";
167 parser.require(tvalues, values_path);
171 }
catch (std::exception
const &e) {
172 parser.insert_error(values_path, e.what());
176 for (
auto const &global_dof : configdof.
global_dofs()) {
178 fs::path values_path =
179 fs::path{
"global_dofs"} / global_dof.first /
"values";
180 parser.require(tvalues, values_path);
183 }
catch (std::exception
const &e) {
184 parser.insert_error(values_path, e.what());
std::map< DoFKey, LocalContinuousConfigDoFValues > const & local_dofs() const
std::map< DoFKey, GlobalContinuousConfigDoFValues > const & global_dofs() const
GlobalContinuousConfigDoFValues const & global_dof(DoFKey const &_key) const
Eigen::VectorXi const & occupation() const
Const reference occupation values.
LocalContinuousConfigDoFValues const & local_dof(DoFKey const &_key) const
void set_occupation(Eigen::Ref< const Eigen::VectorXi > const &_occupation)
Set occupation values.
void from_standard_values(Eigen::Ref< const Eigen::MatrixXd > const &_standard_values)
Set global DoF values from standard DoF values.
void from_standard_values(Eigen::Ref< const Eigen::MatrixXd > const &_standard_values)
Set local DoF values from standard DoF values.
Structure specifies the lattice and atomic basis of a crystal.
static jsonParser object()
Returns an empty json object.
CASM::jsonParser & to_json_array(const Eigen::MatrixBase< Derived > &value, CASM::jsonParser &json)
Write Eigen Matrix with 1 row or 1 column to JSON array.
GenericScelFormatter< double > volume()
jsonParser & to_json(const ClexDescription &desc, jsonParser &json)
std::unique_ptr< ConfigDoF > make_unique_configdof(Structure const &prim, Index volume)
Construct zero-valued std::unique_ptr<ConfigDoF>
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)
INDEX_TYPE Index
For long integer indexing:
static ReturnType from_json(const jsonParser &json)
Default from_json is equivalent to.
static std::unique_ptr< ValueType > make_from_json(const jsonParser &json)
Default make_from_json is equivalent to.