1 #ifndef CASM_HasCanonicalForm_impl
2 #define CASM_HasCanonicalForm_impl
19 template <
typename _Base>
20 template <
typename SymCompareType>
22 const std::vector<SymOp> &g,
const SymCompareType &sym_compare)
const {
27 template <
typename _Base>
28 template <
typename SymCompareType>
30 const std::vector<SymOp> &g,
const SymCompareType &sym_compare)
const {
35 template <
typename _Base>
36 template <
typename SymCompareType>
38 const MostDerived &other,
const std::vector<SymOp> &g,
39 const SymCompareType &sym_compare)
const {
41 return sym_compare.equal(f(derived()), f(other));
44 template <
typename _Base>
45 template <
typename ObjIterator,
typename SymCompareType>
47 ObjIterator begin, ObjIterator end,
const std::vector<SymOp> &g,
48 const SymCompareType &sym_compare)
const {
50 auto canon = f(derived());
52 return sym_compare.equal(canon, f(test));
54 return std::find_if(begin, end, is_sym_equiv);
57 template <
typename _Base>
58 template <
typename SymCompareType>
60 const std::vector<SymOp> &g,
const SymCompareType &sym_compare)
const {
66 template <
typename _Base>
67 template <
typename SymCompareType>
69 const std::vector<SymOp> &g,
const SymCompareType &sym_compare)
const {
70 return to_canonical(g, sym_compare).
inverse();
73 template <
typename _Base>
74 template <
typename SymCompareType>
76 const SymGroup &super_grp,
const SymCompareType &sym_compare)
const {
80 template <
typename _Base>
86 template <
typename _Base>
94 template <
typename _Base>
101 template <
typename _Base>
107 template <
typename _Base>
113 template <
typename _Base>
120 template <
typename _Base>
121 template <
typename PermuteIteratorIt>
123 PermuteIteratorIt begin,
124 PermuteIteratorIt end)
const {
126 return f(derived(), begin, end);
129 template <
typename _Base>
130 template <
typename PermuteIteratorIt>
132 const Supercell &scel, PermuteIteratorIt begin,
133 PermuteIteratorIt end)
const {
139 template <
typename _Base>
140 template <
typename PermuteIteratorIt>
143 PermuteIteratorIt begin,
144 PermuteIteratorIt end)
const {
150 template <
typename _Base>
151 template <
typename ObjIterator,
typename PermuteIteratorIt>
153 ObjIterator obj_begin, ObjIterator obj_end,
const Supercell &scel,
154 PermuteIteratorIt begin, PermuteIteratorIt end)
const {
156 auto canon = f(derived(), begin, end);
160 return std::find_if(obj_begin, obj_end, is_sym_equiv);
163 template <
typename _Base>
164 template <
typename PermuteIteratorIt>
166 PermuteIteratorIt begin,
167 PermuteIteratorIt end)
const {
173 template <
typename _Base>
174 template <
typename PermuteIteratorIt>
176 PermuteIteratorIt begin,
177 PermuteIteratorIt end)
const {
179 return to_canonical(scel, begin, end).
inverse();
182 template <
typename _Base>
183 template <
typename PermuteIteratorIt>
185 const Supercell &scel, PermuteIteratorIt begin,
186 PermuteIteratorIt end)
const {
192 template <
typename Base>
194 return this->canonical_form() == B.canonical_form();
197 template <
typename Base>
198 template <
typename ConfigIterator>
202 auto canon = this->canonical_form();
204 return canon == test.canonical_form();
206 return std::find_if(obj_begin, obj_end, is_sym_equiv);
209 template <
typename Base>
211 return is_canonical(derived().supercell().sym_info().permute_begin(),
212 derived().supercell().sym_info().permute_end());
215 template <
typename Base>
218 return canonical_form(derived().supercell().sym_info().permute_begin(),
219 derived().supercell().sym_info().permute_end());
222 template <
typename Base>
224 return to_canonical(derived().supercell().sym_info().permute_begin(),
225 derived().supercell().sym_info().permute_end());
228 template <
typename Base>
230 return from_canonical(derived().supercell().sym_info().permute_begin(),
231 derived().supercell().sym_info().permute_end());
234 template <
typename Base>
238 derived().supercell().sym_info().permute_end());
241 template <
typename Base>
242 template <
typename PermuteIteratorIt>
244 PermuteIteratorIt end)
const {
245 return std::none_of(begin, end, derived().
less());
249 template <
typename Base>
250 template <
typename PermuteIteratorIt>
252 PermuteIteratorIt begin,
253 PermuteIteratorIt end)
const {
254 return this->canonical_form(begin, end) == B.canonical_form(begin, end);
257 template <
typename Base>
258 template <
typename ConfigIterator,
typename PermuteIteratorIt>
261 PermuteIteratorIt end)
const {
262 auto canon = this->canonical_form(begin, end);
264 return canon == test.canonical_form(begin, end);
266 return std::find_if(obj_begin, obj_end, is_sym_equiv);
269 template <
typename Base>
270 template <
typename PermuteIteratorIt>
273 PermuteIteratorIt end)
const {
274 return copy_apply(to_canonical(begin, end), derived());
277 template <
typename Base>
278 template <
typename PermuteIteratorIt>
280 PermuteIteratorIt begin, PermuteIteratorIt end)
const {
281 return *std::max_element(begin, end, derived().
less());
284 template <
typename Base>
285 template <
typename PermuteIteratorIt>
287 PermuteIteratorIt begin, PermuteIteratorIt end)
const {
293 auto less = derived().less();
294 auto _to_canonical = begin;
295 auto _from_canonical = _to_canonical.inverse();
296 for (
auto it = begin; it < end; ++it) {
297 if (
less(_to_canonical, it)) {
299 _from_canonical = _to_canonical.inverse();
303 else if (!
less(it, _to_canonical)) {
304 auto it_inv = it.inverse();
305 if (it_inv < _from_canonical) {
306 _from_canonical = it_inv;
310 return _from_canonical;
313 template <
typename Base>
314 template <
typename PermuteIteratorIt>
316 PermuteIteratorIt begin, PermuteIteratorIt end)
const {
318 std::vector<PermuteIterator> sub_grp;
320 std::copy_if(begin, end, std::back_inserter(sub_grp), derived().equal_to());
327 template <
typename Base>
330 derived().prim().point_group());
333 template <
typename Base>
336 derived().
lattice(), derived().prim().point_group());
337 return derived().prim().point_group()[to_canonical_ix];
340 template <
typename Base>
342 return to_canonical().
inverse();
345 template <
typename Base>
348 derived().prim().point_group(),
349 derived().crystallography_tol());
352 template <
typename Base>
355 m_canonical = &*derived().
insert().first;
367 template <
typename Base>
368 template <
typename PermuteIteratorIt>
370 const Supercell &scel_B, PermuteIteratorIt begin, PermuteIteratorIt end) {
Functor to find the canonical generating element for an orbit in a Supercell.
const SymCompareType & sym_compare() const
PermuteIterator to_canonical() const
After using call operator, this can be checked.
Represents a supercell of the primitive parent crystal structure.
std::pair< DB::DatabaseIterator< Supercell >, bool > insert() const
Insert the canonical form of this into the database.
const SupercellSymInfo & sym_info() const
permute_const_iterator permute_end() const
permute_const_iterator permute_begin() const
bool equal(const Element &A, const Element &B) const
Check equivalence of 'prepared' elements.
SymGroup is a collection of symmetry operations that satisfy the group property The symmetry operatio...
SymOp is the Coordinate representation of a symmetry operation it keeps fraction (FRAC) and Cartesian...
SymOp inverse() const
get the inverse of this SymOp
bool is_canonical(const Configuration &_config)
returns true if no symmetry transformation applied to _config will increase its lexicographic order
std::vector< PermuteIterator > make_invariant_subgroup(ConfigEnumInput const &config_enum_input)
GenericVectorXdScelFormatter lattice()
SymGroup invariant_subgroup(const SymGroup &super_group, const xtal::Lattice &lat)
Returns the subgroup of the given group that keeps the lattice invariant.
Lattice equivalent(Lattice const &in_lat, SymOpVector const &point_grp, double compare_tol)
Index operation_index(const Lattice &lat, SymOpVector const &g)
bool check(const Lattice &lat)
bool less(LatticeNode const &A, LatticeNode const &B, double cost_tol)
Compare two LatticeMap objects, based on their mapping cost first, followed by PrimGrid transformatio...
MappingNode copy_apply(PermuteIterator const &_it, MappingNode const &_node, bool transform_cost_mat=true)
Reorders the permutation and compounds the spatial isometry (rotation.
Functor to find the canonical generating element for an orbit.
const SymOp & to_canonical() const
After using call operator, this can be checked.
Functor to find to check if element is in canonical form.
Functor to find to check if element is in canonical form.