CASM  1.1.0
A Clusters Approach to Statistical Mechanics
OccupationDoFTraits.hh
Go to the documentation of this file.
1 #ifndef CASM_OccupationDoFTraits
2 #define CASM_OccupationDoFTraits
9 #include "casm/misc/Validator.hh"
10 
11 namespace CASM {
12 namespace DoF_impl {
13 
14 // --- OccupationDoFSpecs ---
15 
17 
24 struct SublatComp {
25  SublatComp(std::initializer_list<Index> _indices,
26  std::initializer_list<std::pair<std::string, double>> _values)
27  : indices(_indices), values(_values.begin(), _values.end()) {}
28 
29  SublatComp(std::set<Index> _indices, std::map<std::string, double> _values)
30  : indices(_indices), values(_values) {}
31 
32  std::set<Index> indices;
33  std::map<std::string, double> values;
34 };
35 
61 struct OccupationDoFSpecs : public DoFSpecs {
63  OccupationDoFSpecs(SITE_BASIS_FUNCTION_TYPE _site_basis_function_type)
64  : site_basis_function_type(_site_basis_function_type) {}
65 
67  OccupationDoFSpecs(std::vector<SublatComp> _sublat_composition)
69  sublat_composition(_sublat_composition) {}
70 
72  std::vector<SublatComp> sublat_composition;
73 
75 
76  private:
77  std::string _name() const override;
78 };
79 
80 std::vector<double> chebychev_sublat_prob_vec(Index occupant_dof_size);
81 
82 std::vector<double> occupation_sublat_prob_vec(Index occupant_dof_size);
83 
93 std::vector<double> composition_sublat_prob_vec(
94  const OccupationDoFSpecs &occ_specs, Index sublat_index,
95  const std::vector<std::string> &allowed_occupants);
96 
106 Validator validate(OccupationDoFSpecs const &occ_specs, const Structure &prim);
107 
109  public:
112  : DoFType::Traits(BasicTraits::occ(), /*_requires_site_basis = */ true) {}
113 
114  std::string site_basis_description(BasisSet site_bset, Site site,
115  Index site_ix) const override;
116 
117  std::vector<std::unique_ptr<FunctionVisitor>> site_function_visitors(
118  std::string const &nlist_specifier) const override;
119 
120  std::vector<std::unique_ptr<FunctionVisitor>> clust_function_visitors()
121  const override;
122 
123  std::vector<DoFType::ParamAllocation> param_pack_allocation(
124  Structure const &_prim,
125  std::vector<BasisSet> const &_bases) const override;
126 
127  std::string clexulator_constructor_string(
128  Structure const &_prim, std::vector<BasisSet> const &site_bases,
129  std::string const &indent) const override;
130 
132  Structure const &_prim,
133  std::map<UnitCellCoord, std::set<UnitCellCoord>> const &_nhood,
134  PrimNeighborList &_nlist, std::vector<BasisSet> const &site_bases,
135  std::string const &indent) const override;
136 
138  Structure const &_prim,
139  std::map<UnitCellCoord, std::set<UnitCellCoord>> const &_nhood,
140  PrimNeighborList &_nlist, std::vector<BasisSet> const &site_bases,
141  std::string const &indent) const override;
142 
144  Structure const &_prim, std::vector<BasisSet> const &site_bases,
145  std::string const &indent) const override;
146 
148  Structure const &_prim, std::vector<BasisSet> const &site_bases,
149  std::string const &indent) const override;
150 
152  Structure const &_prim, std::vector<BasisSet> const &site_bases,
153  std::string const &indent) const override {
154  // todo
155  return std::string();
156  }
157 
159  Structure const &_prim, std::vector<BasisSet> const &site_bases,
160  std::string const &indent) const override {
161  // todo
162  return std::string();
163  }
164 
166  Structure const &_prim, std::vector<BasisSet> const &site_bases,
167  std::string const &indent) const override {
168  // todo
169  return std::string();
170  }
171 
174  std::vector<BasisSet> construct_site_bases(
175  Structure const &_prim,
176  std::vector<Orbit<PrimPeriodicSymCompare<IntegralCluster>>> &_asym_unit,
177  BasisFunctionSpecs const &_basis_function_specs) const override;
178 
181  Structure const &prim) const override;
182 
184  void dof_specs_to_json(BasisFunctionSpecs const &basis_function_specs,
185  jsonParser &json,
186  Structure const &prim) const override;
187 
188  protected:
189  DoFType::Traits *_clone() const override;
190 };
191 } // namespace DoF_impl
192 
193 namespace DoFType {
194 
195 DoF_impl::OccupationDoFTraits occupation();
196 
205 std::unique_ptr<DoFSpecs> chebychev_basis_function_specs();
206 
215 std::unique_ptr<DoFSpecs> occupation_basis_function_specs();
216 
230 std::unique_ptr<DoFSpecs> composition_basis_function_specs(
231  std::vector<DoF_impl::SublatComp> sublat_composition);
232 
233 } // namespace DoFType
234 
235 // -- OccupationDoFSpecs IO --
236 
240 
259  const Structure &prim);
260 
261 void to_json(const DoF_impl::OccupationDoFSpecs &occupation_dof_specs,
262  jsonParser &json);
263 
264 } // namespace CASM
265 #endif
#define ENUM_TRAITS(ENUM)
Definition: io_traits.hh:213
#define ENUM_JSON_IO_DECL(ENUM)
Definition: json_io.hh:10
#define ENUM_IO_DECL(ENUM)
Definition: stream_io.hh:8
Specifies traits of (possibly) anisotropic crystal properties.
std::string clexulator_private_method_definitions_string(Structure const &_prim, std::vector< BasisSet > const &site_bases, std::string const &indent) const override
std::string clexulator_point_prepare_string(Structure const &_prim, std::map< UnitCellCoord, std::set< UnitCellCoord >> const &_nhood, PrimNeighborList &_nlist, std::vector< BasisSet > const &site_bases, std::string const &indent) const override
void parse_dof_specs(InputParser< BasisFunctionSpecs > &parser, Structure const &prim) const override
Parse DoF-specific basis function specs & validate.
std::string clexulator_public_method_declarations_string(Structure const &_prim, std::vector< BasisSet > const &site_bases, std::string const &indent) const override
void dof_specs_to_json(BasisFunctionSpecs const &basis_function_specs, jsonParser &json, Structure const &prim) const override
Output DoF-specific basis function specs to json.
DoFType::Traits * _clone() const override
std::string site_basis_description(BasisSet site_bset, Site site, Index site_ix) const override
std::string clexulator_member_declarations_string(Structure const &_prim, std::vector< BasisSet > const &site_bases, std::string const &indent) const override
std::vector< std::unique_ptr< FunctionVisitor > > site_function_visitors(std::string const &nlist_specifier) const override
std::vector< DoFType::ParamAllocation > param_pack_allocation(Structure const &_prim, std::vector< BasisSet > const &_bases) const override
std::string clexulator_private_method_declarations_string(Structure const &_prim, std::vector< BasisSet > const &site_bases, std::string const &indent) const override
std::string clexulator_constructor_string(Structure const &_prim, std::vector< BasisSet > const &site_bases, std::string const &indent) const override
std::string clexulator_global_prepare_string(Structure const &_prim, std::map< UnitCellCoord, std::set< UnitCellCoord >> const &_nhood, PrimNeighborList &_nlist, std::vector< BasisSet > const &site_bases, std::string const &indent) const override
std::vector< BasisSet > construct_site_bases(Structure const &_prim, std::vector< Orbit< PrimPeriodicSymCompare< IntegralCluster >>> &_asym_unit, BasisFunctionSpecs const &_basis_function_specs) const override
Construct the site basis (if DOF_MODE is LOCAL) for a DoF, given its site.
std::vector< std::unique_ptr< FunctionVisitor > > clust_function_visitors() const override
std::string clexulator_public_method_definitions_string(Structure const &_prim, std::vector< BasisSet > const &site_bases, std::string const &indent) const override
Collection of all the traits specific to a DoF type.
Definition: DoFTraits.hh:59
Traits(AnisoValTraits const &_val_traits, bool _requires_site_basis=false)
Definition: DoFTraits.hh:63
An Orbit of Element.
Definition: Orbit.hh:43
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
Unit Cell Coordinates.
#define CLONEABLE(T)
Validator validate(OccupationDoFSpecs const &occ_specs, const Structure &prim)
std::vector< double > chebychev_sublat_prob_vec(Index occupant_dof_size)
std::vector< double > composition_sublat_prob_vec(const OccupationDoFSpecs &occ_specs, Index sublat_index, const std::vector< std::string > &allowed_occupants)
std::vector< double > occupation_sublat_prob_vec(Index occupant_dof_size)
AnisoValTraits BasicTraits
Definition: DoF.hh:34
std::unique_ptr< DoFSpecs > occupation_basis_function_specs()
std::unique_ptr< DoFSpecs > chebychev_basis_function_specs()
DoF_impl::OccupationDoFTraits occupation()
std::unique_ptr< DoFSpecs > composition_basis_function_specs(std::vector< DoF_impl::SublatComp > sublat_composition)
Main CASM namespace.
Definition: APICommand.hh:8
jsonParser & to_json(const ClexDescription &desc, jsonParser &json)
INDEX_TYPE Index
For long integer indexing:
Definition: definitions.hh:39
void parse(InputParser< ConfigEnumOptions > &parser, std::string method_name, PrimClex const &primclex, DataFormatterDictionary< Configuration > const &dict)
Specify how to construct basis functions.
std::string _name() const override
SITE_BASIS_FUNCTION_TYPE site_basis_function_type
OccupationDoFSpecs(std::vector< SublatComp > _sublat_composition)
Specialized constructor for SITE_BASIS_FUNCTION_TYPE::COMPOSITION.
OccupationDoFSpecs(SITE_BASIS_FUNCTION_TYPE _site_basis_function_type)
Constructor for any SITE_BASIS_FUNCTION_TYPE.
std::vector< SublatComp > sublat_composition
std::map< std::string, double > values
SublatComp(std::initializer_list< Index > _indices, std::initializer_list< std::pair< std::string, double >> _values)
SublatComp(std::set< Index > _indices, std::map< std::string, double > _values)
Data structure to hold error and warning messages.
Definition: Validator.hh:10