CASM  1.1.0
A Clusters Approach to Statistical Mechanics
ClexDescription.cc
Go to the documentation of this file.
2 
6 #include "casm/misc/algorithm.hh"
7 
8 namespace CASM {
9 
10 void ClexDescription::print(std::ostream &sout, bool is_default,
11  int indent) const {
12  std::string in(' ', indent);
13  sout << in << name;
14  if (is_default) {
15  sout << "*";
16  }
17  sout << ": \n";
18  sout << in << std::setw(16) << "property: " << property << "\n";
19  sout << in << std::setw(16) << "calctype: " << calctype << "\n";
20  sout << in << std::setw(16) << "ref: " << ref << "\n";
21  sout << in << std::setw(16) << "bset: " << bset << "\n";
22  sout << in << std::setw(16) << "eci: " << eci << "\n";
23  sout << "\n";
24 }
25 
27  std::string name = "formation_energy";
28  std::string property = "formation_energy";
29  std::string calctype = "default";
30  std::string ref = "default";
31  std::string bset = "default";
32  std::string eci = "default";
34 }
35 
37 bool operator<(const ClexDescription &A, const ClexDescription &B) {
38  return A.name < B.name;
39 }
40 
42  json.put_obj();
43  json["name"] = desc.name;
44  json["property"] = desc.property;
45  json["calctype"] = desc.calctype;
46  json["ref"] = desc.ref;
47  json["bset"] = desc.bset;
48  json["eci"] = desc.eci;
49  return json;
50 }
51 
53  from_json(desc.name, json["name"]);
54  from_json(desc.property, json["property"]);
55  from_json(desc.calctype, json["calctype"]);
56  from_json(desc.ref, json["ref"]);
57  from_json(desc.bset, json["bset"]);
58  from_json(desc.eci, json["eci"]);
59 }
60 
62  bool result{true};
63  result &= dir.new_bset_dir(desc.bset);
65  result &= dir.new_ref_dir(desc.calctype, desc.ref);
67  desc.eci);
68  return result;
69 }
70 
72  return contains(dir.all_calctype(), desc.calctype) &&
75  contains(
77  desc.eci);
78 }
79 
80 } // namespace CASM
Specification of CASM project directory structure.
std::vector< std::string > all_eci(std::string property, std::string calctype, std::string ref, std::string bset) const
Check filesystem directory structure and return list of all eci names.
bool new_calc_settings_dir(std::string calctype) const
Add calculation settings directory path.
bool new_bset_dir(std::string bset) const
Add a basis set directory.
std::vector< std::string > all_calctype() const
Check filesystem directory structure and return list of all calctype names.
std::vector< std::string > all_bset() const
Check filesystem directory structure and return list of all basis set names.
bool new_ref_dir(std::string calctype, std::string ref) const
Add a ref directory.
bool new_eci_dir(std::string property, std::string calctype, std::string ref, std::string bset, std::string eci) const
Add an eci directory.
std::vector< std::string > all_ref(std::string calctype) const
Check filesystem directory structure and return list of all ref names for a given calctype.
jsonParser & put_obj()
Puts new empty JSON object.
Definition: jsonParser.hh:354
Main CASM namespace.
Definition: APICommand.hh:8
jsonParser & to_json(const ClexDescription &desc, jsonParser &json)
bool clex_exists(const DirectoryStructure &dir, const ClexDescription &desc)
GenericDatumFormatter< std::string, DataObject > name()
bool operator<(const ClexDescription &A, const ClexDescription &B)
Compare using name strings: A.name < B.name.
void from_json(ClexDescription &desc, const jsonParser &json)
bool contains(const Container &container, const T &value)
Equivalent to container.end() != std::find(container.begin(), container.end(), value)
Definition: algorithm.hh:83
bool new_dir(const DirectoryStructure &dir, ClexDescription const &desc)
ClexDescription default_configuration_clex()
pair_type ref
Definition: settings.cc:144
pair_type eci
Definition: settings.cc:146
ClexDescription & desc
Definition: settings.cc:138
pair_type calctype
Definition: settings.cc:143
pair_type property
Definition: settings.cc:142
DirectoryStructure const & dir
Definition: settings.cc:136
pair_type bset
Definition: settings.cc:145
Specifies a particular cluster expansion.
void print(std::ostream &sout, bool is_default, int indent=0) const