CASM  1.1.0
A Clusters Approach to Statistical Mechanics
ClusterOrbits.hh
Go to the documentation of this file.
1 #ifndef CASM_ClusterOrbits
2 #define CASM_ClusterOrbits
3 
4 #include <functional>
5 #include <iostream>
6 #include <utility>
7 #include <vector>
8 
12 
13 namespace CASM {
14 
15 namespace xtal {
16 class Site;
17 class UnitCellCoord;
18 } // namespace xtal
19 template <typename OrbitType>
20 struct OrbitGenerators;
21 class PermuteIterator;
22 class Structure;
23 class SymGroup;
24 
37 typedef std::function<bool(xtal::Site)> SiteFilterFunction;
38 
41 typedef std::function<bool(IntegralCluster)> ClusterFilterFunction;
42 
45 typedef std::function<std::vector<xtal::UnitCellCoord>(Structure const &,
48 
51  bool _include_subclusters = true);
52 
55 };
56 
57 /* -- OrbitBranchSpecs Declarations ------------------------------------- */
58 
63 template <typename _OrbitType>
65  public:
66  typedef std::vector<xtal::UnitCellCoord> Container;
67  typedef Container::const_iterator const_iterator;
68  typedef _OrbitType OrbitType;
69  typedef typename OrbitType::Element ClusterType;
70  typedef typename OrbitType::SymCompareType SymCompareType;
72 
74  typedef std::function<bool(ClusterType)> Filter;
75 
91  template <typename SiteIterator>
92  OrbitBranchSpecs(const PrimType &_prim, SiteIterator _begin,
93  SiteIterator _end, const SymGroup &_generating_grp,
94  Filter _filter, const SymCompareType &_sym_compare)
95  : m_prim_ptr(&_prim),
96  m_candidate_sites(_begin, _end),
97  m_generating_grp(&_generating_grp),
98  m_filter(_filter),
99  m_sym_compare(_sym_compare) {}
100 
101  const PrimType &prim() const { return *m_prim_ptr; }
102 
103  std::pair<const_iterator, const_iterator> candidate_sites() const {
104  return std::make_pair(m_candidate_sites.cbegin(), m_candidate_sites.cend());
105  }
106 
107  const SymGroup &generating_group() const { return *m_generating_grp; }
108 
109  Filter filter() const { return m_filter; }
110 
111  const SymCompareType &sym_compare() const { return m_sym_compare; }
112 
113  private:
115 
117 
119 
121 
123 };
124 
127 template <typename OutputIterator>
128 OutputIterator neighborhood(Structure const &unit, double max_radius,
129  SiteFilterFunction site_filter,
130  OutputIterator result, double xtal_tol);
131 
134 template <typename OutputIterator>
135 OutputIterator neighborhood(IntegralCluster const &phenomenal,
136  double cutoff_radius,
137  SiteFilterFunction site_filter,
138  bool include_phenomenal_sites,
139  OutputIterator result, double xtal_tol);
140 
142 template <typename OrbitType, typename OutputIterator>
143 OutputIterator local_orbit_neighborhood(const OrbitType &orbit,
144  OutputIterator result);
145 
147 template <typename ClusterOrbitIterator, typename OutputIterator>
148 OutputIterator local_neighborhood(ClusterOrbitIterator begin,
149  ClusterOrbitIterator end,
150  OutputIterator result);
151 
154 template <typename OrbitType>
155 bool has_local_neighborhood_overlap(std::vector<OrbitType> &local_orbits,
156  const Eigen::Matrix3i &transf_mat);
157 
160 template <typename OrbitType>
161 std::vector<Eigen::Matrix3i> viable_supercells(
162  std::vector<OrbitType> &local_orbits,
163  const std::vector<Eigen::Matrix3i> &transf_mat);
164 
165 /* -- Custom clusters --- */
166 
168 template <typename OrbitType>
170  typename OrbitType::Element cluster,
171  OrbitGenerators<OrbitType> &generators);
172 
173 /* -- Orbit access/usage function declarations
174  * ------------------------------------- */
175 
178 template <typename OrbitIterator>
179 std::pair<OrbitIterator, OrbitIterator> orbit_branch(OrbitIterator begin,
180  OrbitIterator end,
181  Index size);
182 
183 /* -- Cluster Orbit generating function declarations
184  * ------------------------------------- */
185 
187 template <typename OrbitType, typename OrbitOutputIterator>
188 OrbitOutputIterator make_asymmetric_unit(
189  const OrbitBranchSpecs<OrbitType> &specs, OrbitOutputIterator result,
190  std::ostream &status);
191 
193 template <typename OrbitType, typename OrbitInputIterator,
194  typename OrbitOutputIterator>
195 OrbitOutputIterator make_next_orbitbranch(
196  OrbitInputIterator begin, OrbitInputIterator end,
197  const OrbitBranchSpecs<OrbitType> &specs, OrbitOutputIterator result,
198  std::ostream &status);
199 
201 template <typename OrbitBranchSpecsIterator, typename OrbitOutputIterator>
202 OrbitOutputIterator make_orbits(
203  OrbitBranchSpecsIterator begin, OrbitBranchSpecsIterator end,
204  const std::vector<IntegralClusterOrbitGenerator> &custom_generators,
205  OrbitOutputIterator result, std::ostream &status);
206 
207 /* -- SymCompareType-Specific IntegralCluster Orbit functions --- */
208 
227 template <typename OrbitOutputIterator>
229  std::shared_ptr<Structure const> prim_ptr,
230  SiteFilterFunction const &site_filter, double xtal_tol,
231  OrbitOutputIterator result, std::ostream &status);
232 
255 template <typename OrbitOutputIterator>
256 OrbitOutputIterator make_prim_periodic_orbits(
257  std::shared_ptr<Structure const> prim_ptr,
258  std::vector<double> const &max_length,
259  std::vector<IntegralClusterOrbitGenerator> const &custom_generators,
260  SiteFilterFunction const &site_filter, double xtal_tol,
261  OrbitOutputIterator result, std::ostream &status);
262 
276 template <typename OutputIterator>
277 OutputIterator prim_periodic_orbit_neighborhood(
278  const PrimPeriodicOrbit<IntegralCluster> &orbit, OutputIterator result);
279 
291 template <typename ClusterOrbitIterator, typename OutputIterator>
292 OutputIterator prim_periodic_neighborhood(ClusterOrbitIterator begin,
293  ClusterOrbitIterator end,
294  OutputIterator result);
295 
312 template <typename OutputIterator, typename OrbitType>
313 OutputIterator flower_neighborhood(OrbitType const &orbit,
314  OutputIterator result);
315 
329 template <typename ClusterOrbitIterator, typename OutputIterator>
330 OutputIterator flower_neighborhood(ClusterOrbitIterator begin,
331  ClusterOrbitIterator end,
332  OutputIterator result);
333 
334 } // namespace CASM
335 
336 #endif
OrbitOutputIterator make_prim_periodic_orbits(std::shared_ptr< Structure const > prim_ptr, std::vector< double > const &max_length, std::vector< IntegralClusterOrbitGenerator > const &custom_generators, SiteFilterFunction const &site_filter, double xtal_tol, OrbitOutputIterator result, std::ostream &status)
Generate Orbit<IntegralCluster> by specifying max cluster length for each branch.
OrbitOutputIterator make_prim_periodic_asymmetric_unit(std::shared_ptr< Structure const > prim_ptr, SiteFilterFunction const &site_filter, double xtal_tol, OrbitOutputIterator result, std::ostream &status)
Generate the prim periodic asymmetric unit.
Store data used to generate an orbit branch of IntegralCluster.
std::pair< const_iterator, const_iterator > candidate_sites() const
std::vector< xtal::UnitCellCoord > Container
const SymGroup * m_generating_grp
OrbitType::SymCompareType SymCompareType
SymCompareType m_sym_compare
const PrimType & prim() const
const SymCompareType & sym_compare() const
std::function< bool(ClusterType)> Filter
Filter returns true for allowed ClusterType, false for unallowed.
Container::const_iterator const_iterator
const SymGroup & generating_group() const
OrbitBranchSpecs(const PrimType &_prim, SiteIterator _begin, SiteIterator _end, const SymGroup &_generating_grp, Filter _filter, const SymCompareType &_sym_compare)
Constructor.
const PrimType * m_prim_ptr
OrbitType::Element ClusterType
An Orbit of Element.
Definition: Orbit.hh:43
Structure specifies the lattice and atomic basis of a crystal.
Definition: Structure.hh:30
SymGroup is a collection of symmetry operations that satisfy the group property The symmetry operatio...
Definition: SymGroup.hh:42
std::pair< OrbitIterator, OrbitIterator > orbit_branch(OrbitIterator begin, OrbitIterator end, Index size)
Returns the first range containing orbits of the requested orbit branch in the given range of Orbit.
OutputIterator neighborhood(Structure const &unit, double max_radius, SiteFilterFunction site_filter, OutputIterator result, double xtal_tol)
Output the neighborhood of UnitCellCoord within max_radius of any sites in unit cell.
OrbitGenerators< OrbitType > & insert_subcluster_generators(typename OrbitType::Element cluster, OrbitGenerators< OrbitType > &generators)
Given a cluster, generate all subcluster generators.
OutputIterator flower_neighborhood(OrbitType const &orbit, OutputIterator result)
Iterate over all sites in an orbit and insert a UnitCellCoord.
OrbitOutputIterator make_next_orbitbranch(OrbitInputIterator begin, OrbitInputIterator end, const OrbitBranchSpecs< OrbitType > &specs, OrbitOutputIterator result, std::ostream &status)
Use orbits of size n to generate orbits of size n+1.
OutputIterator local_orbit_neighborhood(const OrbitType &orbit, OutputIterator result)
Iterate over all sites in an orbit and insert a UnitCellCoord.
OutputIterator prim_periodic_orbit_neighborhood(const PrimPeriodicOrbit< IntegralCluster > &orbit, OutputIterator result)
Iterate over all sites in an orbit and insert a UnitCellCoord.
OutputIterator prim_periodic_neighborhood(ClusterOrbitIterator begin, ClusterOrbitIterator end, OutputIterator result)
Iterate over all sites in all orbits and insert a UnitCellCoord.
OutputIterator local_neighborhood(ClusterOrbitIterator begin, ClusterOrbitIterator end, OutputIterator result)
Iterate over all sites in all orbits and insert a UnitCellCoord.
Eigen::Matrix3l transf_mat(const Lattice &prim_lat, const Lattice &super_lat)
Main CASM namespace.
Definition: APICommand.hh:8
OrbitOutputIterator make_orbits(OrbitBranchSpecsIterator begin, OrbitBranchSpecsIterator end, const std::vector< IntegralClusterOrbitGenerator > &custom_generators, OrbitOutputIterator result, std::ostream &status)
Generate orbits of IntegralCluster using OrbitBranchSpecs.
bool has_local_neighborhood_overlap(std::vector< OrbitType > &local_orbits, const Eigen::Matrix3i &transf_mat)
Check if periodic images of sites in an orbit are overlapping in supercells defined by the given supe...
std::function< bool(xtal::Site)> SiteFilterFunction
std::vector< Eigen::Matrix3i > viable_supercells(std::vector< OrbitType > &local_orbits, const std::vector< Eigen::Matrix3i > &transf_mat)
Return superlattice transf. matrices for which has_local_neighborhood_overlap is false.
std::function< std::vector< xtal::UnitCellCoord >Structure const &, SiteFilterFunction)> CandidateSitesFunction
OrbitOutputIterator make_asymmetric_unit(const OrbitBranchSpecs< OrbitType > &specs, OrbitOutputIterator result, std::ostream &status)
Generate the asymmetric unit, using OrbitBranchSpecs.
INDEX_TYPE Index
For long integer indexing:
Definition: definitions.hh:39
std::function< bool(IntegralCluster)> ClusterFilterFunction
IntegralClusterOrbitGenerator(const IntegralCluster &_prototype, bool _include_subclusters=true)
Definition: ClusterOrbits.cc:6
Data structure that holds canonical generating elements and can then make sorted orbits.