CASM  1.1.0
A Clusters Approach to Statistical Mechanics
SupercellClusterOrbits_impl.hh
Go to the documentation of this file.
1 #ifndef CASM_SupercellClusterOrbits_impl
2 #define CASM_SupercellClusterOrbits_impl
3 
6 
7 namespace CASM {
8 
13 template <typename PermuteIteratorIt>
14 std::vector<Permutation> make_inverse_permutations(PermuteIteratorIt begin,
15  PermuteIteratorIt end) {
16  std::vector<Permutation> inverse_permutations;
17  for (auto permute_it = begin; permute_it != end; ++permute_it) {
18  inverse_permutations.push_back(permute_it->combined_permute().inverse());
19  }
20  return inverse_permutations;
21 }
22 
25 template <typename InversePermutationIterator>
27  InversePermutationIterator inverse_permutations_begin,
28  InversePermutationIterator inverse_permutations_end,
29  std::set<Index> const &cluster_site_indices) {
30  auto max = cluster_site_indices;
31  auto ipermute_it = inverse_permutations_begin;
32  for (; ipermute_it != inverse_permutations_end; ++ipermute_it) {
33  auto test =
34  permute_cluster_site_indices(*ipermute_it, cluster_site_indices);
35  if (test > max) {
36  max = test;
37  }
38  }
39  return max;
40 }
41 
70 template <typename InversePermutationIterator, typename ElementIterator>
71 std::set<std::set<Index>, ClusterSiteIndicesCompare>
73  SupercellSymInfo const &sym_info,
74  InversePermutationIterator inverse_permutations_begin,
75  InversePermutationIterator inverse_permutations_end,
76  ElementIterator element_begin, ElementIterator element_end) {
77  // Using set::set<Index> for cluster site indices:
78  // - removes duplicate sites / clusters that may occur due to periodic
79  // boundary conditions
80  // - site indices transform via inverse permutations
81  // - sorts cluster site indices for easy comparison to find the canonical
82  // cluster site indices
83  std::set<std::set<Index>, ClusterSiteIndicesCompare> orbit_generators;
84  for (auto it = element_begin; it != element_end; ++it) {
85  auto element = make_cluster_site_indices(*it, sym_info);
86  auto canonical_element = make_canonical_cluster_site_indices(
87  inverse_permutations_begin, inverse_permutations_end, element);
88  orbit_generators.insert(canonical_element);
89  }
90 
91  return orbit_generators;
92 }
93 
94 } // namespace CASM
95 
96 #endif
A class that collects all symmetry information for for performing symmetry transformations on the sit...
Main CASM namespace.
Definition: APICommand.hh:8
std::set< std::set< Index >, ClusterSiteIndicesCompare > make_orbit_generators_under_periodic_boundary_conditions(SupercellSymInfo const &sym_info, InversePermutationIterator inverse_permutations_begin, InversePermutationIterator inverse_permutations_end, ElementIterator element_begin, ElementIterator element_end)
Return "within_scel" orbit generators, as sets of cluster site indices.
std::set< Index > make_canonical_cluster_site_indices(InversePermutationIterator inverse_permutations_begin, InversePermutationIterator inverse_permutations_end, std::set< Index > const &cluster_site_indices)
std::set< Index > make_cluster_site_indices(IntegralCluster const &cluster, SupercellSymInfo const &sym_info)
Return site indices of cluster sites.
std::vector< Permutation > make_inverse_permutations(PermuteIteratorIt begin, PermuteIteratorIt end)
Make inverse permutations.
T max(const T &A, const T &B)
Definition: CASM_math.hh:95
std::set< Index > permute_cluster_site_indices(Permutation const &inverse_permute, std::set< Index > const &cluster_site_indices)
Rather than permute values, here we want to permute cluster site indices.
Sort std::set<Index> by size, then value (lexicographical compare)