CASM  1.1.0
A Clusters Approach to Statistical Mechanics
ScelOrbitGeneration_impl.hh
Go to the documentation of this file.
1 #ifndef CASM_ScelOrbitGeneration_impl
2 #define CASM_ScelOrbitGeneration_impl
3 
4 #include "casm/clex/PrimClex.hh"
6 #include "casm/clex/Supercell.hh"
8 
9 namespace CASM {
10 
11 template <typename _ElementType>
13  const Supercell &_scel)
14  : m_scel(&_scel),
15  m_sym_compare(_scel.primclex().shared_prim(), _scel.transf_mat(),
16  _scel.crystallography_tol()) {}
17 
18 template <typename _ElementType>
20  return *m_scel;
21 }
22 
23 template <typename _ElementType>
26  return m_sym_compare;
27 }
28 
33 template <typename _ElementType>
36  Element result = m_sym_compare.prepare(e);
37  auto it = supercell().sym_info().permute_begin();
38  auto end = supercell().sym_info().permute_end();
39  m_to_canonical = it;
40  while (it != end) {
41  auto test = m_sym_compare.prepare(m_sym_compare.copy_apply(it.sym_op(), e));
42  if (m_sym_compare.compare(result, test)) {
43  result = test;
44  m_to_canonical = it;
45  }
46  ++it;
47  }
48  return result;
49 }
50 
55 template <typename _ElementType>
56 template <typename PermuteIteratorIt>
59  PermuteIteratorIt begin,
60  PermuteIteratorIt end) const {
61  Element result = m_sym_compare.prepare(e);
62  auto it = begin;
63  m_to_canonical = *it;
64  while (it != end) {
65  auto test = m_sym_compare.prepare(m_sym_compare.copy_apply(it.sym_op(), e));
66  if (m_sym_compare.compare(result, test)) {
67  result = test;
68  m_to_canonical = *it;
69  }
70  ++it;
71  }
72  return result;
73 }
74 
76 template <typename _ElementType>
78  return m_to_canonical;
79 }
80 
82 template <typename _ElementType>
84  return to_canonical().inverse();
85 }
86 
87 template <typename _ElementType>
89  : m_scel(&_scel),
90  m_sym_compare(_scel.primclex().shared_prim(), _scel.transf_mat(),
91  _scel.crystallography_tol()) {}
92 
93 template <typename _ElementType>
95  return *m_scel;
96 }
97 
98 template <typename _ElementType>
101  return m_sym_compare;
102 }
103 
105 template <typename _ElementType>
107  return (*this)(e, supercell().sym_info().permute_begin(),
108  supercell().sym_info().permute_end());
109 }
110 
112 template <typename _ElementType>
113 template <typename PermuteIteratorIt>
115  PermuteIteratorIt begin,
116  PermuteIteratorIt end) const {
117  auto less_than = [&](const PermuteIterator &it) {
118  auto test = m_sym_compare.prepare(m_sym_compare.copy_apply(it.sym_op(), e));
119  return m_sym_compare.compare(e, test);
120  };
121 
122  return std::none_of(begin, end, less_than);
123 }
124 
125 } // namespace CASM
126 
127 #endif
std::shared_ptr< Structure const > shared_prim
PermuteIterator inverse() const
PermuteIterator from_canonical() const
After using call operator, this can be checked.
const Supercell & supercell() const
Element operator()(const Element &e) const
Applies symmetry to return an equivalent Element in a canonical form.
const SymCompareType & sym_compare() const
PermuteIterator to_canonical() const
After using call operator, this can be checked.
ScelCanonicalGenerator(const Supercell &_scel)
Comparisons of clusters using supercell periodic symmetry, but without periodic images.
Represents a supercell of the primitive parent crystal structure.
Definition: Supercell.hh:51
Eigen::Matrix3l transf_mat(const Lattice &prim_lat, const Lattice &super_lat)
Main CASM namespace.
Definition: APICommand.hh:8
PrimClex * primclex
Definition: settings.cc:135
const Supercell & supercell() const
const SymCompareType & sym_compare() const
ScelIsCanonical(const Supercell &_scel)
bool operator()(const Element &e) const
Applies symmetry to check if any Element is greater than e.