CASM  1.1.0
A Clusters Approach to Statistical Mechanics
OrbitFunctionTraits.hh
Go to the documentation of this file.
1 #ifndef CASM_OrbitFunctionTraits
2 #define CASM_OrbitFunctionTraits
3 
4 #include <map>
5 #include <memory>
6 #include <set>
7 #include <string>
8 #include <vector>
9 
13 
14 namespace CASM {
15 namespace xtal {
16 class UnitCellCoord;
17 }
18 using xtal::UnitCellCoord;
19 
20 class BasisSet;
21 class ClexBasis;
22 class IntegralCluster;
23 class PrimNeighborList;
24 class Structure;
25 class SymGroup;
26 
28  public:
29  ClexBasisBuilder(std::string const &_name) : m_name(_name) {}
30 
31  virtual ~ClexBasisBuilder() {}
32 
33  std::string const &name() const { return m_name; }
34 
35  virtual void prepare(Structure const &_prim) {}
36 
37  virtual std::vector<DoFKey> filter_dof_types(
38  std::vector<DoFKey> const &_dof_types) {
39  return _dof_types;
40  }
41 
42  virtual void pre_generate() {}
43 
44  virtual BasisSet build_proto(IntegralCluster const &_prototype,
45  SymGroup const &_generating_group,
46  std::vector<BasisSet const *> const &_arg_bases,
47  Index max_poly_order,
48  Index min_poly_order) const = 0;
49 
50  std::unique_ptr<ClexBasisBuilder> clone() const {
51  return std::unique_ptr<ClexBasisBuilder>(_clone());
52  }
53 
54  private:
55  virtual ClexBasisBuilder *_clone() const = 0;
56  std::string m_name;
57 };
58 
59 //~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
60 
64  public:
65  static std::string class_desc() { return "Orbit Function Traits"; }
66 
67  OrbitFunctionTraits(std::string const &_name, std::string const &_short_desc,
68  std::string const &_long_desc)
69  : m_name(_name), m_short_desc(_short_desc), m_long_desc(_long_desc) {}
70 
71  virtual ~OrbitFunctionTraits() {}
72 
73  std::string const &name() const { return m_name; }
74 
75  std::string const &short_desc() const { return m_short_desc; }
76 
77  std::string const &long_desc() const { return m_long_desc; }
78 
79  virtual std::unique_ptr<ClexBasisBuilder> basis_builder() const = 0;
80 
81  virtual void print_param_pack_initilialization() const {}
82 
83  virtual std::string clexulator_point_prepare_string(
84  Structure const &_prim,
85  std::map<UnitCellCoord, std::set<UnitCellCoord> > const &_nhood,
86  PrimNeighborList &_nlist, std::string const &indent) const {
87  return "";
88  }
89 
90  virtual std::string clexulator_global_prepare_string(
91  Structure const &_prim,
92  std::map<UnitCellCoord, std::set<UnitCellCoord> > const &_nhood,
93  PrimNeighborList &_nlist, std::string const &indent) const {
94  return "";
95  }
96  virtual void print_typedefs(std::ostream &out, std::string const &class_name,
97  std::string const &indent) const {}
98 
99  virtual void print_eval_table_declarations(std::ostream &out,
100  std::string const &class_name,
101  ClexBasis const &clex,
102  std::string const &indent) const {}
103 
104  private:
105  std::string m_name;
106  // std::vector<std::string> m_signature;
107  // std::vector<std::string> m_arg_names;
108  std::string m_short_desc;
109  std::string m_long_desc;
110 };
111 
112 //~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
113 
115  public:
116  InvariantPolyBasisBuilder(std::string const &_name)
117  : ClexBasisBuilder(_name) {}
118 
119  BasisSet build_proto(IntegralCluster const &_prototype,
120  SymGroup const &_generating_group,
121  std::vector<BasisSet const *> const &_arg_bases,
122  Index max_poly_order,
123  Index min_poly_order) const override;
124 
125  private:
126  ClexBasisBuilder *_clone() const override {
127  return new InvariantPolyBasisBuilder(*this);
128  }
129 };
130 
131 //~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
132 
134  public:
136  : OrbitFunctionTraits("invariant_poly", "Invariant Polynomials",
137  "Orbit functions are constructed as invariant "
138  "polynomials of site basis functions.") {}
139 
140  std::unique_ptr<ClexBasisBuilder> basis_builder() const override {
141  return std::unique_ptr<ClexBasisBuilder>(
143  }
144 };
145 
146 } // namespace CASM
147 
148 #endif
std::unique_ptr< ClexBasisBuilder > clone() const
virtual void prepare(Structure const &_prim)
std::string const & name() const
ClexBasisBuilder(std::string const &_name)
virtual BasisSet build_proto(IntegralCluster const &_prototype, SymGroup const &_generating_group, std::vector< BasisSet const * > const &_arg_bases, Index max_poly_order, Index min_poly_order) const =0
virtual ClexBasisBuilder * _clone() const =0
virtual std::vector< DoFKey > filter_dof_types(std::vector< DoFKey > const &_dof_types)
ClexBasisBuilder * _clone() const override
InvariantPolyBasisBuilder(std::string const &_name)
BasisSet build_proto(IntegralCluster const &_prototype, SymGroup const &_generating_group, std::vector< BasisSet const * > const &_arg_bases, Index max_poly_order, Index min_poly_order) const override
std::unique_ptr< ClexBasisBuilder > basis_builder() const override
virtual base class for printing orbit functions of type specified by implementation.
virtual std::string clexulator_global_prepare_string(Structure const &_prim, std::map< UnitCellCoord, std::set< UnitCellCoord > > const &_nhood, PrimNeighborList &_nlist, std::string const &indent) const
std::string const & short_desc() const
virtual std::unique_ptr< ClexBasisBuilder > basis_builder() const =0
std::string const & long_desc() const
virtual void print_eval_table_declarations(std::ostream &out, std::string const &class_name, ClexBasis const &clex, std::string const &indent) const
std::string const & name() const
virtual std::string clexulator_point_prepare_string(Structure const &_prim, std::map< UnitCellCoord, std::set< UnitCellCoord > > const &_nhood, PrimNeighborList &_nlist, std::string const &indent) const
virtual void print_typedefs(std::ostream &out, std::string const &class_name, std::string const &indent) const
OrbitFunctionTraits(std::string const &_name, std::string const &_short_desc, std::string const &_long_desc)
virtual void print_param_pack_initilialization() const
static std::string class_desc()
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
SymGroup is a collection of symmetry operations that satisfy the group property The symmetry operatio...
Definition: SymGroup.hh:42
Unit Cell Coordinates.
Main CASM namespace.
Definition: APICommand.hh:8
INDEX_TYPE Index
For long integer indexing:
Definition: definitions.hh:39