CASM
AClustersApproachtoStatisticalMechanics
|
#include <MonteSettings.hh>
Settings for Monte Carlo calculations.
Definition at line 48 of file MonteSettings.hh.
Public Types | |
typedef Index | size_type |
Public Member Functions | |
MonteSettings () | |
Default constructor. More... | |
MonteSettings (const PrimClex &_primclex, const fs::path &read_path) | |
Construct MonteSettings by reading a settings JSON file. More... | |
fs::path | root () const |
const PrimClex & | primclex () const |
Monte::ENSEMBLE | ensemble () const |
Return type of Monte Carlo ensemble. More... | |
Monte::METHOD | method () const |
Return type of Monte Carlo method. More... | |
bool | debug () const |
Run in debug mode? More... | |
void | set_debug (bool _debug) |
Set debug mode. More... | |
bool | is_motif_configname () const |
Returns true if configname of configuration to use as starting motif has been specified. More... | |
std::string | motif_configname () const |
Configname of configuration to use as starting motif. More... | |
bool | is_motif_configdof () const |
Returns true if path to ConfigDoF file to use as starting motif has been specified. More... | |
ConfigDoF | motif_configdof () const |
ConfigDoF to use as starting motif. More... | |
fs::path | motif_configdof_path () const |
Path to ConfigDoF file to use as starting motif. More... | |
Eigen::Matrix3i | simulation_cell_matrix () const |
Supercell matrix defining the simulation cell. More... | |
virtual const Monte::DRIVE_MODE | drive_mode () const |
Given a settings jsonParser figure out the drive mode. Expects drive_mode/incremental,custom. More... | |
bool | dependent_runs () const |
If dependent runs, start subsequent calculations with the final state of the previous calculation. Default true. More... | |
double | confidence () const |
Given a settings jsonParser figure out the global tolerance (probably for == operator). Expects tolerance/value. More... | |
bool | write_trajectory () const |
Returns true if snapshots are requested. More... | |
bool | write_POSCAR_snapshots () const |
Returns true if POSCARs of snapshots are requsted. Requires write_trajectory. More... | |
bool | write_observations () const |
Writes all observations. More... | |
bool | write_csv () const |
Write csv versions of files? (csv is the default format if no 'output_format' given) More... | |
bool | write_json () const |
Write json versions of files? More... | |
const fs::path | output_directory () const |
Directory where output should go. More... | |
bool | is_enumeration () const |
Returns true if enumeration is requested. (Default false) More... | |
std::string | enumeration_metric_args () const |
Returns 'casm query'-like enumeration metric args. More... | |
std::string | enumeration_check_args () const |
Returns 'casm query'-like enumeration check args. More... | |
Monte::ENUM_SAMPLE_MODE | enumeration_sample_mode () const |
Enumeration sample mode (default Monte::ENUM_SAMPLE_MODE::ON_SAMPLE) More... | |
bool | enumeration_insert_canonical () const |
Insert configurations in their canonical form. More... | |
bool | enumeration_check_existence () const |
Only insert configurations that are not already enumerated. More... | |
Index | enumeration_N_halloffame () const |
Returns enumeration halloffame max size (default 100) More... | |
double | enumeration_tol () const |
Returns enumeration halloffame tolerance (default 1e-8) More... | |
Protected Types | |
typedef jsonParserIterator< false > | iterator |
typedef jsonParserIterator< true > | const_iterator |
Protected Member Functions | |
bool | _is_setting (std::string level1, std::string level2) const |
Returns true if (*this)[level1].contains(level2) More... | |
bool | _is_setting (std::string level1, std::string level2, std::string level3) const |
Returns true if (*this)[level1][level2].contains(level3) More... | |
template<typename T > | |
T | _get_setting (std::string level1, std::string msg) const |
Returns (*this)[level1].get<T>();. More... | |
template<typename T > | |
T | _get_setting (std::string level1, std::string level2, std::string msg) const |
Returns (*this)[level1][level2].get<T>();. More... | |
template<typename T > | |
T | _get_setting (std::string level1, std::string level2, std::string level3, std::string msg) const |
Returns (*this)[level1][level2][level3].get<T>();. More... | |
jsonParser | _json () const |
bool | read (std::istream &stream) |
Reads json from the stream. More... | |
bool | read (const boost::filesystem::path &mypath) |
Reads json from a path. More... | |
void | print (std::ostream &stream, unsigned int indent=2, unsigned int prec=12) const |
Print json to stream. More... | |
void | write (const std::string &file_name, unsigned int indent=2, unsigned int prec=12) const |
Write json to file. More... | |
void | write (const boost::filesystem::path &mypath, unsigned int indent=2, unsigned int prec=12) const |
Write json to file. More... | |
bool | operator!= (const jsonParser &json) const |
bool | almost_equal (const jsonParser &B, double tol) const |
bool | is_null () const |
Check if null type. More... | |
bool | is_bool () const |
Check if bool type. More... | |
bool | is_int () const |
Check if int type. More... | |
bool | is_number () const |
Check if number type (not including int) More... | |
bool | is_string () const |
Check if string. More... | |
bool | is_obj () const |
Check if object type. More... | |
bool | is_array () const |
Check if array type. More... | |
jsonParser & | operator[] (const std::string &name) |
const jsonParser & | operator[] (const std::string &name) const |
jsonParser & | operator[] (const int &element) |
Return a reference to the sub-jsonParser (JSON value) from index 'element' iff jsonParser is a JSON array. More... | |
const jsonParser & | operator[] (const int &element) const |
Return a const reference to the sub-jsonParser (JSON value) from index 'element' iff jsonParser is a JSON array. More... | |
jsonParser & | at (const fs::path &path) |
const jsonParser & | at (const fs::path &path) const |
size_type | size () const |
Returns array size if *this is a JSON array, object size if *this is a JSON object, 1 otherwise. More... | |
iterator | begin () |
Returns const_iterator to beginning of JSON object or JSON array. More... | |
const_iterator | begin () const |
Returns iterator to beginning of JSON object or JSON array. More... | |
iterator | end () |
Returns iterator to end of JSON object or JSON array. More... | |
const_iterator | end () const |
Returns const_iterator to end of JSON object or JSON array. More... | |
const_iterator | cbegin () const |
Returns const_iterator to beginning of JSON object or JSON array. More... | |
const_iterator | cend () const |
Returns const_iterator to end of JSON object or JSON array. More... | |
iterator | find (const std::string &name) |
Return iterator to JSON object value with 'name'. More... | |
const_iterator | find (const std::string &name) const |
Return const_iterator to JSON object value with 'name'. More... | |
bool | contains (const std::string &name) const |
Return true if JSON object contains 'name'. More... | |
size_type | erase (const std::string &name) |
Erase key:value pair from an object. More... | |
template<typename T , typename... Args> | |
T | get (Args...args) const |
Get data from json, using one of several alternatives. More... | |
template<typename T , typename... Args> | |
void | get (T &t, Args...args) const |
template<typename T , typename... Args> | |
bool | get_if (T &t, const std::string &key, Args...args) const |
template<typename T , typename... Args> | |
bool | get_else (T &t, const std::string &key, const T &default_value, Args...args) const |
template<typename T > | |
jsonParser & | push_back (const T &value) |
Puts new valued element at end of array of any type T for which 'jsonParser& to_json( const T &value, jsonParser &json)' is defined. More... | |
template<typename T > | |
jsonParser & | put (const T &value) |
Puts data of any type T for which 'jsonParser& to_json( const T &value, jsonParser &json)' is defined (same as 'operator=') More... | |
jsonParser & | put_obj () |
Puts new empty JSON object. More... | |
template<typename Iterator > | |
jsonParser & | put_obj (Iterator begin, Iterator end) |
Puts new JSON object, from iterators over a range of values of type std::pair<std::string, T> More... | |
jsonParser & | put_array () |
Puts new empty JSON array. More... | |
jsonParser & | put_array (size_type N) |
Puts new JSON array. More... | |
template<typename T > | |
jsonParser & | put_array (size_type N, const T &t) |
Puts new JSON array, using the same value. More... | |
template<typename Iterator > | |
jsonParser & | put_array (Iterator begin, Iterator end, typename CASM_TMP::enable_if_iterator< Iterator >::type *=nullptr) |
Puts new JSON array, from iterators. More... | |
jsonParser & | put_null () |
Puts 'null' JSON value. More... | |
Static Protected Member Functions | |
static jsonParser | parse (const std::string &str) |
Construct a jsonParser from a string containing JSON data. More... | |
static jsonParser | parse (const fs::path &path) |
Construct a jsonParser from a file containing JSON data. More... | |
static jsonParser | parse (std::istream &stream) |
Construct a jsonParser from a stream containing JSON data. More... | |
static jsonParser | object () |
Returns an empty json object. More... | |
template<typename Iterator > | |
static jsonParser | object (Iterator begin, Iterator end) |
Puts new JSON object, from iterators over a range of values of type std::pair<std::string, T> More... | |
static jsonParser | array () |
Returns an empty json array. More... | |
static jsonParser | array (size_type N) |
Returns an empty json array. More... | |
template<typename T > | |
static jsonParser | array (size_type N, const T &t) |
Puts new JSON array, using the same value. More... | |
template<typename Iterator > | |
static jsonParser | array (Iterator begin, Iterator end, typename CASM_TMP::enable_if_iterator< Iterator >::type *=nullptr) |
Puts new JSON array, from iterators. More... | |
static jsonParser | null () |
Returns a null JSON value. More... | |
Private Attributes | |
fs::path | m_root |
fs::path | m_output_directory |
const PrimClex * | m_primclex |
|
inherited |
Definition at line 84 of file jsonParser.hh.
|
inherited |
Definition at line 83 of file jsonParser.hh.
typedef Index CASM::MonteSettings::size_type |
Definition at line 57 of file MonteSettings.hh.
|
inline |
Default constructor.
Definition at line 60 of file MonteSettings.hh.
CASM::MonteSettings::MonteSettings | ( | const PrimClex & | _primclex, |
const fs::path & | read_path | ||
) |
Construct MonteSettings by reading a settings JSON file.
Definition at line 15 of file MonteSettings.cc.
|
protected |
Returns (*this)[level1].get<T>();.
Returns (*this)[level1][level2].get<T>();.
Definition at line 324 of file MonteSettings.hh.
|
protected |
Returns (*this)[level1][level2].get<T>();.
Definition at line 348 of file MonteSettings.hh.
|
protected |
Returns (*this)[level1][level2][level3].get<T>();.
Definition at line 381 of file MonteSettings.hh.
|
protected |
Returns true if (*this)[level1].contains(level2)
Definition at line 386 of file MonteSettings.cc.
|
protected |
Returns true if (*this)[level1][level2].contains(level3)
Definition at line 400 of file MonteSettings.cc.
|
inlineprotected |
Definition at line 193 of file MonteSettings.hh.
|
inherited |
Definition at line 211 of file jsonParser.cc.
|
inlinestaticinherited |
Returns an empty json array.
Definition at line 342 of file jsonParser.hh.
|
inlinestaticinherited |
Returns an empty json array.
Definition at line 348 of file jsonParser.hh.
|
inlinestaticinherited |
Puts new JSON array, using the same value.
Definition at line 355 of file jsonParser.hh.
|
inlinestaticinherited |
Puts new JSON array, from iterators.
Definition at line 362 of file jsonParser.hh.
|
inherited |
Return a reference to the sub-jsonParser (JSON value) with specified relative path Will throw if the 'path' doesn't exist.
Return a reference to the sub-jsonParser (JSON value) with specified relative path Will throw if the 'path' doesn't exist.
Definition at line 321 of file jsonParser.cc.
|
inherited |
Return a reference to the sub-jsonParser (JSON value) with specified relative path Will throw if the 'path' doesn't exist.
Return a reference to the sub-jsonParser (JSON value) with specified relative path Will throw if the 'path' doesn't exist.
Definition at line 330 of file jsonParser.cc.
|
inherited |
Returns const_iterator to beginning of JSON object or JSON array.
Returns iterator to beginning of JSON object or JSON array.
Definition at line 440 of file jsonParser.cc.
|
inherited |
Returns iterator to beginning of JSON object or JSON array.
Returns const_iterator to beginning of JSON object or JSON array.
Definition at line 450 of file jsonParser.cc.
|
inherited |
Returns const_iterator to beginning of JSON object or JSON array.
Returns const iterator to beginning of const JSON object or JSON array.
Definition at line 455 of file jsonParser.cc.
|
inherited |
Returns const_iterator to end of JSON object or JSON array.
Definition at line 480 of file jsonParser.cc.
double CASM::MonteSettings::confidence | ( | ) | const |
Given a settings jsonParser figure out the global tolerance (probably for == operator). Expects tolerance/value.
Requested confidence level. Default 0.95.
Definition at line 135 of file MonteSettings.cc.
|
inherited |
Return true if JSON object contains 'name'.
Definition at line 500 of file jsonParser.cc.
bool CASM::MonteSettings::debug | ( | ) | const |
Run in debug mode?
Definition at line 49 of file MonteSettings.cc.
bool CASM::MonteSettings::dependent_runs | ( | ) | const |
If dependent runs, start subsequent calculations with the final state of the previous calculation. Default true.
Definition at line 115 of file MonteSettings.cc.
|
virtual |
Given a settings jsonParser figure out the drive mode. Expects drive_mode/incremental,custom.
Definition at line 109 of file MonteSettings.cc.
|
inherited |
Returns iterator to end of JSON object or JSON array.
Definition at line 465 of file jsonParser.cc.
|
inherited |
Returns const_iterator to end of JSON object or JSON array.
Returns iterator to end of JSON object or JSON array.
Definition at line 475 of file jsonParser.cc.
Monte::ENSEMBLE CASM::MonteSettings::ensemble | ( | ) | const |
Return type of Monte Carlo ensemble.
Definition at line 39 of file MonteSettings.cc.
std::string CASM::MonteSettings::enumeration_check_args | ( | ) | const |
Returns 'casm query'-like enumeration check args.
Returns 'casm query'-like enumeration check.
Expects a string that will convert to true if the current Configuration should be scored for enumeration. For instance, perhaps you only want to enumerate Configurations that are near or below the currently predicted convex hull. Then, use 'lt(clex_hull_dist(ALL),0.005)'. Default always returns true.
Uses boost::lexical_cast<bool> on the output to determine the result.
Definition at line 297 of file MonteSettings.cc.
bool CASM::MonteSettings::enumeration_check_existence | ( | ) | const |
Only insert configurations that are not already enumerated.
Insert configurations in their canonical form (default true)
Definition at line 319 of file MonteSettings.cc.
bool CASM::MonteSettings::enumeration_insert_canonical | ( | ) | const |
Insert configurations in their canonical form.
Insert configurations in their canonical form (default true)
Definition at line 333 of file MonteSettings.cc.
std::string CASM::MonteSettings::enumeration_metric_args | ( | ) | const |
Returns 'casm query'-like enumeration metric args.
Returns 'casm query'-like enumeration metric.
Expects a string containing the Configuration scoring metric. For instance, 'clex_hull_dist(ALL)' (which is the default).
Uses boost::lexical_cast<double> on the output to determine the result.
Definition at line 269 of file MonteSettings.cc.
Index CASM::MonteSettings::enumeration_N_halloffame | ( | ) | const |
Returns enumeration halloffame max size (default 100)
Definition at line 359 of file MonteSettings.cc.
Monte::ENUM_SAMPLE_MODE CASM::MonteSettings::enumeration_sample_mode | ( | ) | const |
Enumeration sample mode (default Monte::ENUM_SAMPLE_MODE::ON_SAMPLE)
Definition at line 311 of file MonteSettings.cc.
double CASM::MonteSettings::enumeration_tol | ( | ) | const |
Returns enumeration halloffame tolerance (default 1e-8)
Definition at line 372 of file MonteSettings.cc.
|
inherited |
Erase key:value pair from an object.
Erase key:value pair from an object Returns the number of elements erased, which will be 0 or 1
Definition at line 506 of file jsonParser.cc.
|
inherited |
Return iterator to JSON object value with 'name'.
Definition at line 490 of file jsonParser.cc.
|
inherited |
Return const_iterator to JSON object value with 'name'.
Definition at line 495 of file jsonParser.cc.
|
inherited |
Check if array type.
Definition at line 281 of file jsonParser.cc.
|
inherited |
Check if bool type.
Definition at line 256 of file jsonParser.cc.
bool CASM::MonteSettings::is_enumeration | ( | ) | const |
Returns true if enumeration is requested. (Default false)
Definition at line 256 of file MonteSettings.cc.
|
inherited |
Check if int type.
Definition at line 261 of file jsonParser.cc.
bool CASM::MonteSettings::is_motif_configdof | ( | ) | const |
Returns true if path to ConfigDoF file to use as starting motif has been specified.
Definition at line 78 of file MonteSettings.cc.
bool CASM::MonteSettings::is_motif_configname | ( | ) | const |
Returns true if configname of configuration to use as starting motif has been specified.
Definition at line 66 of file MonteSettings.cc.
|
inherited |
Check if null type.
Definition at line 251 of file jsonParser.cc.
|
inherited |
Check if number type (not including int)
Definition at line 266 of file jsonParser.cc.
|
inherited |
Check if object type.
Definition at line 276 of file jsonParser.cc.
|
inherited |
Check if string.
Definition at line 271 of file jsonParser.cc.
Monte::METHOD CASM::MonteSettings::method | ( | ) | const |
Return type of Monte Carlo method.
Definition at line 44 of file MonteSettings.cc.
ConfigDoF CASM::MonteSettings::motif_configdof | ( | ) | const |
ConfigDoF to use as starting motif.
Definition at line 83 of file MonteSettings.cc.
fs::path CASM::MonteSettings::motif_configdof_path | ( | ) | const |
Path to ConfigDoF file to use as starting motif.
Definition at line 91 of file MonteSettings.cc.
std::string CASM::MonteSettings::motif_configname | ( | ) | const |
Configname of configuration to use as starting motif.
Definition at line 71 of file MonteSettings.cc.
|
inlinestaticinherited |
Returns a null JSON value.
Definition at line 371 of file jsonParser.hh.
|
inlinestaticinherited |
Returns an empty json object.
Definition at line 329 of file jsonParser.hh.
|
inlinestaticinherited |
Puts new JSON object, from iterators over a range of values of type std::pair<std::string, T>
Definition at line 336 of file jsonParser.hh.
|
inlineinherited |
Definition at line 157 of file jsonParser.hh.
|
inherited |
Return a reference to the sub-jsonParser (JSON value) with 'name' if it exists If it does not exist, create it with an empty JSON object and return a reference to it
Return a reference to the sub-jsonParser (JSON value) with 'name' if it exists If it does not exist, create it with value == 'null' and return a reference
Definition at line 290 of file jsonParser.cc.
|
inherited |
Return a reference to the sub-jsonParser (JSON value) with 'name' if it exists. Will throw if the 'name' doesn't exist.
Definition at line 304 of file jsonParser.cc.
|
inherited |
Return a reference to the sub-jsonParser (JSON value) from index 'element' iff jsonParser is a JSON array.
Definition at line 368 of file jsonParser.cc.
|
inherited |
Return a const reference to the sub-jsonParser (JSON value) from index 'element' iff jsonParser is a JSON array.
Definition at line 374 of file jsonParser.cc.
const fs::path CASM::MonteSettings::output_directory | ( | ) | const |
Directory where output should go.
Definition at line 127 of file MonteSettings.cc.
|
inlinestaticinherited |
Construct a jsonParser from a string containing JSON data.
Definition at line 312 of file jsonParser.hh.
|
inlinestaticinherited |
Construct a jsonParser from a file containing JSON data.
Definition at line 319 of file jsonParser.hh.
|
inlinestaticinherited |
Construct a jsonParser from a stream containing JSON data.
Definition at line 324 of file jsonParser.hh.
const PrimClex & CASM::MonteSettings::primclex | ( | ) | const |
Definition at line 31 of file MonteSettings.cc.
|
inherited |
|
inlineinherited |
Puts new empty JSON array.
Definition at line 285 of file jsonParser.hh.
|
inlineinherited |
Puts new JSON array.
Definition at line 290 of file jsonParser.hh.
|
inlineinherited |
Puts 'null' JSON value.
Definition at line 305 of file jsonParser.hh.
|
inlineinherited |
Puts new empty JSON object.
Definition at line 276 of file jsonParser.hh.
|
inherited |
Reads json from the stream.
Definition at line 165 of file jsonParser.cc.
|
inherited |
Reads json from a path.
Definition at line 169 of file jsonParser.cc.
fs::path CASM::MonteSettings::root | ( | ) | const |
Definition at line 27 of file MonteSettings.cc.
void CASM::MonteSettings::set_debug | ( | bool | _debug | ) |
Set debug mode.
Definition at line 58 of file MonteSettings.cc.
Eigen::Matrix3i CASM::MonteSettings::simulation_cell_matrix | ( | ) | const |
Supercell matrix defining the simulation cell.
Definition at line 98 of file MonteSettings.cc.
|
inherited |
Returns array size if *this is a JSON array, object size if *this is a JSON object, 1 otherwise.
Definition at line 430 of file jsonParser.cc.
|
inherited |
Write json to file.
Definition at line 191 of file jsonParser.cc.
|
inherited |
Write json to file.
Definition at line 199 of file jsonParser.cc.
bool CASM::MonteSettings::write_csv | ( | ) | const |
Write csv versions of files? (csv is the default format if no 'output_format' given)
Definition at line 185 of file MonteSettings.cc.
bool CASM::MonteSettings::write_json | ( | ) | const |
Write json versions of files?
Definition at line 219 of file MonteSettings.cc.
bool CASM::MonteSettings::write_observations | ( | ) | const |
Writes all observations.
Definition at line 172 of file MonteSettings.cc.
bool CASM::MonteSettings::write_POSCAR_snapshots | ( | ) | const |
Returns true if POSCARs of snapshots are requsted. Requires write_trajectory.
Definition at line 159 of file MonteSettings.cc.
bool CASM::MonteSettings::write_trajectory | ( | ) | const |
Returns true if snapshots are requested.
Definition at line 146 of file MonteSettings.cc.
|
private |
Definition at line 200 of file MonteSettings.hh.
|
private |
Definition at line 201 of file MonteSettings.hh.
|
private |
Definition at line 199 of file MonteSettings.hh.