CASM  1.1.0
A Clusters Approach to Statistical Mechanics
HasCanonicalForm.hh
Go to the documentation of this file.
1 #ifndef CASM_HasCanonicalForm
2 #define CASM_HasCanonicalForm
3 
4 #include <vector>
5 
6 namespace CASM {
7 namespace xtal {
8 class Lattice;
9 }
10 
11 class SymGroup;
12 class SymOp;
13 class PermuteIterator;
14 class Supercell;
15 
18 template <typename Base>
19 class CanonicalForm : public Base {
20  public:
21  typedef typename Base::MostDerived MostDerived;
22  using Base::derived;
23 
25  template <typename SymCompareType>
26  bool is_canonical(const std::vector<SymOp> &g,
27  const SymCompareType &sym_compare) const;
28 
30  template <typename SymCompareType>
31  MostDerived canonical_form(const std::vector<SymOp> &g,
32  const SymCompareType &sym_compare) const;
33 
35  template <typename SymCompareType>
36  bool is_sym_equivalent(const MostDerived &other, const std::vector<SymOp> &g,
37  const SymCompareType &sym_compare) const;
38 
40  template <typename ObjIterator, typename SymCompareType>
41  ObjIterator find_sym_equivalent(ObjIterator begin, ObjIterator end,
42  const std::vector<SymOp> &g,
43  const SymCompareType &sym_compare) const;
44 
46  template <typename SymCompareType>
47  SymOp to_canonical(const std::vector<SymOp> &g,
48  const SymCompareType &sym_compare) const;
49 
51  template <typename SymCompareType>
52  SymOp from_canonical(const std::vector<SymOp> &g,
53  const SymCompareType &sym_compare) const;
54 
56  template <typename SymCompareType>
57  SymGroup invariant_subgroup(const SymGroup &super_grp,
58  const SymCompareType &sym_compare) const;
59 
61  bool is_canonical(const Supercell &scel) const;
62 
64  MostDerived canonical_form(const Supercell &scel) const;
65 
67  bool is_sym_equivalent(const MostDerived &B, const Supercell &scel) const;
68 
70  SymOp to_canonical(const Supercell &scel) const;
71 
73  SymOp from_canonical(const Supercell &scel) const;
74 
76  std::vector<PermuteIterator> invariant_subgroup(const Supercell &scel) const;
77 
80  template <typename PermuteIteratorIt>
81  bool is_canonical(const Supercell &scel, PermuteIteratorIt begin,
82  PermuteIteratorIt end) const;
83 
86  template <typename PermuteIteratorIt>
87  MostDerived canonical_form(const Supercell &scel, PermuteIteratorIt begin,
88  PermuteIteratorIt end) const;
89 
92  template <typename PermuteIteratorIt>
93  bool is_sym_equivalent(const MostDerived &B, const Supercell &scel,
94  PermuteIteratorIt begin, PermuteIteratorIt end) const;
95 
97  template <typename ObjIterator, typename PermuteIteratorIt>
98  ObjIterator find_sym_equivalent(ObjIterator obj_begin, ObjIterator obj_end,
99  const Supercell &scel,
100  PermuteIteratorIt begin,
101  PermuteIteratorIt end) const;
102 
105  template <typename PermuteIteratorIt>
106  SymOp to_canonical(const Supercell &scel, PermuteIteratorIt begin,
107  PermuteIteratorIt end) const;
108 
111  template <typename PermuteIteratorIt>
112  SymOp from_canonical(const Supercell &scel, PermuteIteratorIt begin,
113  PermuteIteratorIt end) const;
114 
117  template <typename PermuteIteratorIt>
118  std::vector<PermuteIterator> invariant_subgroup(const Supercell &scel,
119  PermuteIteratorIt begin,
120  PermuteIteratorIt end) const;
121 };
122 
135 template <typename Base>
136 class ConfigCanonicalForm : public Base {
137  public:
138  typedef typename Base::MostDerived MostDerived;
139  using Base::derived;
140 
142  bool is_sym_equivalent(const MostDerived &B) const;
143 
145  template <typename ConfigIterator>
147  ConfigIterator obj_begin,
148  ConfigIterator obj_end) const;
149 
150  bool is_canonical() const;
151 
152  MostDerived canonical_form() const;
153 
155 
157 
158  std::vector<PermuteIterator> invariant_subgroup() const;
159 
161  template <typename PermuteIteratorIt>
162  bool is_sym_equivalent(const MostDerived &B, PermuteIteratorIt begin,
163  PermuteIteratorIt end) const;
164 
166  template <typename ConfigIterator, typename PermuteIteratorIt>
168  ConfigIterator obj_end,
169  PermuteIteratorIt begin,
170  PermuteIteratorIt end) const;
171 
172  template <typename PermuteIteratorIt>
173  bool is_canonical(PermuteIteratorIt begin, PermuteIteratorIt end) const;
174 
175  template <typename PermuteIteratorIt>
176  MostDerived canonical_form(PermuteIteratorIt begin,
177  PermuteIteratorIt end) const;
178 
179  template <typename PermuteIteratorIt>
180  PermuteIterator to_canonical(PermuteIteratorIt begin,
181  PermuteIteratorIt end) const;
182 
183  template <typename PermuteIteratorIt>
184  PermuteIterator from_canonical(PermuteIteratorIt begin,
185  PermuteIteratorIt end) const;
186 
187  template <typename PermuteIteratorIt>
188  std::vector<PermuteIterator> invariant_subgroup(PermuteIteratorIt begin,
189  PermuteIteratorIt end) const;
190 
191  // --- Required in MostDerived:
192 
193  // Functor less() const;
194  // const Supercell& supercell() const;
195 };
196 
199 template <typename Base>
200 class SupercellCanonicalForm : public Base {
201  public:
202  using Base::derived;
203 
205 
207  bool is_canonical() const;
208 
212  SymOp to_canonical() const;
213 
215  SymOp from_canonical() const;
216 
219 
223  const Supercell &canonical_form() const;
224 
227  template <typename PermuteIteratorIt>
228  std::vector<PermuteIterator> invariant_subgroup(const Supercell &scel_B,
229  PermuteIteratorIt begin,
230  PermuteIteratorIt end);
231 
232  private:
234  mutable const Supercell *m_canonical;
235 };
236 
237 } // namespace CASM
238 
239 #endif
Implements canonical form finding when using SymCompare.
MostDerived canonical_form(const std::vector< SymOp > &g, const SymCompareType &sym_compare) const
Return canonical form.
bool is_canonical(const std::vector< SymOp > &g, const SymCompareType &sym_compare) const
Check if canonical.
SymOp to_canonical(const std::vector< SymOp > &g, const SymCompareType &sym_compare) const
Return op that transforms this into canonical form.
SymOp from_canonical(const std::vector< SymOp > &g, const SymCompareType &sym_compare) const
Return op that transforms the canonical form into this.
bool is_sym_equivalent(const MostDerived &other, const std::vector< SymOp > &g, const SymCompareType &sym_compare) const
Check if two elements have the same canonical form.
ObjIterator find_sym_equivalent(ObjIterator begin, ObjIterator end, const std::vector< SymOp > &g, const SymCompareType &sym_compare) const
Find element that has the same canonical form.
SymGroup invariant_subgroup(const SymGroup &super_grp, const SymCompareType &sym_compare) const
Return subgroup of super_grp that leaves this invariant.
Base::MostDerived MostDerived
Implements canonical form finding for Configuration and DiffTransConfiguration.
PermuteIterator to_canonical() const
PermuteIterator from_canonical() const
Base::MostDerived MostDerived
std::vector< PermuteIterator > invariant_subgroup() const
bool is_sym_equivalent(const MostDerived &B) const
True if this and B have same canonical form.
ConfigIterator find_sym_equivalent(const MostDerived &B, ConfigIterator obj_begin, ConfigIterator obj_end) const
Find Config that has same canonical form.
MostDerived canonical_form() const
const Supercell & canonical_form() const
Return canonical equivalent Supercell.
const Supercell * m_canonical
Store a pointer to the canonical equivalent Supercell.
SymOp from_canonical() const
The inverse of to_canonical()
std::vector< PermuteIterator > invariant_subgroup(const Supercell &scel_B, PermuteIteratorIt begin, PermuteIteratorIt end)
Construct the subgroup of permutations that leaves a Supercell unchanged.
xtal::Lattice canonical_lattice() const
Return canonical equivalent lattice.
bool is_canonical() const
True if lattice().is_canonical(g), where g is the prim().point_group()
Represents a supercell of the primitive parent crystal structure.
Definition: Supercell.hh:51
SymGroup is a collection of symmetry operations that satisfy the group property The symmetry operatio...
Definition: SymGroup.hh:42
SymOp is the Coordinate representation of a symmetry operation it keeps fraction (FRAC) and Cartesian...
Definition: SymOp.hh:28
Main CASM namespace.
Definition: APICommand.hh:8