CASM
AClustersApproachtoStatisticalMechanics
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Modules
ConfigIOStrucScore.hh
Go to the documentation of this file.
1 #ifndef CONFIGIOSTRUCSCORE_HH
2 #define CONFIGIOSTRUCSCORE_HH
3 
6 #include "casm/clex/PrimClex.hh"
8 
9 
10 namespace CASM {
11 
12  class Configuration;
13 
14  namespace ConfigIO {
15 
20  class StrucScore: public VectorXdAttribute<Configuration> {
21  public:
23  VectorXdAttribute<Configuration>("struc_score", "Evaluates the mapping of a configuration onto an arbitrary primitive structure, specified by its path. Allowed options are [ 'basis_score' (mean-square site displacement) | 'lattice_score' (lattice deformation metric having units Angstr.^2) | 'total_score' (w*lattice_score+(1.0-w)*basis_score) ]. The struc_score weighting parameter 'w' can be provided as an optional decimal parameter from 0.0 to 1.0 (default 0.5). Ex: struc_score(path/to/PRIM, basis_score, 0.4)"),
24  m_configmapper(ConfigMapper(ConfigMapper::null_initializer)) {};
25 
26  StrucScore(const StrucScore &RHS) :
28  m_altprimclex((RHS.m_altprimclex == nullptr) ? nullptr : new PrimClex(*RHS.m_altprimclex)),
33  }
34 
35  // --- Required implementations -----------
36 
37  std::unique_ptr<StrucScore> clone()const {
38  return std::unique_ptr<StrucScore>(this->_clone());
39  }
40 
41  Eigen::VectorXd evaluate(const Configuration &_config) const override;
42 
43 
44  // --- Specialized implementation -----------
45 
46  bool validate(const Configuration &_config) const override;
47 
48  std::string short_header(const Configuration &_config) const override;
49 
50  std::vector<std::string> col_header(const Configuration &_config) const override;
51  /*
52  void inject(const Configuration &_config, DataStream &_stream, Index) const override;
53 
54  void print(const Configuration &_config, std::ostream &_stream, Index) const override;
55 
56  jsonParser &to_json(const Configuration &_config, jsonParser &json)const override;
57  */
58  bool parse_args(const std::string &args) override;
59 
60  protected:
61  mutable std::unique_ptr<PrimClex> m_altprimclex;
64  std::vector<std::string> m_prop_names;
65 
66  private:
68  StrucScore *_clone() const override {
69  return new StrucScore(*this);
70  }
71  };
72 
73  }
74 }
75 #endif
76 
StrucScore(const StrucScore &RHS)
std::unique_ptr< StrucScore > clone() const
Abstract base class for creating 1D DatumFormatter.
Main CASM namespace.
Definition: complete.cpp:8
Eigen::VectorXd evaluate(const Configuration &_config) const override
bool validate(const Configuration &_config) const override
StrucScore * _clone() const override
Clone.
bool parse_args(const std::string &args) override
Default implementation calls _parse_index_expression.
std::vector< std::string > m_prop_names
std::string short_header(const Configuration &_config) const override
Eigen::VectorXd VectorXd
PrimClex is the top-level data structure for a CASM project.
Definition: PrimClex.hh:52
Evaluates the mapping of a configuration onto an arbitrary primitive structure.
std::unique_ptr< PrimClex > m_altprimclex
std::vector< std::string > col_header(const Configuration &_config) const override
void set_primclex(PrimClex &_pclex)
A Configuration represents the values of all degrees of freedom in a Supercell.