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

#include <IntegralCoordinateWithin.hh>

Detailed Description

The Smith Normal Form of a transformation matrix allows the enumeration of lattice points to be generated in a particular order. This class can generate any lattice point given its index in the list in constant time.

If you want to convert between linear index and bijk (UnitCellCoord) quickly, you probably want to be using the UnitCellCoordIndexConverter class instead of this.

The original algorithm for constant time evaluation of the linear index that makes this class possible was developed by John C. Thomas and is described below:

The transformation matrix T given at construction is decomposed using Smith Normal Form decomposition, such that

T=U*S*V

where S is a diagonal matrix, and T converts the primitive lattice P to the superlattice L such that

L=P*T

Combining the two equations we find that

L*V.inv()=P*U*S

In other words, P*U is a primitive lattice that perfectly tiles the equivalent superlattice L*V.inv(), with the transformation matrix being S. If we define L'=L*V.inv(), P'=P*U and T'=S, the realationship looks just like a normal superlattice transformation:

L'=P'*T'

Since S (=T') is diagonal, points (m,n,p) on the transformed grid are a convenient choice for indexing. Defining S0=S(0,0), S1=S(1,1), and S2=S(2,2), an index i results in the following (m,n,p) values:

m=(i%(S0*S1))S0 n=(i%(S0*S1))/S0 p=i/(S0*S1)

Once the (m,n,p) value is determined, it can be transformed back to the original grid, to yield the desired (i,j,k) value, which is in terms of the original superlattice tiling unit:

(i,j,k)=U*(m,n,p)

Definition at line 122 of file IntegralCoordinateWithin.hh.

Public Types

typedef IntegralCoordinateWithin_f::matrix_type matrix_type
 
typedef IntegralCoordinateWithin_f::vector_type vector_type
 

Public Member Functions

 OrderedLatticePointGenerator (const matrix_type &transformation_matrix)
 
vector_type operator() (Index ix) const
 
long int size () const
 Returns the total number of unique lattice points that can be generated. More...
 

Private Member Functions

vector_type _normalize_lattice_point (const vector_type &mnp) const
 
vector_type _make_smith_normal_form_lattice_point (Index ix) const
 

Private Attributes

long int m_total_lattice_points
 
IntegralCoordinateWithin_f m_bring_within_f
 
matrix_type m_smith_normal_U
 
matrix_type m_smith_normal_S
 
matrix_type m_smith_normal_V
 
std::array< int, 2 > m_stride
 

Member Typedef Documentation

◆ matrix_type

◆ vector_type

Constructor & Destructor Documentation

◆ OrderedLatticePointGenerator()

CASM::xtal::impl::OrderedLatticePointGenerator::OrderedLatticePointGenerator ( const matrix_type transformation_matrix)

Construct with the transformation matrix that takes the tiling unit to the superlattice

Definition at line 46 of file IntegralCoordinateWithin.cc.

Member Function Documentation

◆ _make_smith_normal_form_lattice_point()

OrderedLatticePointGenerator::vector_type CASM::xtal::impl::OrderedLatticePointGenerator::_make_smith_normal_form_lattice_point ( Index  ix) const
private

Create a lattice point from the provided index, in the Smith Normal Form diagonalized space

Definition at line 70 of file IntegralCoordinateWithin.cc.

◆ _normalize_lattice_point()

OrderedLatticePointGenerator::vector_type CASM::xtal::impl::OrderedLatticePointGenerator::_normalize_lattice_point ( const vector_type mnp) const
private

Convert UnitCell created with strides (mnp) to a "normal" UnitCell in terms of the superlattice (ijk) U*mnp = ijk

Definition at line 63 of file IntegralCoordinateWithin.cc.

◆ operator()()

OrderedLatticePointGenerator::vector_type CASM::xtal::impl::OrderedLatticePointGenerator::operator() ( Index  ix) const

Given the index into the list of lattice points, return its corresponding lattice point, with guaranteed order

Definition at line 78 of file IntegralCoordinateWithin.cc.

◆ size()

long int CASM::xtal::impl::OrderedLatticePointGenerator::size ( ) const
inline

Returns the total number of unique lattice points that can be generated.

Definition at line 136 of file IntegralCoordinateWithin.hh.

Member Data Documentation

◆ m_bring_within_f

IntegralCoordinateWithin_f CASM::xtal::impl::OrderedLatticePointGenerator::m_bring_within_f
private

Definition at line 142 of file IntegralCoordinateWithin.hh.

◆ m_smith_normal_S

matrix_type CASM::xtal::impl::OrderedLatticePointGenerator::m_smith_normal_S
private

The Smith Normal Form decomposition is: trans_mat = U*S*V, with det(U)=det(V)=1; S is diagonal

Definition at line 149 of file IntegralCoordinateWithin.hh.

◆ m_smith_normal_U

matrix_type CASM::xtal::impl::OrderedLatticePointGenerator::m_smith_normal_U
private

The Smith Normal Form decomposition is: trans_mat = U*S*V, with det(U)=det(V)=1; S is diagonal

Definition at line 146 of file IntegralCoordinateWithin.hh.

◆ m_smith_normal_V

matrix_type CASM::xtal::impl::OrderedLatticePointGenerator::m_smith_normal_V
private

The Smith Normal Form decomposition is: trans_mat = U*S*V, with det(U)=det(V)=1; S is diagonal

Definition at line 152 of file IntegralCoordinateWithin.hh.

◆ m_stride

std::array<int, 2> CASM::xtal::impl::OrderedLatticePointGenerator::m_stride
private

stride maps canonical 3d index (m,n,p) onto linear index – l = m + n*stride[0] + p*stride[1]

Definition at line 156 of file IntegralCoordinateWithin.hh.

◆ m_total_lattice_points

long int CASM::xtal::impl::OrderedLatticePointGenerator::m_total_lattice_points
private

Definition at line 139 of file IntegralCoordinateWithin.hh.


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