CASM  1.1.0
A Clusters Approach to Statistical Mechanics
ClusterSymCompare.hh
Go to the documentation of this file.
1 #ifndef CASM_ClusterSymCompare
2 #define CASM_ClusterSymCompare
3 
4 #include <memory>
5 
9 #include "casm/global/eigen.hh"
11 #include "casm/symmetry/SymOp.hh"
13 
14 namespace CASM {
15 
16 class PermuteIterator;
17 class Structure;
18 
75 template <typename Base>
76 class ClusterSymCompare : public Base {
77  public:
78  typedef typename Base::MostDerived MostDerived;
79  using typename Base::Element;
81  typedef Element ClusterType;
82  using Base::derived;
83  using typename Base::InvariantsType;
84 
85  using Base::copy_apply;
86 
88  ClusterType copy_apply(PermuteIterator const &permute_it,
89  ClusterType obj) const;
90 
91  protected:
93  InvariantsType make_invariants_impl(const ClusterType &obj) const;
94 
96  bool invariants_compare_impl(const InvariantsType &A,
97  const InvariantsType &B) const;
98 
100  bool compare_impl(const ClusterType &A, const ClusterType &B) const;
101 
103  ClusterType copy_apply_impl(SymOp const &op, ClusterType obj) const;
104 
107  // For now, this is the the sorting permutation
108  std::unique_ptr<SymOpRepresentation> canonical_transform_impl(
109  ClusterType const &obj) const;
110 };
111 
112 /* -- AperiodicSymCompare<IntegralCluster> Declaration
113  * ------------------------------------- */
114 
127 template <typename Element>
129  : public ClusterSymCompare<
130  SymCompare<CRTPBase<AperiodicSymCompare<Element>>>> {
131  public:
133  typedef std::shared_ptr<PrimType const> PrimType_ptr;
134 
140  AperiodicSymCompare(PrimType_ptr prim_ptr, double tol);
141 
142  const PrimType &prim() const { return *m_prim; }
143 
145  double tol() const { return this->m_tol; }
146 
147  private:
151  friend Base;
153 
159  Element spatial_prepare_impl(Element obj) const;
160 
164  SymOp const &spatial_transform_impl() const;
165 
171 
173 
174  double m_tol;
175 
180 };
181 
200 template <typename Element>
202  : public ClusterSymCompare<
203  SymCompare<CRTPBase<PrimPeriodicSymCompare<Element>>>> {
204  public:
206  typedef std::shared_ptr<PrimType const> PrimType_ptr;
207 
213  PrimPeriodicSymCompare(PrimType_ptr prim_ptr, double tol);
214 
215  const PrimType &prim() const { return *m_prim; }
216 
218  double tol() const { return this->m_tol; }
219 
220  private:
221  typedef ClusterSymCompare<
225  friend Base;
227 
233  Element spatial_prepare_impl(Element obj) const;
234 
237  SymOp const &spatial_transform_impl() const;
238 
244 
248 
249  double m_tol;
250 
255 };
256 
278 template <typename Element>
280  : public ClusterSymCompare<
281  SymCompare<CRTPBase<ScelPeriodicSymCompare<Element>>>> {
282  public:
284  typedef std::shared_ptr<PrimType const> PrimType_ptr;
286 
294  double tol);
295 
296  const PrimType &prim() const { return *m_prim; }
297 
299  transf_mat_type const &transf_mat() const { return m_transf_mat; }
300 
302  double tol() const { return this->m_tol; }
303 
304  private:
305  typedef ClusterSymCompare<
309  friend Base;
311 
317  Element spatial_prepare_impl(Element obj) const;
318 
321  SymOp const &spatial_transform_impl() const;
322 
328 
332 
335 
338 
339  double m_tol;
340 
345 };
346 
347 } // namespace CASM
348 
349 #endif
ClusterSymCompare< SymCompare< CRTPBase< AperiodicSymCompare< Element > > > > Base
std::shared_ptr< PrimType const > PrimType_ptr
SymOp m_spatial_transform
Spatial transform that reproduces most recent application of SymCompare::spatial_prepare()
double tol() const
Return tolerance.
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.
Base::MostDerived MostDerived
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
SymOp m_spatial_transform
Spatial transform that reproduces most recent application of SymCompare::spatial_prepare()
ClusterSymCompare< SymCompare< CRTPBase< PrimPeriodicSymCompare< Element > > > > Base
double tol() const
Return tolerance.
Template class to be specialized for comparisons with periodic symmetry of the primitive lattice.
std::shared_ptr< PrimType const > PrimType_ptr
xtal::IntegralCoordinateWithin_f m_bring_within_f
Bring UnitCellCoord within the supercell.
double tol() const
Return tolerance.
transf_mat_type const & transf_mat() const
Prim to supercell transformation matrix.
ClusterSymCompare< SymCompare< CRTPBase< ScelPeriodicSymCompare< Element > > > > Base
transf_mat_type m_transf_mat
Prim to supercell transformation matrix.
SymOp m_spatial_transform
Spatial transform that reproduces most recent application of SymCompare::spatial_prepare()
Template class to be specialized for comparisons with periodic symmetry of the supercell lattice.
Structure specifies the lattice and atomic basis of a crystal.
Definition: Structure.hh:30
CRTP base class for implementing element and orbit comparison.
Definition: SymCompare.hh:52
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
Eigen::Matrix3l transf_mat(const Lattice &prim_lat, const Lattice &super_lat)
Main CASM namespace.
Definition: APICommand.hh:8
MappingNode copy_apply(PermuteIterator const &_it, MappingNode const &_node, bool transform_cost_mat=true)
Reorders the permutation and compounds the spatial isometry (rotation.
Matrix< long int, 3, 3 > Matrix3l
Definition: eigen.hh:12
Derived::PlainObject representation_prepare_impl(Eigen::MatrixBase< Derived > const &obj, double _tol)
Prepare an element for comparison.