CASM  1.1.0
A Clusters Approach to Statistical Mechanics
CASM::xtal::UnitCellIndexConverter Class Reference

#include <LinearIndexConverter.hh>

+ Inheritance diagram for CASM::xtal::UnitCellIndexConverter:

Detailed Description

Converts back and forth between UnitCelland its linear index, where the linear index is guaranteed to preserve order based on the and the Smith Normal Form of the UnitCell.

By default, the constructed index converter will always accept UnitCell 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 UnitCell is returned.

Definition at line 131 of file LinearIndexConverter.hh.

Public Types

typedef UnitCellCoordIndexConverter::matrix_type matrix_type
 

Public Member Functions

 UnitCellIndexConverter (const matrix_type &transformation_matrix)
 
UnitCell bring_within (const UnitCell &ijk) const
 Bring the given UnitCell into the superlattice using lattice translations. More...
 
const UnitCelloperator() (Index ix) const
 Given the linear index, retreive the corresponding UnitCell. More...
 
Index operator() (const UnitCell &ijk) const
 
void always_bring_within ()
 
void never_bring_within ()
 
Index total_sites () const
 Returns the total number of sites within the superlattice. More...
 

Private Member Functions

UnitCellCoord bring_within (const UnitCellCoord &bijk) const
 
Index operator() (const UnitCellCoord &bijk) const
 
Index total_sites () const
 Returns the total number of sites within the superlattice. More...
 
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< UnitCellCoordm_linear_index_to_bijk
 Convert from linear index to UnitCellCoord. More...
 
std::unordered_map< UnitCellCoord, Indexm_bijk_to_linear_index
 Convert from UnitCellCoord to linear index. More...
 
std::unordered_map< UnitCellCoord, Indexm_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...
 

Member Typedef Documentation

◆ matrix_type

Constructor & Destructor Documentation

◆ UnitCellIndexConverter()

CASM::xtal::UnitCellIndexConverter::UnitCellIndexConverter ( const matrix_type transformation_matrix)
inline

Definition at line 134 of file LinearIndexConverter.hh.

Member Function Documentation

◆ _make_all_ordered_bijk_values()

std::vector< UnitCellCoord > CASM::xtal::UnitCellCoordIndexConverter::_make_all_ordered_bijk_values ( const impl::OrderedLatticePointGenerator make_point,
int  basis_sites_in_prim 
)
staticprivateinherited

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.

◆ _throw_if_bad_basis_sites_in_prim()

void CASM::xtal::UnitCellCoordIndexConverter::_throw_if_bad_basis_sites_in_prim ( int  basis_sites_in_prim)
staticprivateinherited

Throws exception if the number of sites specified in the tiling unit is less than 1

Definition at line 11 of file LinearIndexConverter.cc.

◆ _throw_if_incompatible_bijk()

void CASM::xtal::UnitCellCoordIndexConverter::_throw_if_incompatible_bijk ( const UnitCellCoord bijk) const
privateinherited

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.

◆ _throw_if_incompatible_index()

void CASM::xtal::UnitCellCoordIndexConverter::_throw_if_incompatible_index ( Index  ix) const
privateinherited

Throws exception if the specified index is out of the allowed range.

Definition at line 22 of file LinearIndexConverter.cc.

◆ always_bring_within()

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 59 of file LinearIndexConverter.cc.

◆ bring_within() [1/2]

UnitCell CASM::xtal::UnitCellIndexConverter::bring_within ( const UnitCell ijk) const
inline

Bring the given UnitCell into the superlattice using lattice translations.

Definition at line 142 of file LinearIndexConverter.hh.

◆ bring_within() [2/2]

UnitCellCoord CASM::xtal::UnitCellCoordIndexConverter::bring_within ( const UnitCellCoord bijk) const
inherited

Bring the given UnitCellCoord into the superlattice using lattice translations

Definition at line 75 of file LinearIndexConverter.cc.

◆ never_bring_within()

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 55 of file LinearIndexConverter.cc.

◆ operator()() [1/3]

Index CASM::xtal::UnitCellIndexConverter::operator() ( const UnitCell ijk) const
inline

Given the UnitCell, retreive its corresponding linear index. If applicable, brings the UnitCell within the superlattice

Definition at line 154 of file LinearIndexConverter.hh.

◆ operator()() [2/3]

Index CASM::xtal::UnitCellCoordIndexConverter::operator() ( const UnitCellCoord bijk) const
inherited

Given the UnitCellCoord, retreive its corresponding linear index. If applicable, brings the UnitCellCoord within the superlattice

Definition at line 88 of file LinearIndexConverter.cc.

◆ operator()() [3/3]

const UnitCell& CASM::xtal::UnitCellIndexConverter::operator() ( Index  ix) const
inline

Given the linear index, retreive the corresponding UnitCell.

Definition at line 148 of file LinearIndexConverter.hh.

◆ total_sites() [1/2]

Index CASM::xtal::UnitCellCoordIndexConverter::total_sites ( ) const
inlineinherited

Returns the total number of sites within the superlattice.

Definition at line 73 of file LinearIndexConverter.hh.

◆ total_sites() [2/2]

Index CASM::xtal::UnitCellCoordIndexConverter::total_sites
inline

Returns the total number of sites within the superlattice.

Definition at line 73 of file LinearIndexConverter.hh.

Member Data Documentation

◆ m_automatically_bring_bijk_within

bool CASM::xtal::UnitCellCoordIndexConverter::m_automatically_bring_bijk_within
privateinherited

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.

◆ m_basis_sites_in_prim

int CASM::xtal::UnitCellCoordIndexConverter::m_basis_sites_in_prim
privateinherited

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.

◆ m_bijk_to_linear_index

std::unordered_map<UnitCellCoord, Index> CASM::xtal::UnitCellCoordIndexConverter::m_bijk_to_linear_index
privateinherited

Convert from UnitCellCoord to linear index.

Definition at line 80 of file LinearIndexConverter.hh.

◆ m_bijk_to_linear_index_outside_of_superlattice

std::unordered_map<UnitCellCoord, Index> CASM::xtal::UnitCellCoordIndexConverter::m_bijk_to_linear_index_outside_of_superlattice
mutableprivateinherited

Stores a cache of UnitCellCoord values that landed outside of the superlattice

Definition at line 85 of file LinearIndexConverter.hh.

◆ m_bring_within_f

IntegralCoordinateWithin_f CASM::xtal::UnitCellCoordIndexConverter::m_bring_within_f
privateinherited

Functor to bring UnitCellCoord values back into the superlattice.

Definition at line 96 of file LinearIndexConverter.hh.

◆ m_linear_index_to_bijk

std::vector<UnitCellCoord> CASM::xtal::UnitCellCoordIndexConverter::m_linear_index_to_bijk
privateinherited

Convert from linear index to UnitCellCoord.

Definition at line 77 of file LinearIndexConverter.hh.


The documentation for this class was generated from the following file: