CASM  1.1.0
A Clusters Approach to Statistical Mechanics
CASM::PrimNeighborList Class Reference

#include <NeighborList.hh>

Detailed Description

The PrimNeighborList gives the coordinates of UnitCell that are neighbors of the origin UnitCell.

  • The PrimNeighborList is constructed with a weighting matrix, W, that defines the shape of neighborhood
  • The canonical order of neighboring UnitCell is obtained by lexicographically sorting [r, i, j, k], where r = (i,j,k).transpose() * W * (i,j,k).
  • The canonical order of UnitCellCoord is obtained by lexicographically sorting [r, i, j, k, b], where r = (i,j,k).transpose() * W * (i,j,k).
  • The PrimNeighborList can be expanded as needed to increase the range of the neighborhood without affecting the order of the neighbors.

Definition at line 39 of file NeighborList.hh.

Public Types

typedef Eigen::Matrix3l Matrix3Type
 
typedef Eigen::Matrix< long, Eigen::Dynamic, 1 > VectorXType
 
typedef std::set< UnitCell, std::function< bool(UnitCell, UnitCell)> > NeighborSet
 
typedef NeighborSet::size_type size_type
 
typedef NeighborSet::const_iterator const_iterator
 
typedef std::set< int > SublatIndices
 

Public Member Functions

Matrix3Type weight_matrix () const
 Return the weighting matrix W used to define the canonical order. More...
 
void expand (UnitCell const &uc)
 Expand the neighbor list to include the given UnitCellCoord. More...
 
void expand (UnitCellCoord const &uccoord)
 Expand the neighbor list to include the given UnitCellCoord. More...
 
size_type size () const
 size of the neighborhood of unit cells More...
 
const_iterator begin () const
 const_iterator over the neighborhood of unit cells More...
 
const_iterator end () const
 const_iterator over the neighborhood of unit cells More...
 
const_iterator cbegin () const
 const_iterator over the neighborhood of unit cells More...
 
const_iterator cend () const
 const_iterator over the neighborhood of unit cells More...
 
const SublatIndicessublat_indices () const
 pair of const_iterators over a range of indices of sublattices to include More...
 
Scalar neighbor_index (UnitCellCoord const &_ucc)
 Get neighborlist index of UnitCellCoord. More...
 
std::unique_ptr< PrimNeighborListclone () const
 Clone. More...
 
template<typename SublatIterator >
 PrimNeighborList (const Matrix3Type &W, SublatIterator begin, SublatIterator end)
 Constructor, specifying the weighting matrix to use and the indices of sublattices to include. More...
 
template<typename UnitCellCoordIterator >
void expand (UnitCellCoordIterator begin, UnitCellCoordIterator end)
 Expand the neighbor list to include the given range of UnitCellCoord. More...
 
template<typename UnitCellCoordIterator >
std::vector< Scalarneighbor_indices (UnitCellCoordIterator _begin, UnitCellCoordIterator _end)
 Get neighborlist indices of a collection of UnitCells, stored in. More...
 

Static Public Member Functions

static Matrix3Type make_weight_matrix (const Eigen::Matrix3d lat_column_mat, Index max_element_value, double tol)
 Returns a NeighborList weighting matrix appropriate for a particular lattice. More...
 

Public Attributes

EIGEN_MAKE_ALIGNED_OPERATOR_NEW typedef Index Scalar
 

Private Member Functions

Scalar _neighbor_index (UnitCellCoord const &_ucc) const
 Get neighborlist index of UnitCellCoord. More...
 
bool _expand (UnitCell const &uc)
 Expand the neighbor list to include the given UnitCell, but do not do additional updates returns true if added UnitCell is new. More...
 
bool _expand (UnitCellCoord const &uccoord)
 Expand the neighbor list to include the given UnitCellCoord, but do not do additional updates returns true if added UnitCellCoord is new. More...
 
void _expand (Scalar prev_range)
 Ensure that all intermediate UnitCell are included in our neighborhood. More...
 
Scalar _dist (const UnitCell &A) const
 Calculate A.transpose()*M*A. More...
 
VectorXType _add_dist (const UnitCell &A) const
 Return [r, i, j, k], where r = _dist(A) More...
 
bool _compare_unitcell (const UnitCell &A, const UnitCell &B) const
 Convert [i,j,k] -> [r,i,j,k] and then lexicographically compare. More...
 

Static Private Member Functions

static bool _compare_vec (const VectorXType &A, const VectorXType &B)
 Lexicographical comparison. More...
 

Private Attributes

Matrix3Type m_W
 Weighting matrix. More...
 
Eigen::MatrixXd m_Uinv
 Cholesky decomposition: W = U.transpose()*U, useful for getting bounding box. More...
 
NeighborSet m_neighborhood
 the neighborhood of [i, j, k] More...
 
Scalar m_range
 the neighborhood, m_neighborhood, contains all UnitCell with r <= m_range More...
 
SublatIndices m_sublat_indices
 the indices of sublattices that should be included More...
 

Member Typedef Documentation

◆ const_iterator

typedef NeighborSet::const_iterator CASM::PrimNeighborList::const_iterator

Definition at line 49 of file NeighborList.hh.

◆ Matrix3Type

◆ NeighborSet

Definition at line 47 of file NeighborList.hh.

◆ size_type

typedef NeighborSet::size_type CASM::PrimNeighborList::size_type

Definition at line 48 of file NeighborList.hh.

◆ SublatIndices

Definition at line 50 of file NeighborList.hh.

◆ VectorXType

typedef Eigen::Matrix<long, Eigen::Dynamic, 1> CASM::PrimNeighborList::VectorXType

Definition at line 45 of file NeighborList.hh.

Constructor & Destructor Documentation

◆ PrimNeighborList()

template<typename SublatIterator >
CASM::PrimNeighborList::PrimNeighborList ( const Matrix3Type W,
SublatIterator  begin,
SublatIterator  end 
)

Constructor, specifying the weighting matrix to use and the indices of sublattices to include.

Constructor.

Parameters
WA positive-definite weighting matrix for calculating the weighted squared L2 norm of the unitcell indices.
  • The canonical order of UnitCell is obtained by lexicographically sorting [r, i, j, k], where r = (i,j,k).transpose() * W * (i,j,k).
  • The canonical order of UnitCellCoord is obtained by lexicographically sorting [r, i, j, k, b], where r = (i,j,k).transpose() * W * (i,j,k).

Definition at line 244 of file NeighborList.hh.

Member Function Documentation

◆ _add_dist()

PrimNeighborList::VectorXType CASM::PrimNeighborList::_add_dist ( const UnitCell A) const
private

Return [r, i, j, k], where r = _dist(A)

Definition at line 146 of file NeighborList.cc.

◆ _compare_unitcell()

bool CASM::PrimNeighborList::_compare_unitcell ( const UnitCell A,
const UnitCell B 
) const
private

Convert [i,j,k] -> [r,i,j,k] and then lexicographically compare.

Definition at line 155 of file NeighborList.cc.

◆ _compare_vec()

bool CASM::PrimNeighborList::_compare_vec ( const VectorXType A,
const VectorXType B 
)
staticprivate

Lexicographical comparison.

Definition at line 161 of file NeighborList.cc.

◆ _dist()

PrimNeighborList::Scalar CASM::PrimNeighborList::_dist ( const UnitCell A) const
private

Calculate A.transpose()*M*A.

Definition at line 141 of file NeighborList.cc.

◆ _expand() [1/3]

void CASM::PrimNeighborList::_expand ( Scalar  prev_range)
private

Ensure that all intermediate UnitCell are included in our neighborhood.

Definition at line 48 of file NeighborList.cc.

◆ _expand() [2/3]

bool CASM::PrimNeighborList::_expand ( UnitCell const &  uc)
private

Expand the neighbor list to include the given UnitCell, but do not do additional updates returns true if added UnitCell is new.

Expand the neighbor list to include the given UnitCellCoord.

Definition at line 42 of file NeighborList.cc.

◆ _expand() [3/3]

bool CASM::PrimNeighborList::_expand ( UnitCellCoord const &  uccoord)
private

Expand the neighbor list to include the given UnitCellCoord, but do not do additional updates returns true if added UnitCellCoord is new.

Expand the neighbor list to include the given UnitCellCoord.

Definition at line 37 of file NeighborList.cc.

◆ _neighbor_index()

PrimNeighborList::Scalar CASM::PrimNeighborList::_neighbor_index ( UnitCellCoord const &  _ucc) const
private

Get neighborlist index of UnitCellCoord.

Parameters
_ucc,withoutexpanding neighborhood

Definition at line 132 of file NeighborList.cc.

◆ begin()

PrimNeighborList::const_iterator CASM::PrimNeighborList::begin ( ) const

const_iterator over the neighborhood of unit cells

Definition at line 97 of file NeighborList.cc.

◆ cbegin()

PrimNeighborList::const_iterator CASM::PrimNeighborList::cbegin ( ) const

const_iterator over the neighborhood of unit cells

Definition at line 107 of file NeighborList.cc.

◆ cend()

PrimNeighborList::const_iterator CASM::PrimNeighborList::cend ( ) const

const_iterator over the neighborhood of unit cells

Definition at line 112 of file NeighborList.cc.

◆ clone()

std::unique_ptr< PrimNeighborList > CASM::PrimNeighborList::clone ( ) const

Clone.

Definition at line 212 of file NeighborList.cc.

◆ end()

PrimNeighborList::const_iterator CASM::PrimNeighborList::end ( ) const

const_iterator over the neighborhood of unit cells

Definition at line 102 of file NeighborList.cc.

◆ expand() [1/3]

void CASM::PrimNeighborList::expand ( UnitCell const &  uc)

Expand the neighbor list to include the given UnitCellCoord.

Definition at line 23 of file NeighborList.cc.

◆ expand() [2/3]

void CASM::PrimNeighborList::expand ( UnitCellCoord const &  uccoord)

Expand the neighbor list to include the given UnitCellCoord.

Definition at line 18 of file NeighborList.cc.

◆ expand() [3/3]

template<typename UnitCellCoordIterator >
void CASM::PrimNeighborList::expand ( UnitCellCoordIterator  begin,
UnitCellCoordIterator  end 
)

Expand the neighbor list to include the given range of UnitCellCoord.

  • The canonical order of UnitCellCoord is obtained by lexicographically sorting [r, i, j, k, b], where r = (i,j,k).transpose() * W * (i,j,k).
  • The canonical order of UnitCell is obtained by lexicographically sorting [r, i, j, k]
  • After determining the sorted order of the requested UnitCell, all intermediate UnitCell will also be added so that indices into the neighbor list are always constant and in canonical order

Definition at line 284 of file NeighborList.hh.

◆ make_weight_matrix()

PrimNeighborList::Matrix3Type CASM::PrimNeighborList::make_weight_matrix ( const Eigen::Matrix3d  lat_column_mat,
Index  max_element_value,
double  tol 
)
static

Returns a NeighborList weighting matrix appropriate for a particular lattice.

Returns the integer weight matrix, M, closest to lat.transpose()*lat with all elements less than max_element_value.

  • C = L*F, where L is the lattice vectors as a column matrix
  • Want r = F.transpose*M*F such that r = C.transpose*C, where F is fractional coordinates, and C is cartesian coordinates.
  • Find F.t*M*F = F.t*L.t*L*F -> W ~ L.tranpose*L
  • Approch, calculate L.tranpose*L, then divide by minimum element -> M'
  • consider integer n=1,2,...,n_last for all n such that all elements of n*M' are less than 'max_element_value'
  • return the first n*M' that is integer. If none are integer, return n_last*M'

Definition at line 183 of file NeighborList.cc.

◆ neighbor_index()

PrimNeighborList::Scalar CASM::PrimNeighborList::neighbor_index ( UnitCellCoord const &  _ucc)

Get neighborlist index of UnitCellCoord.

Parameters
_ucc,expandingneighborhood if necessary

Definition at line 124 of file NeighborList.cc.

◆ neighbor_indices()

template<typename UnitCellCoordIterator >
std::vector< PrimNeighborList::Scalar > CASM::PrimNeighborList::neighbor_indices ( UnitCellCoordIterator  _begin,
UnitCellCoordIterator  _end 
)

Get neighborlist indices of a collection of UnitCells, stored in.

Get neighborlist indices of a of UnitCells, passed by begin and end iterator.

Parameters
_uc_container

Definition at line 305 of file NeighborList.hh.

◆ size()

PrimNeighborList::size_type CASM::PrimNeighborList::size ( ) const

size of the neighborhood of unit cells

Definition at line 92 of file NeighborList.cc.

◆ sublat_indices()

const PrimNeighborList::SublatIndices & CASM::PrimNeighborList::sublat_indices ( ) const

pair of const_iterators over a range of indices of sublattices to include

const_iterator over the neighborhood of unit cells

Definition at line 117 of file NeighborList.cc.

◆ weight_matrix()

PrimNeighborList::Matrix3Type CASM::PrimNeighborList::weight_matrix ( ) const

Return the weighting matrix W used to define the canonical order.

Return the weighting matrix used to define the canonical order.

Definition at line 13 of file NeighborList.cc.

Member Data Documentation

◆ m_neighborhood

NeighborSet CASM::PrimNeighborList::m_neighborhood
private

the neighborhood of [i, j, k]

Definition at line 151 of file NeighborList.hh.

◆ m_range

Scalar CASM::PrimNeighborList::m_range
private

the neighborhood, m_neighborhood, contains all UnitCell with r <= m_range

Definition at line 155 of file NeighborList.hh.

◆ m_sublat_indices

SublatIndices CASM::PrimNeighborList::m_sublat_indices
private

the indices of sublattices that should be included

Definition at line 158 of file NeighborList.hh.

◆ m_Uinv

Eigen::MatrixXd CASM::PrimNeighborList::m_Uinv
private

Cholesky decomposition: W = U.transpose()*U, useful for getting bounding box.

Definition at line 148 of file NeighborList.hh.

◆ m_W

Matrix3Type CASM::PrimNeighborList::m_W
private

Weighting matrix.

  • The canonical order of UnitCellCoord is obtained by lexicographically sorting [r, i, j, k, b], where r = (i,j,k).transpose() * W * (i,j,k).

Definition at line 144 of file NeighborList.hh.

◆ Scalar

EIGEN_MAKE_ALIGNED_OPERATOR_NEW typedef Index CASM::PrimNeighborList::Scalar

Definition at line 43 of file NeighborList.hh.


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