10 "For CanonicalConditions, expect a JSON object of form:\n"
12 " \"comp\": { // option 1: parameteric composition "
17 " \"comp\": [0.3, 0.2, ...], // option 2: parameteric composition "
19 " \"comp_n\": { // option 3: mol per prim composition "
24 " \"comp_n\": [1.2, 0.3, ...], // option 4: mol per prim composition "
26 " \"temperature\" : 350.0,\n"
27 " \"tolerance\" : 0.001\n"
35 const fs::path &read_path)
38 throw std::runtime_error(
"No composition axes selected.");
51 throw std::runtime_error(
"ERROR: Invalid drive mode.");
67 std::string level1 =
"driver";
68 std::string level2 =
"custom_conditions";
71 std::vector<CanonicalConditions> cond;
72 const jsonParser &json = (*this)[level1][level2];
73 for (
auto it = json.
begin(); it != json.
end(); ++it) {
77 }
catch (std::runtime_error &e) {
80 err_log <<
"Tried to read an array of CanonicalConditions from [\""
81 << level1 <<
"\"][\"" << level2 <<
"\"]" << std::endl;
82 err_log << _help() << std::endl;
93 std::string level1 =
"model";
98 std::vector<std::string> var{
"clex",
"calctype",
"ref",
"bset",
"eci"};
99 std::vector<std::string>
help{
100 "string\n Names the cluster expansion to be used.\n",
101 "string\n Names the calctype to be used.\n",
102 "string\n Names the reference to be used.\n",
103 "string\n Names the basis set to be used.\n",
104 "string\n Names the ECI to be used.\n"};
107 _get_setting<std::string>(level1, var[0],
help[0]),
108 _get_setting<std::string>(level1, var[1],
help[1]),
109 _get_setting<std::string>(level1, var[2],
help[2]),
110 _get_setting<std::string>(level1, var[3],
help[3]),
111 _get_setting<std::string>(level1, var[4],
help[4]));
115 "(string, default='formation_energy')\n"
116 " Names the formation_energy cluster expansion to be used.\n";
121 _get_setting<std::string>(level1,
"formation_energy",
help);
127 err_log <<
"Error reading [\"model\"][\"formation_energy\"]\n";
128 err_log <<
"[\"model\"][\"formation_energy\"]: (string, optional, "
129 "default='formation_energy')\n";
130 err_log <<
" Names the cluster expansion to be used for calculating "
131 "formation_energy.\n";
142 std::string level1 =
"data";
143 std::string level2 =
"measurements";
145 const jsonParser &json = (*this)[level1][level2];
146 for (
auto it = json.
cbegin(); it != json.
cend(); ++it) {
147 if (it->contains(
"quantity") &&
148 (*it)[
"quantity"].get<std::string>() ==
"all_correlations") {
153 }
catch (std::runtime_error &e) {
156 err_log <<
"Error checking if 'all_correlations' should be sampled.\n";
157 err_log <<
"Error reading settings at [\"" << level1 <<
"\"][\"" << level2
159 err_log <<
"See 'casm format --monte' for help.\n" << std::endl;
165 std::string level1 =
"driver";
166 std::string level2 =
name;
169 }
catch (std::runtime_error &e) {
173 err_log <<
"Tried to construct CanonicalCondtions from [\"" << level1
174 <<
"\"][\"" << level2 <<
"\"]" << std::endl;
175 err_log << _help() << std::endl;
std::set< std::string > & s
void error(const std::string &what)
static const int standard
CanonicalSettings()
Default constructor.
CanonicalConditions final_conditions() const
Expects final_conditions.
ClexDescription formation_energy(const PrimClex &primclex) const
Get formation energy cluster expansion.
std::vector< CanonicalConditions > custom_conditions() const
Expects custom_conditions.
CanonicalConditions incremental_conditions() const
Expects incremental_conditions.
CanonicalConditions _conditions(std::string name) const
CanonicalConditions initial_conditions() const
Expects initial_conditions.
bool all_correlations() const
Return true if all correlations should be sampled.
const PrimClex & primclex() const
virtual const Monte::DRIVE_MODE drive_mode() const
Given a settings jsonParser figure out the drive mode. Expects drive_mode/incremental,...
bool _is_setting(std::string level1, std::string level2) const
Returns true if (*this)[level1].contains(level2)
PrimClex is the top-level data structure for a CASM project.
iterator begin()
Returns const_iterator to beginning of JSON object or JSON array.
iterator end()
Returns iterator to end of JSON object or JSON array.
const_iterator cend() const
Returns const_iterator to end of JSON object or JSON array.
const_iterator cbegin() const
Returns const_iterator to beginning of JSON object or JSON array.
ProjectSettings & settings()
bool has_composition_axes() const
check if CompositionConverter object initialized
jsonParser & push_back(const T &value, Args &&... args)
void from_json(CanonicalConditions &conditions, const PrimClex &primclex, const jsonParser &json)
Read CanonicalConditions from JSON format.
GenericDatumFormatter< std::string, DataObject > name()
std::string help()
Uses 'multiline_help<T>()' by default.
Specifies a particular cluster expansion.