1 #ifndef CASM_OrbitGeneration_impl
2 #define CASM_OrbitGeneration_impl
9 template <
typename _OrbitType>
13 sym_compare(_sym_compare),
14 m_element_compare(sym_compare),
15 m_generate_canonical(group, sym_compare),
16 elements(m_element_compare) {}
19 template <
typename _OrbitType>
20 std::pair<typename OrbitGeneratorSet<_OrbitType>::iterator,
bool>
22 return elements.insert(m_generate_canonical(test));
26 template <
typename _OrbitType>
27 std::pair<typename OrbitGeneratorSet<_OrbitType>::iterator,
bool>
29 return elements.insert(test);
33 template <
typename _OrbitType>
34 template <
typename OrbitOutputIterator>
36 OrbitOutputIterator result) {
37 for (
const auto &e : elements) {
38 *result++ =
OrbitType(e, group, sym_compare);
55 template <
typename SymCompareType>
57 std::vector<typename SymCompareType::Element>
const &generating_elements,
58 SymGroup const &generating_group, SymCompareType
const &sym_compare) {
61 for (
auto const &el : generating_elements) {
64 std::vector<Orbit<SymCompareType>> orbits;
65 orbits.reserve(generating_elements.size());
72 template <
typename _OrbitType>
75 : sym_compare(_sym_compare) {}
77 template <
typename _OrbitType>
80 auto A_invariants = sym_compare.make_invariants(A);
81 auto B_invariants = sym_compare.make_invariants(B);
82 return sym_compare.inter_orbit_compare(A, A_invariants, B, B_invariants);
87 template <
typename _OrbitType>
89 const std::vector<SymOp> &_generating_group,
91 : generating_group(_generating_group),
92 sym_compare(_sym_compare),
93 m_to_canonical(nullptr) {}
96 template <
typename _OrbitType>
100 for (
const auto &op : generating_group) {
101 auto test = sym_compare.prepare(sym_compare.copy_apply(op, e));
102 if (sym_compare.compare(result, test)) {
104 m_to_canonical = &op;
111 template <
typename _OrbitType>
113 return *m_to_canonical;
117 template <
typename _OrbitType>
119 return to_canonical().
inverse();
168 template <
typename _OrbitType>
170 const std::vector<SymOp> &_generating_group,
172 : generating_group(_generating_group), sym_compare(_sym_compare) {}
175 template <
typename _OrbitType>
178 generating_group.begin(), generating_group.end(), [&](
const SymOp &op) {
179 auto test = sym_compare.prepare(sym_compare.copy_apply(op, e));
180 return sym_compare.compare(e, test);
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
std::vector< Orbit< SymCompareType > > generate_orbits(std::vector< typename SymCompareType::Element > const &generating_elements, SymGroup const &generating_group, SymCompareType const &sym_compare)
Construct orbits from a vector of generating elements.
const SymOp & from_canonical() const
After using call operator, this can be checked.
OrbitType::Element Element
const SymOp & to_canonical() const
After using call operator, this can be checked.
CanonicalGenerator(const std::vector< SymOp > &_generating_group, const SymCompareType &_sym_compare)
OrbitType::SymCompareType SymCompareType
Element operator()(const Element &e) const
Applies symmetry to return an equivalent Element in a canonical form.
OrbitType::SymCompareType SymCompareType
OrbitType::Element Element
IsCanonical(const std::vector< SymOp > &_generating_group, const SymCompareType &_sym_compare)
bool operator()(const Element &e) const
Applies symmetry to check if any Element is greater than e.
OrbitGeneratorCompare(const SymCompareType &_sym_compare)
OrbitType::Element Element
bool operator()(const Element &A, const Element &B) const
OrbitType::SymCompareType SymCompareType
Data structure that holds canonical generating elements and can then make sorted orbits.
OrbitOutputIterator make_orbits(OrbitOutputIterator result)
Construct Orbit from all generating elements.
std::pair< typename OrbitGeneratorSet< OrbitType >::iterator, bool > insert(const Element &test)
Try inserting an element, after generating the canonical form.
OrbitType::SymCompareType SymCompareType
OrbitGenerators(const SymGroup &_group, const SymCompareType &_sym_compare)
std::pair< typename OrbitGeneratorSet< OrbitType >::iterator, bool > insert_canonical(const Element &test)
Try inserting an element, assuming it is in canonical form.
OrbitType::Element Element