4 #include <boost/filesystem.hpp>
16 template <
typename _Base>
19 if (
calctype.empty() && derived().has_primclex()) {
20 calctype = derived().primclex().settings().default_clex().calctype;
22 auto it = m_calc_properties_map.find(
calctype);
23 if (it == m_calc_properties_map.end()) {
25 it = m_calc_properties_map.find(
calctype);
31 template <
typename _Base>
35 if (!derived().has_primclex()) {
36 m_calc_properties_map.clear();
39 calctype = derived().primclex().settings().default_clex().calctype;
41 m_calc_properties_map[
calctype] = _prop;
44 template <
typename _Base>
50 template <
typename _Base>
55 template <
typename _Base>
61 m_source.push_back(source);
67 template <
typename _Base>
74 for (
int i = 0; i < m_source.size(); i++) {
75 if (m_source[i] == source)
return;
79 m_source.push_back(source);
84 for (
int s = 0;
s < source.
size();
s++) {
87 for (
int i = 0; i < m_source.size(); i++) {
88 if (m_source[i] == source[
s]) {
96 m_source.push_back(source[
s]);
103 template <
typename _Base>
106 m_calc_properties_map.clear();
108 if (cache_updated()) {
115 template <
typename _Base>
117 if (!derived().has_primclex()) {
125 auto it = db.find_via_to(this->
name());
126 if (it != db.end()) {
127 m_calc_properties_map[
calctype] = *it;
136 template <
typename ConfigType>
138 auto const &settings =
config.primclex().settings();
140 calctype = settings.default_clex().calctype;
146 template <
typename ConfigType>
152 template <
typename ConfigType>
160 if (json.
contains(
"status"))
return json[
"status"].
get<std::string>();
162 return (
"not_submitted");
166 template <
typename ConfigType>
175 return json[
"failure_type"].
get<std::string>();
180 template <
typename ConfigType>
188 template <
typename ConfigType>
196 template <
typename ConfigType>
205 template <
typename ConfigType>
210 template <
typename ConfigType>
220 const std::vector<std::string> &required_properties) {
221 return std::all_of(required_properties.begin(), required_properties.end(),
222 [&](
const std::string &key) {
223 return (calc_properties.global.count(key) ||
224 calc_properties.site.count(key));
250 std::vector<std::string>
name;
252 boost::token_compress_on);
269 calcjson.
get_else<
int>(n_images,
"n_images", 0);
271 return (tmp.parent_path() / (
"/N_images_" +
std::to_string(n_images)) /
278 #define INST_ConfigType(r, data, type) \
279 template bool is_calculated(const type &config, std::string calctype); \
280 template void reset_properties(type &config); \
281 template std::string calc_status(const type &_config, std::string calctype); \
282 template std::string failure_type(const type &config, std::string calctype); \
283 template bool has_calc_status(const type &config, std::string calctype); \
284 template bool has_failure_type(const type &config, std::string calctype); \
285 template std::string calc_properties_path(const type &config, \
286 std::string calctype); \
287 template std::string pos_path(const type &config); \
288 template std::string calc_status_path(const type &config, \
289 std::string calctype); \
290 template class Calculable<CRTPBase<type>>;
#define INST_ConfigType(r, data, type)
std::set< std::string > & s
#define CASM_DB_CONFIG_TYPES
void set_calc_properties(const MappedProperties &_prop, std::string calctype="")
MappedProperties const & calc_properties(std::string calctype="") const
Return MappedProperties for requested calctype.
void _modify_dof()
Call in MostDerived any time DoF may be modified.
Base::MostDerived MostDerived
void set_source(const jsonParser &source)
void _refresh_calc_properties(std::string calctype="") const
grabs properties from the indicated calctype and adds info to calc_properties_map
void push_back_source(const jsonParser &source)
void refresh_calc_properties(std::string calctype="")
grabs properties from the indicated calctype and adds info to calc_properties_map
const jsonParser & source() const
fs::path configuration_calc_settings_dir(std::string configname, std::string calctype) const
Return calculation settings directory path, for configuration specific settings.
fs::path calculated_properties(std::string configname, std::string calctype) const
Return properties.calc.json file path.
fs::path configuration_calc_dir(std::string configname, std::string calctype) const
Return directory containing properties.calc.json.
fs::path calc_settings_dir(std::string calctype) const
Return calculation settings directory path, for global settings.
fs::path supercell_calc_settings_dir(std::string scelname, std::string calctype) const
Return calculation settings directory path, for supercell specific settings.
fs::path calc_status(std::string configname, std::string calctype) const
Return calculation status file path.
fs::path POS(std::string configname) const
Return path to standard POS file location.
PrimClex is the top-level data structure for a CASM project.
ClexDescription const & default_clex() const
Get default ClexDescription.
bool contains(const std::string &name) const
Return true if JSON object contains 'name'.
bool is_array() const
Check if array type.
bool read(std::istream &stream)
Reads json from the stream.
bool is_null() const
Check if null type.
std::string to_string(ENUM val)
Return string representation of enum class.
const DB::PropertiesDatabase & const_db_props(std::string calc_type) const
ProjectSettings & settings()
const DirectoryStructure & dir() const
Access DirectoryStructure object. Throw if not set.
bool get_else(T &t, const std::string &key, const T &default_value, Args &&... args) const
T get(Args &&... args) const
Get data from json, using one of several alternatives.
ConfigIO::GenericConfigFormatter< jsonParser > config()
ConfigIO::GenericConfigFormatter< std::string > configname()
Constructs DataFormmaterDictionary containing all Configuration DatumFormatters.
std::string calc_properties_path(const ConfigType &config, std::string calctype="")
bool is_calculated(const ConfigType &config, std::string calctype="")
Return true if all required properties have been been calculated for the configuration.
std::string pos_path(const ConfigType &config, std::string calctype="")
void reset_properties(ConfigType &config)
std::string calc_status_path(const ConfigType &config, std::string calctype="")
GenericDatumFormatter< std::string, DataObject > name()
std::string failure_type(const ConfigType &config, std::string calctype="")
std::string calc_status(const ConfigType &_config, std::string calctype="")
Status of calculation.
bool has_calc_status(const ConfigType &config, std::string calctype="")
bool has_failure_type(const ConfigType &config, std::string calctype="")