CASM  1.1.0
A Clusters Approach to Statistical Mechanics
PrimClex.hh
Go to the documentation of this file.
1 #ifndef CASM_PrimClex
2 #define CASM_PrimClex
3 
4 #include <memory>
5 
7 
9 namespace CASM {
10 
11 class DirectoryStructure;
12 class ProjectSettings;
13 struct ClexDescription;
14 class CompositionConverter;
15 class ChemicalReference;
16 class PrimNeighborList;
17 struct ClexBasisSpecs;
18 class ClusterSpecs;
19 class ClexBasis;
20 class Clexulator;
21 class ECIContainer;
22 class Structure;
23 
24 namespace DB {
25 template <typename T>
26 class ValDatabase;
27 template <typename T>
28 class Database;
29 class PropertiesDatabase;
30 class DatabaseHandler;
31 } // namespace DB
32 
55 class PrimClex {
56  public:
58 
59  // **** Constructors ****
60 
62  explicit PrimClex(ProjectSettings const &_project_settings,
63  std::shared_ptr<PrimType const> _shared_prim);
64 
68  explicit PrimClex(const fs::path &_root);
69 
70  PrimClex(const PrimClex &) = delete;
71 
72  ~PrimClex();
73 
75  void refresh(bool read_settings = false, bool read_composition = false,
76  bool read_chem_ref = false, bool read_configs = false,
77  bool clear_clex = false);
78 
79  // ** Directory path and settings accessors **
80 
82 
83  const ProjectSettings &settings() const;
84 
86  bool has_dir() const;
87 
89  const DirectoryStructure &dir() const;
90 
92  double crystallography_tol() const;
93 
94  // ** Composition accessors **
95 
97  bool has_composition_axes() const;
98 
100  const CompositionConverter &composition_axes() const;
101 
102  // ** Chemical reference **
103 
105  bool has_chemical_reference() const;
106 
108  const ChemicalReference &chemical_reference() const;
109 
110  // ** Accessors **
111 
113  const PrimType &prim() const;
114 
116  std::shared_ptr<PrimType const> const &shared_prim() const;
117 
119  Index n_basis() const;
120 
122  std::shared_ptr<PrimNeighborList> const &shared_nlist() const;
123 
125  PrimNeighborList &nlist() const;
126 
128  bool vacancy_allowed() const;
129 
131  Index vacancy_index() const;
132 
133  // ** Supercell, Configuration, etc. databases **
134 
135  template <typename T>
137 
138  template <typename T>
139  const DB::ValDatabase<T> &const_generic_db() const;
140 
141  template <typename T>
142  DB::Database<T> &db() const;
143 
144  template <typename T>
145  const DB::Database<T> &const_db() const;
146 
147  template <typename T>
148  DB::PropertiesDatabase &db_props(std::string calc_type) const;
149 
150  template <typename T>
151  const DB::PropertiesDatabase &const_db_props(std::string calc_type) const;
152 
154 
155  const DB::DatabaseHandler &const_db_handler() const;
156 
157  // ** Basis set specs, clexulators, eci ** ------------------
158 
159  bool has_basis_set_specs(std::string const &basis_set_name) const;
161  std::string const &basis_set_name) const;
162  Clexulator clexulator(std::string const &basis_set_name) const;
163 
164  bool has_eci(const ClexDescription &key) const;
165  ECIContainer const &eci(const ClexDescription &key) const;
166 
167  private:
170  struct PrimClexData;
171 
173  void _init();
174 
175  std::unique_ptr<PrimClexData> m_data;
176 };
177 
184 void write_basis_set_data(std::shared_ptr<Structure const> shared_prim,
185  ProjectSettings const &settings,
186  std::string const &basis_set_name,
187  ClexBasisSpecs const &basis_set_specs,
189 
198  std::string const &basis_set_name,
200 
201 } // namespace CASM
202 #endif
std::shared_ptr< Structure const > shared_prim
PrimNeighborList const & prim_neighbor_list
Evaluates correlations.
Definition: Clexulator.hh:440
Convert between number of species per unit cell and parametric composition.
Provides access to all databases.
Generic interface for database of a particular CASM type.
Definition: Database.hh:221
Specification of CASM project directory structure.
A sparse container of ECI values and their corresponding orbit indices.
Definition: ECIContainer.hh:12
PrimClex is the top-level data structure for a CASM project.
Definition: PrimClex.hh:55
The PrimNeighborList gives the coordinates of UnitCell that are neighbors of the origin UnitCell.
Definition: NeighborList.hh:39
Structure specifies the lattice and atomic basis of a crystal.
Definition: Structure.hh:30
const DB::PropertiesDatabase & const_db_props(std::string calc_type) const
Definition: PrimClex.cc:317
DB::Database< T > & db() const
Definition: PrimClex.cc:302
DB::DatabaseHandler & db_handler() const
Definition: PrimClex.cc:322
ProjectSettings & settings()
Definition: PrimClex.cc:224
Index vacancy_index() const
returns the index of vacancies in composition vectors
Definition: PrimClex.cc:289
bool has_chemical_reference() const
check if ChemicalReference object initialized
Definition: PrimClex.cc:250
Structure PrimType
Definition: PrimClex.hh:57
std::shared_ptr< PrimNeighborList > const & shared_nlist() const
Access to the primitive neighbor list as a shared resource.
Definition: PrimClex.cc:270
double crystallography_tol() const
Get the crystallography_tol.
Definition: PrimClex.cc:233
const DirectoryStructure & dir() const
Access DirectoryStructure object. Throw if not set.
Definition: PrimClex.cc:230
std::unique_ptr< PrimClexData > m_data
Definition: PrimClex.hh:175
Index n_basis() const
const Access to number of basis atoms
Definition: PrimClex.cc:268
void write_basis_set_data(std::shared_ptr< Structure const > shared_prim, ProjectSettings const &settings, std::string const &basis_set_name, ClexBasisSpecs const &basis_set_specs, PrimNeighborList &prim_neighbor_list)
Definition: PrimClex.cc:504
bool has_dir() const
Check if DirectoryStructure exists.
Definition: PrimClex.cc:228
PrimClex(ProjectSettings const &_project_settings, std::shared_ptr< PrimType const > _shared_prim)
Initial construction of a PrimClex, from ProjectSettings and shared prim.
Definition: PrimClex.cc:98
bool vacancy_allowed() const
returns true if vacancy are an allowed species
Definition: PrimClex.cc:286
PrimClex(const PrimClex &)=delete
bool has_eci(const ClexDescription &key) const
Definition: PrimClex.cc:397
Clexulator make_clexulator(ProjectSettings const &settings, std::string const &basis_set_name, PrimNeighborList &prim_neighbor_list)
Definition: PrimClex.cc:524
void refresh(bool read_settings=false, bool read_composition=false, bool read_chem_ref=false, bool read_configs=false, bool clear_clex=false)
Reload PrimClex data from settings.
Definition: PrimClex.cc:156
ClexBasisSpecs const & basis_set_specs(std::string const &basis_set_name) const
Definition: PrimClex.cc:344
ECIContainer const & eci(const ClexDescription &key) const
Definition: PrimClex.cc:406
const DB::DatabaseHandler & const_db_handler() const
Definition: PrimClex.cc:329
DB::ValDatabase< T > & generic_db() const
Definition: PrimClex.cc:292
Clexulator clexulator(std::string const &basis_set_name) const
Definition: PrimClex.cc:366
DB::PropertiesDatabase & db_props(std::string calc_type) const
Definition: PrimClex.cc:312
const CompositionConverter & composition_axes() const
const Access CompositionConverter object
Definition: PrimClex.cc:243
PrimNeighborList & nlist() const
Access to the primitive neighbor list.
Definition: PrimClex.cc:283
std::shared_ptr< PrimType const > const & shared_prim() const
Access to the primitive Structure as a shared resource.
Definition: PrimClex.cc:264
bool has_composition_axes() const
check if CompositionConverter object initialized
Definition: PrimClex.cc:238
~PrimClex()
Necessary for "pointer to implementation".
Definition: PrimClex.cc:116
void _init()
Initialization routines.
Definition: PrimClex.cc:121
const DB::ValDatabase< T > & const_generic_db() const
Definition: PrimClex.cc:297
const ChemicalReference & chemical_reference() const
const Access ChemicalReference object
Definition: PrimClex.cc:255
bool has_basis_set_specs(std::string const &basis_set_name) const
Definition: PrimClex.cc:336
const DB::Database< T > & const_db() const
Definition: PrimClex.cc:307
const PrimType & prim() const
const Access to primitive Structure
Definition: PrimClex.cc:262
Main CASM namespace.
Definition: APICommand.hh:8
INDEX_TYPE Index
For long integer indexing:
Definition: definitions.hh:39
Provides parameters for constructing a cluster expansion basis (ClexBasis)
Specifies a particular cluster expansion.