ALPS Project: lattice library

Lattice Concepts

A lattice is built from cells, created by translating a unit cell an integral number of times along any of the basis vectors. See the corresponding discussion in the documentation of the lattice XML schema on http://xml.comp-phys.org/.

A lattice graph can similarly be constructed by taking a graph on a unit cell and copying it to all the cells in the lattice, which will be discussed later.

Here we will present the concepts related to lattices:

UnitCell

is Dimensional, and describes the unit cell from which a lattice is built. It is possible to construct a lattice just from a unit cell and the basis vectors.

For more information see the documentation of the lattice XML schema on http://xml.comp-phys.org/.

Example Implementation

see in the file unitcell.h

Cell

is a refinement of Dimensional and describes a translated unit cell, one building block of a lattice.

For more information see the documentation of the lattice XML schema on http://xml.comp-phys.org/.

Accessing cell properties could be added similar to accessing vertex properties in the BGL.

Notation

Ca type that is a model of Cell

Associated Types

lattice::cell_traits<C>::offset_type

a type modelling the concept Vector with usually integral value_type. It can store the number of translations along each of the basis vectors needed to reach a cell from the unit cell at the origin.

Expressions

see below under the Lattice concept.

Cell properties

it could be useful to have cell properties like the vertex and edge properties of the Boost Graph Library.

Example Implementation: cell_traits.h

The default implementation of the traits class in the file cell_traits.h assumes that the type C has a corresponding type member:
namespace alps {

  template <class C>
  struct cell_traits 
  {
    typedef typename C::offset_type offset_type;
  };

}
For a reference implementation of a cell see simplecell.h.

Lattice

is a refinement of Dimensional. It describes a (finite) dimensional lattice. It is built from cells created by a translation of a unit cell by integer multiples of the basis vectors. For more information see the documentation of the lattice XML schema on http://xml.comp-phys.org/.

Notation

La type that is a model of Lattice
Cthe type lattice::lattice_traits<L>::cell_descriptor
a type that is a model of Cell
lan object of type L
can object of type lattice::lattice_traits<L>::cell_descriptor
oan object of type lattice::cell_traits<C>::offset_type

Associated Types

lattice::lattice_traits<L>::unit_cell_type

a model of UnitCell
lattice::lattice_traits<L>::cell_descriptor

a model of Cell
lattice::lattice_traits<L>::offset_type
same as
lattice::cell_traits<typename lattice::lattice_traits<L>::cell_descriptor>::offset_type
a type modelling the concept Vector with usually integral value_type. It can store the number of translations along the basis vectors needed to reach a cell from the unit cell at the origin.

Expressions

lattice::unit_cell(l) return type lattice::lattice_traits<L>::unit_cell_type
the unit cell of the lattice.
lattice::cell(o,l) return type lattice::lattice_traits<L>::cell_descriptor
the cell arrived at by translating the unit cell along o times the basis vectors.
lattice::offset(c,l) return type lattice_traits<L>::cell_descriptor
returns the offset by which the unit cell must be translated to arrive at cell c
Invariant: lattice::offset(lattice::cell(o,l),l) == o

Example Implementation

For a default implementation of the functions see lattice.h.

For a reference implementation of a simple lattice see simplelattice.h.

CoordinateLattice

is a refinement of Lattice andmakes sense only for finite dimensional lattices. It provides basis vectors as models of CoordinateVector.

Notation

La type that is a model of CoordinateLattice
lan object of type L
can object of type lattice::lattice_traits<L>::cell_descriptor

Associated Types

lattice::lattice_traits<L>::vector_type

a type modelling the concept CoordinateVector. It can store a basis vector of the lattice.
lattice::lattice_traits<L>::basis_vector_iterator

a const iterator type to iterate through the basis vectors the value_type of the iterator is const lattice::coordinatelattice_traits<L>::vector_type

Expressions

lattice::basis_vectors(l) return type is std::pair<
typename lattice::lattice_traits<L>::basis_vector_iterator,
typename lattice::lattice_traits<L>::basis_vector_iterator>

the first entry points to the first basis vector, the second entry one past the last basis vector.
lattice::origin(c,l) return type lattice::lattice_traits<L>::vector_type
the coordinates of the cell. This can be calculated by adding up the basis vectors multiplied by the corresponding entry in the cell offset

Example Implementation

For a default implementation of the functions see lattice.h.

For a reference implementation see coordinatelattice.h.

FiniteLattice

is a refinement of Lattice. It describes a finite set of cells cut out from an infinite lattice. Boundary conditions can specify neighbor relations of cells on the boundary of the finite lattice.

For more information see the documentation of the lattice XML schema on http://xml.comp-phys.org/.

Notation

La type that is a model of FiniteLattice
Cthe type lattice::lattice_traits<L>::cell_descriptor
a type that is a model of Cell
lan object of type L
can object of type lattice::lattice_traits<L>::cell_descriptor
o, sobjects of type lattice::cell_traits<C>::offset_type
ian object of type lattice::lattice_traits<C>::size_type

Associated types

lattice::lattice_traits<L>::cell_iterator

the type of iterators over cells in the FiniteLattice
lattice::lattice_traits<L>::size_type

an integral type large enough to represent the number of cells in the lattice
lattice::lattice_traits<L>::boundary_crossing_type

a property type to describe whether shifting a cellmoved it across a boundary of a periodic lattice.

Expressions

lattice::volume(l) return type lattice::lattice_traits<L>::size_type
the number of cells in the lattice.
lattice::on_lattice(o,l) return type bool specifies whether the cell with given offset is on the (finite) lattice.
lattice::cell(o,l) same as for Lattice, except that result is unspecified if lattice::on_lattice(l,o)==false and the cell is not on the lattice
lattice::shift(o,s,l) return type std::pair<bool,lattice::lattice_traits<L>::boundary_crossing_type> >. shifts the offset o by the vector s, taking into account boundary conditions of the lattice.
If the shifted offset is on the lattice the first part of the value is true and o contains the shifted offset. Otherwise the return value is false and the value of o undefined.
On an infinite lattice this would be equivalent to o = o + s.
The second argument specifies which boundaries of a periodic lattice were crossed in which directions, if the resulting cell was actually on the lattice.
lattice::index(c,l) return type lattice::lattice_traits<L>::size_type
the index of the cell, 0 <= lattice::index(l,c) < lattice::volume(l)
lattice::cells(l) return type std::pair<typename lattice::lattice_traits<L>::cell_iterator, typename lattice::lattice_traits<L>::cell_iterator>
returns a pair of iterators over all the cells in the lattice, the first iterator points to the first cell in the lattice, the second iterator one past the last cell.

Example Implementation

For a default implementation of the functions see lattice.h.

For a reference implementation of a hypercubic lattice see hypercubic.h.

Remarks

Other useful expressions that could be added include functions like lattice::neighbors(l,c), to return iterators over neighboring cells, etc. This is useful, however duplicates some of the functionality of the Boost Graph Library. The same functionality could be added by decorating the lattice with a graph having one vertex per cell an edges between all neighboring cells.

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)