ALPS Project: lattice library

Header file: lattice/lattice.h

defines default implemntations for the functions asssociated with the lattice concepts

Synopsis

template <class L>
struct lattice_traits {};

template <class Lattice>
inline const typename lattice_traits<Lattice>::unit_cell_type&
unit_cell(const Lattice& l);

template <class Lattice>
inline typename lattice_traits<Lattice>::cell_descriptor
cell(const typename lattice_traits<Lattice>::offset_type& o,const Lattice& l);

template <class Lattice>
inline const typename lattice_traits<Lattice>::offset_type&
offset(const typename lattice_traits<Lattice>::cell_descriptor& c, const Lattice& );

template <class Lattice>
inline typename lattice_traits<Lattice>::size_type
volume(const Lattice& l);

template <class Lattice>
inline bool
on_lattice(typename lattice_traits<Lattice>::offset_type o, const Lattice& l);

template <class Lattice>
inline std::pair<typename lattice_traits<Lattice>::cell_iterator,
typename lattice_traits<Lattice>::cell_iterator>
cells(const Lattice& l);

template <class Lattice>
inline std::pair<bool, typename lattice_traits<Lattice>::boundary_crossing_type>
shift(typename lattice_traits<Lattice>::offset_type& o,
const typename lattice_traits<Lattice>::offset_type& s,
const Lattice& l);

template <class Lattice>
inline typename lattice_traits<Lattice>::size_type
index(typename lattice_traits<Lattice>::cell_descriptor c, const Lattice& l);

template <class Lattice>
inline std::pair<typename lattice_traits<Lattice>::basis_vector_iterator,
typename lattice_traits<Lattice>::basis_vector_iterator>
basis_vectors(const Lattice& l);

template <class Lattice>
inline std::pair<typename lattice_traits<Lattice>::basis_vector_iterator,
typename lattice_traits<Lattice>::basis_vector_iterator>
reciprocal_basis_vectors(const Lattice& l);

template <class Lattice>
inline typename lattice_traits<Lattice>::vector_type
origin(const typename lattice_traits<Lattice>::cell_descriptor& c, const Lattice& l);

template <class Lattice>
inline typename lattice_traits<Lattice>::vector_type
coordinate(const typename lattice_traits<Lattice>::cell_descriptor& c,
const typename lattice_traits<Lattice>::vector_type& p, const Lattice& l);

template <class Lattice>
inline std::pair<typename lattice_traits<Lattice>::momentum_iterator,
typename lattice_traits<Lattice>::momentum_iterator>
momenta(const Lattice& l);

template <class Lattice>
inline typename lattice_traits<Lattice>::vector_type
momentum(const typename lattice_traits<Lattice>::vector_type& m, const Lattice& l);

The traits class

template <class L>
struct lattice_traits {};
needs to be specialized for each lattice type.

The functions

are all forwarded by default to a member function of the lattice l with the same name and arguments (excpet for the last lattice argument). See the lattice concepts for more detailed description of these functions.

The only exceptions are the functions below, defined for a lattice type that is a model of CoordinateLattice.

template <class Lattice>
inline typename lattice_traits<Lattice>::vector_type
origin(const typename lattice_traits<Lattice>::cell_descriptor& c, const Lattice& l);

calculates the coordinate of the cell origin as the sum of the product of the basis vectors with the offset.

template <class Lattice>
inline typename lattice_traits<Lattice>::vector_type
coordinate(const typename lattice_traits<Lattice>::cell_descriptor& c,
const typename lattice_traits<Lattice>::vector_type& p, const Lattice& l);

adds an offset vector inside the cell (given relative to the basis vectors) to the coordinate of the origin to calculate the coordinate of a point in the cell.

template <class Lattice>
inline std::pair<typename lattice_traits<Lattice>::momentum_iterator,
typename lattice_traits<Lattice>::momentum_iterator>
momenta(const Lattice& l);

returns a pair of iterators over all reciprocal vectors (momenta) of the reciprocal lattice of a finite lattice. The value_type of the iterators are momenta with respect to the reciprocal basis vectors.

template <class Lattice>
inline typename lattice_traits<Lattice>::vector_type
momentum(const typename lattice_traits<Lattice>::vector_type& m, const Lattice& l);

takes momenta defined with respect to the reciprocal lattice vectors, such as given by dereferencing the iterators returned by the momenta function, and transforms them to momenta in reciprocal space by using the reciprocal basis vectors of the lattice.



copyright (c) 1994-2010 by Matthias Troyer

Distributed under the Boost Software License, Version 1.0. (See http://www.boost.org/LICENSE_1_0.txt)