13 "For GrandCanonicalConditions, expect a JSON object of form:\n"
15 " \"param_chem_pot\": {\n"
19 " \"temperature\" : 350.0,\n"
20 " \"tolerance\" : 0.001\n"
28 const fs::path &read_path)
31 throw std::runtime_error(
"No composition axes selected.");
44 throw std::runtime_error(
"ERROR: Invalid drive mode.");
60 std::vector<GrandCanonicalConditions>
62 std::string level1 =
"driver";
63 std::string level2 =
"custom_conditions";
66 std::vector<GrandCanonicalConditions> cond;
67 const jsonParser &json = (*this)[level1][level2];
68 for (
auto it = json.
begin(); it != json.
end(); ++it) {
72 }
catch (std::runtime_error &e) {
75 err_log <<
"Tried to read an array of GrandCanonicalConditions from [\""
76 << level1 <<
"\"][\"" << level2 <<
"\"]" << std::endl;
77 err_log << _help() << std::endl;
88 std::string level1 =
"model";
93 std::vector<std::string> var{
"clex",
"calctype",
"ref",
"bset",
"eci"};
94 std::vector<std::string>
help{
95 "string\n Names the cluster expansion to be used.\n",
96 "string\n Names the calctype to be used.\n",
97 "string\n Names the reference to be used.\n",
98 "string\n Names the basis set to be used.\n",
99 "string\n Names the ECI to be used.\n"};
102 _get_setting<std::string>(level1, var[0],
help[0]),
103 _get_setting<std::string>(level1, var[1],
help[1]),
104 _get_setting<std::string>(level1, var[2],
help[2]),
105 _get_setting<std::string>(level1, var[3],
help[3]),
106 _get_setting<std::string>(level1, var[4],
help[4]));
110 "(string, default='formation_energy')\n"
111 " Names the formation_energy cluster expansion to be used.\n";
116 _get_setting<std::string>(level1,
"formation_energy",
help);
122 err_log <<
"Error reading [\"model\"][\"formation_energy\"]\n";
123 err_log <<
"[\"model\"][\"formation_energy\"]: (string, optional, "
124 "default='formation_energy')\n";
125 err_log <<
" Names the cluster expansion to be used for calculating "
126 "formation_energy.\n";
140 std::string level1 =
"data";
141 std::string level2 =
"measurements";
143 const jsonParser &json = (*this)[level1][level2];
144 for (
auto it = json.
cbegin(); it != json.
cend(); ++it) {
145 if (it->contains(
"quantity") &&
146 (*it)[
"quantity"].get<std::string>() ==
"all_correlations") {
151 }
catch (std::runtime_error &e) {
154 err_log <<
"Error checking if 'all_correlations' should be sampled.\n";
155 err_log <<
"Error reading settings at [\"" << level1 <<
"\"][\"" << level2
157 err_log <<
"See 'casm format --monte' for help.\n" << std::endl;
163 std::string
name)
const {
164 std::string level1 =
"driver";
165 std::string level2 =
name;
168 }
catch (std::runtime_error &e) {
172 err_log <<
"Tried to construct GrandCanonicalCondtions from [\"" << level1
173 <<
"\"][\"" << level2 <<
"\"]" << std::endl;
174 err_log << _help() << std::endl;
std::set< std::string > & s
void error(const std::string &what)
static const int standard
GrandCanonicalSettings()
Default constructor.
bool all_correlations() const
Return true if all correlations should be sampled.
std::vector< GrandCanonicalConditions > custom_conditions() const
Expects custom_conditions.
GrandCanonicalConditions initial_conditions() const
Expects initial_conditions.
GrandCanonicalConditions final_conditions() const
Expects final_conditions.
GrandCanonicalConditions incremental_conditions() const
Expects incremental_conditions.
GrandCanonicalConditions _conditions(std::string name) const
ClexDescription formation_energy(const PrimClex &primclex) const
Get formation energy cluster expansion.
const PrimClex & primclex() const
Monte::METHOD method() const
Return type of Monte Carlo method.
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.