CASM
1.1.0
A Clusters Approach to Statistical Mechanics
|
#include <LinearIndexConverter.hh>
Converts back and forth between UnitCellCoord and its linear index, where the linear index is guaranteed to preserve order based on the sublattice index of the UnitCellCoord, and the Smith Normal Form of the UnitCell.
By default, the constructed index converter will always accept UnitCellCoord values that fall outside of the superlattice. When this happens, the given UnitCellCoord is brought into the superlattice using superlattice vector translations, and the index of the resulting UnitCellCoord is returned.
Definition at line 26 of file LinearIndexConverter.hh.
Public Types | |
typedef impl::OrderedLatticePointGenerator::matrix_type | matrix_type |
Public Member Functions | |
UnitCellCoordIndexConverter (const matrix_type &transformation_matrix, int basis_sites_in_prim) | |
void | never_bring_within () |
void | always_bring_within () |
UnitCellCoord | bring_within (const UnitCellCoord &bijk) const |
const UnitCellCoord & | operator() (Index ix) const |
Given the linear index, retreive the corresponding UnitCellCoord. More... | |
Index | operator() (const UnitCellCoord &bijk) const |
Index | total_sites () const |
Returns the total number of sites within the superlattice. More... | |
Private Member Functions | |
void | _throw_if_incompatible_index (Index ix) const |
Throws exception if the specified index is out of the allowed range. More... | |
void | _throw_if_incompatible_bijk (const UnitCellCoord &bijk) const |
Static Private Member Functions | |
static std::vector< UnitCellCoord > | _make_all_ordered_bijk_values (const impl::OrderedLatticePointGenerator &make_point, int basis_sites_in_prim) |
static void | _throw_if_bad_basis_sites_in_prim (int basis_sites_in_prim) |
Private Attributes | |
std::vector< UnitCellCoord > | m_linear_index_to_bijk |
Convert from linear index to UnitCellCoord. More... | |
std::unordered_map< UnitCellCoord, Index > | m_bijk_to_linear_index |
Convert from UnitCellCoord to linear index. More... | |
std::unordered_map< UnitCellCoord, Index > | m_bijk_to_linear_index_outside_of_superlattice |
int | m_basis_sites_in_prim |
bool | m_automatically_bring_bijk_within |
IntegralCoordinateWithin_f | m_bring_within_f |
Functor to bring UnitCellCoord values back into the superlattice. More... | |
typedef impl::OrderedLatticePointGenerator::matrix_type CASM::xtal::UnitCellCoordIndexConverter::matrix_type |
Definition at line 28 of file LinearIndexConverter.hh.
|
inline |
Initialize with the transformation that defines how to convert from the tiling unit (prim) to the superlattice, and the number of basis sites in the primitive cell
Definition at line 33 of file LinearIndexConverter.hh.
|
staticprivate |
Enumerates every possible UnitCellCoord and returns them in the expected order (blocks by basis site, with the Smith Normal Form order within each block
Definition at line 51 of file LinearIndexConverter.cc.
|
staticprivate |
Throws exception if the number of sites specified in the tiling unit is less than 1
Definition at line 11 of file LinearIndexConverter.cc.
|
private |
Throws exception if the specified UnitCellCoord has a sublattice index that isn't compatible. If the state is set to not automatically bring the UnitCellCoord within the superlattice, then any UnitCellCoord outside the boundary will also trigger an exception
Definition at line 32 of file LinearIndexConverter.cc.
|
private |
Throws exception if the specified index is out of the allowed range.
Definition at line 22 of file LinearIndexConverter.cc.
void CASM::xtal::UnitCellCoordIndexConverter::always_bring_within | ( | ) |
Automatically bring UnitCellCoord values within the supercell when querying for the index (on by default)
Definition at line 71 of file LinearIndexConverter.cc.
UnitCellCoord CASM::xtal::UnitCellCoordIndexConverter::bring_within | ( | const UnitCellCoord & | bijk | ) | const |
Bring the given UnitCellCoord into the superlattice using lattice translations
Definition at line 75 of file LinearIndexConverter.cc.
void CASM::xtal::UnitCellCoordIndexConverter::never_bring_within | ( | ) |
Prevent the index converter from bringing UnitCellCoord within the supercell when querying for the index
Definition at line 67 of file LinearIndexConverter.cc.
Index CASM::xtal::UnitCellCoordIndexConverter::operator() | ( | const UnitCellCoord & | bijk | ) | const |
Given the UnitCellCoord, retreive its corresponding linear index. If applicable, brings the UnitCellCoord within the superlattice
Definition at line 88 of file LinearIndexConverter.cc.
const UnitCellCoord & CASM::xtal::UnitCellCoordIndexConverter::operator() | ( | Index | ix | ) | const |
Given the linear index, retreive the corresponding UnitCellCoord.
Definition at line 83 of file LinearIndexConverter.cc.
|
inline |
Returns the total number of sites within the superlattice.
Definition at line 73 of file LinearIndexConverter.hh.
|
private |
If set to true, UnitCellCoord values will be brought within the supercell before querying for the index
Definition at line 93 of file LinearIndexConverter.hh.
|
private |
How many blocks of "b", i.e. number of atoms in the primitive cell, as specified at construction
Definition at line 89 of file LinearIndexConverter.hh.
|
private |
Convert from UnitCellCoord to linear index.
Definition at line 80 of file LinearIndexConverter.hh.
|
mutableprivate |
Stores a cache of UnitCellCoord values that landed outside of the superlattice
Definition at line 85 of file LinearIndexConverter.hh.
|
private |
Functor to bring UnitCellCoord values back into the superlattice.
Definition at line 96 of file LinearIndexConverter.hh.
|
private |
Convert from linear index to UnitCellCoord.
Definition at line 77 of file LinearIndexConverter.hh.