CASM  1.1.0
A Clusters Approach to Statistical Mechanics
MappedProperties.hh
Go to the documentation of this file.
1 #ifndef CASM_MappedProperties
2 #define CASM_MappedProperties
3 
4 #include <ctime>
5 #include <string>
6 
10 #include "casm/global/eigen.hh"
11 
12 namespace CASM {
13 
76  MappedProperties() : init_config("import") {}
77 
81  std::map<std::string, Eigen::MatrixXd> global;
82 
86  std::map<std::string, Eigen::MatrixXd> site;
87 
88  bool has_scalar(std::string const &_name) const;
89 
90  double const &scalar(std::string const &_name) const;
91 
92  double &scalar(std::string const &_name);
93 
94  // Note: In the future, the following may be moved out of MappedProperties
95 
100  std::string origin;
101 
104  std::string to;
105 
112  std::string init_config;
113 
117 };
118 
119 jsonParser &to_json(const MappedProperties &prop, jsonParser &json);
120 
121 jsonParser const &from_json(MappedProperties &prop, const jsonParser &json);
122 
146  public:
148 
149  static std::string method_name(Method m) {
150  if (m == Method::minimum)
151  return "minimum";
152  else if (m == Method::maximum)
153  return "maximum";
154  else if (m == Method::direct_selection)
155  return "direct_selection";
156  else if (m == Method::deformation_cost)
157  return "deformation_cost";
158  return "unknown";
159  }
160 
161  struct Option {
162  Option(Method _method = Method::minimum, std::string _name = "energy")
163  : Option(_method, _name, -1.) {}
164 
165  Option(Method _method, double _lattice_weight = 0.5)
166  : Option(_method, "", _lattice_weight) {}
167 
170 
172  std::string name;
173 
175 
176  private:
177  Option(Method _method, std::string _name, double _lattice_weight);
178  };
179 
182  "energy"));
183 
184  double operator()(const MappedProperties &obj) const;
185 
186  bool validate(const MappedProperties &obj) const;
187 
188  bool operator==(const ScoreMappedProperties &B) const;
189 
190  bool operator!=(const ScoreMappedProperties &B) const;
191 
192  const Option &option() const { return m_opt; }
193 
194  private:
196 };
197 
199 
201  const jsonParser &json);
202 } // namespace CASM
203 
204 namespace CASM {
207 } // namespace CASM
208 
209 #endif
#define ENUM_TRAITS(ENUM)
Definition: io_traits.hh:213
#define ENUM_IO_DECL(ENUM)
Definition: stream_io.hh:8
Interface class to check and/or store path and last_write_time of file on disk. Used to determine if ...
Definition: FileData.hh:9
bool operator==(const ScoreMappedProperties &B) const
const Option & option() const
bool operator!=(const ScoreMappedProperties &B) const
bool validate(const MappedProperties &obj) const
ScoreMappedProperties(Option _opt=Option(Method::minimum, "energy"))
Default uses minimum energy.
static std::string method_name(Method m)
double operator()(const MappedProperties &obj) const
GenericDatumFormatter< double, Result > score()
Main CASM namespace.
Definition: APICommand.hh:8
jsonParser & to_json(const ClexDescription &desc, jsonParser &json)
void from_json(ClexDescription &desc, const jsonParser &json)
double const & scalar(std::string const &_name) const
MappedProperties()
default construction sets init_config field to "import"
std::map< std::string, Eigen::MatrixXd > site
bool has_scalar(std::string const &_name) const
std::map< std::string, Eigen::MatrixXd > global
Option(Method _method=Method::minimum, std::string _name="energy")
Option(Method _method, double _lattice_weight=0.5)
Method method
Method for scoring.
std::string name
Property name or configname used for scoring.