CASM  1.1.0
A Clusters Approach to Statistical Mechanics
ClusterSymCompare_impl.hh
Go to the documentation of this file.
1 #ifndef CASM_ClusterSymCompare_impl
2 #define CASM_ClusterSymCompare_impl
3 
8 
9 namespace CASM {
10 
12 template <typename Base>
15  ClusterType obj) const {
16  return this->copy_apply(permute_it.sym_op(), obj);
17 }
18 
20 template <typename Base>
23  return traits<MostDerived>::make_invariants(obj, this->derived());
24 }
25 
34 template <typename Base>
36  const InvariantsType &A, const InvariantsType &B) const {
37  return CASM::compare(A, B, this->derived().tol());
38 }
39 
45 template <typename Base>
47  const ClusterType &B) const {
48  return A < B;
49 }
50 
52 template <typename Base>
55  ClusterType obj) const {
56  return traits<MostDerived>::copy_apply(op, obj, this->derived());
57 }
58 
64 template <typename Base>
65 std::unique_ptr<SymOpRepresentation>
67  return std::unique_ptr<SymOpRepresentation>(
68  new SymPermutation(obj.sort_permutation()));
69 }
70 
71 // -- AperiodicSymCompare<IntegralCluster> -------------------------------------
72 
77 template <typename Element>
79  double tol)
80  : m_prim(prim_ptr), m_tol(tol) {}
81 
85 template <typename Element>
87  return obj;
88 }
89 
93 template <typename Element>
95  return m_spatial_transform;
96 }
97 
101 template <typename Element>
103  Element obj) const {
104  return obj.sort();
105 }
106 
107 // -- PrimPeriodicSymCompare<IntegralCluster>
108 // -------------------------------------
109 
114 template <typename Element>
116  double tol)
117  : m_prim(prim_ptr), m_tol(tol) {}
118 
122 template <typename Element>
124  Element obj) const {
125  if (!obj.size()) {
126  return obj;
127  }
128  const auto pos =
129  traits<PrimPeriodicSymCompare<Element>>::position(obj, this->derived());
130  this->m_spatial_transform =
131  SymOp::translation(-prim().lattice().lat_column_mat() *
132  pos.unitcell().template cast<double>());
133  return obj - pos.unitcell();
134 }
135 
138 template <typename Element>
140  return m_spatial_transform;
141 }
142 
146 template <typename Element>
148  Element obj) const {
149  if (!obj.size()) {
150  return obj;
151  }
152  obj.sort();
153 
154  return obj;
155 }
156 
157 // -- ScelPeriodicSymCompare<IntegralCluster>
158 // -------------------------------------
159 
164 template <typename Element>
166  PrimType_ptr prim_ptr, transf_mat_type transf_mat, double tol)
167  : m_prim(prim_ptr),
168  m_transf_mat(transf_mat),
169  m_bring_within_f(transf_mat),
170  m_tol(tol) {}
171 
175 template <typename Element>
177  Element obj) const {
178  if (!obj.size()) {
179  return obj;
180  }
181  const auto pos =
182  traits<ScelPeriodicSymCompare<Element>>::position(obj, *this);
183  this->m_spatial_transform =
184  SymOp::translation(this->m_prim->lattice().lat_column_mat() *
185  (m_bring_within_f(pos).unitcell() - pos.unitcell())
186  .template cast<double>());
187  return obj + (m_bring_within_f(pos).unitcell() - pos.unitcell());
188 }
189 
192 template <typename Element>
194  return m_spatial_transform;
195 }
196 
200 template <typename Element>
202  Element obj) const {
203  if (!obj.size()) {
204  return obj;
205  }
206  obj.sort();
207 
208  return obj;
209 }
210 
211 } // namespace CASM
212 
213 #endif
std::shared_ptr< PrimType const > PrimType_ptr
Template class to be specialized for comparisons with aperiodic symmetry.
CRTP Base class for common cluster symmetry and comparison implementations.
ClusterType copy_apply(PermuteIterator const &permute_it, ClusterType obj) const
Get SymOp from PermuteIterator and apply to cluster.
std::unique_ptr< SymOpRepresentation > canonical_transform_impl(ClusterType const &obj) const
Returns transformation that takes 'obj' to its prepared (canonical) form.
bool invariants_compare_impl(const InvariantsType &A, const InvariantsType &B) const
Orders 'prepared' elements in the same orbit.
bool compare_impl(const ClusterType &A, const ClusterType &B) const
Compares 'prepared' clusters.
ClusterType copy_apply_impl(SymOp const &op, ClusterType obj) const
Applies SymOp to cluster.
InvariantsType make_invariants_impl(const ClusterType &obj) const
Make orbit invariants from one element in the orbit.
std::shared_ptr< PrimType const > PrimType_ptr
Template class to be specialized for comparisons with periodic symmetry of the primitive lattice.
std::shared_ptr< PrimType const > PrimType_ptr
Template class to be specialized for comparisons with periodic symmetry of the supercell lattice.
typename traits< MostDerived >::Element Element
Definition: SymCompare.hh:57
SymOp is the Coordinate representation of a symmetry operation it keeps fraction (FRAC) and Cartesian...
Definition: SymOp.hh:28
static SymOp translation(const Eigen::Ref< const vector_type > &_tau)
static method to create operation that describes pure translation
Definition: SymOp.hh:34
SymPermutation describes how a symmetry operation permutes a list of 'things' For example,...
Eigen::Matrix3l transf_mat(const Lattice &prim_lat, const Lattice &super_lat)
GenericVectorXdScelFormatter lattice()
Definition: SupercellIO.cc:266
Main CASM namespace.
Definition: APICommand.hh:8
bool compare(ClusterInvariants const &A, ClusterInvariants const &B, double tol)
Compare ClusterInvariants.
MappingNode copy_apply(PermuteIterator const &_it, MappingNode const &_node, bool transform_cost_mat=true)
Reorders the permutation and compounds the spatial isometry (rotation.
Derived::PlainObject representation_prepare_impl(Eigen::MatrixBase< Derived > const &obj, double _tol)
Prepare an element for comparison.