ALPS Project: lattice library

Header file: lattice/coordinatelattice.h

defines a template class coordinate_lattice which adds concrete basis vectors to a lattice.

Synopsis

namespace alps {

template <class BASE = simple_lattice<>, class Vector = std::vector<double> >
class coordinate_lattice : public BASE {
public:
typedef BASE parent_lattice_type;
typedef Vector vector_type;
typedef typename lattice_traits<parent_lattice_type>::unit_cell_type unit_cell_type;
typedef typename lattice_traits<parent_lattice_type>::offset_type offset_type;
typedef typename lattice_traits<parent_lattice_type>::cell_descriptor cell_descriptor;
typedef typename std::vector<vector_type>::const_iterator basis_vector_iterator;

coordinate_lattice() {}

template <class B2,class V2> coordinate_lattice(const coordinate_lattice<B2,V2>& l);

template <class InputIterator> coordinate_lattice(const unit_cell_type& u, InputIterator first, InputIterator last);

template <class InputIterator1, class InputIterator2> coordinate_lattice(const unit_cell_type& u, InputIterator1 first1, InputIterator1 last1, InputIterator2 first2, InputIterator2 last2);

coordinate_lattice(const unit_cell_type& u);

template <class B2, class V2>
const coordinate_lattice& operator=(const coordinate_lattice<B2,V2>& l);

void set_parameters(const Parameters& p);

void add_basis_vector(const vector_type& v);
std::size_t num_basis_vectors() const;
std::pair<basis_vector_iterator,basis_vector_iterator> basis_vectors() const;

void add_reciprocal_basis_vector(const vector_type& v);
std::size_t num_reciprocal_basis_vectors() const;
std::pair<basis_vector_iterator,basis_vector_iterator> reciprocal_basis_vectors() const;
};

template <class B, class V>
struct lattice_traits<coordinate_lattice<B,V> >
{
typedef typename coordinate_lattice<B,V>::unit_cell_type unit_cell_type;
typedef typename coordinate_lattice<B,V>::cell_descriptor cell_descriptor;
typedef typename coordinate_lattice<B,V>::offset_type offset_type;
typedef typename coordinate_lattice<B,V>::vector_type vector_type;
typedef typename coordinate_lattice<B,V>::basis_vector_iterator basis_vector_iterator;
};

}

The coordinate_lattice class

describes a lattice and fulfills the CoordinateLattice requirements.

Template parameters

It takes two template arguments:

Type definitions

typedef BASE parent_lattice_type;
typedef Vector vector_type;
typedefs for the template parameters.
typedef typename lattice_traits<parent_lattice_type>::unit_cell_type unit_cell_type;
typedef typename lattice_traits<parent_lattice_type>::offset_type offset_type;
typedef typename lattice_traits<parent_lattice_type>::cell_descriptor cell_descriptor;
these types are inherited from the parent lattice.
typedef typename std::vector<vector_type>::const_iterator basis_vector_iterator;
the type for const iterators over the basis vectors

Constructors

coordinate_lattice();
does not allocate any basis vectors. Corresponds to a 0-dimensional lattice
template <class InputIterator>
coordinate_lattice(const unit_cell_type& u, InputIterator first, InputIterator last);
obtains the dimension from the unit cell u and initializes the basis vectors from the pair of iterators first and last.

Member functions

in addition to those inherited from the parent lattice:
void set_parameters(const alps::Parameters&);
sets parameters for the lattice, e.g. parammeters specifying the basis vectors.
std::size_t num_basis_vectors() const;
returns the number of basis vectors.
std::pair<basis_vector_iterator,basis_vector_iterator> basis_vectors() const;
returns a pair of const iterators giving the basis vectors.
void add_basis_vector(const vector_type& v);
adds a vector as basis vector to the coordinate lattice. This is needed only when manually constructing a coordinate_lattice, instead of using the usual ALPS construction of a lattice from an XML file.
std::size_t num_reciprocal_basis_vectors() const;
returns the number of reciprocal basis vectors of the dual lattice. This will either be the same as num_basis_vectors() or zero if no reciprocalo basis vector information is available.
std::pair<basis_vector_iterator,basis_vector_iterator> reciprocal_basis_vectors() const;
returns a pair of const iterators giving the reciprocal basis vectors.
void add_reciprocal_basis_vector(const vector_type& v);
adds a vector as reciprocal basis vector to the coordinate lattice. This is needed only when manually constructing a coordinate_lattice, instead of using the usual ALPS construction of a lattice from an XML file.

Traits class

template <class B, class V>
struct lattice_traits<coordinate_lattice<B,V> >
{
typedef typename coordinate_lattice<B,V>::unit_cell_type unit_cell_type;
typedef typename coordinate_lattice<B,V>::cell_descriptor cell_descriptor;
typedef typename coordinate_lattice<B,V>::offset_type offset_type;
typedef typename coordinate_lattice<B,V>::vector_type vector_type;
typedef typename coordinate_lattice<B,V>::basis_vector_iterator basis_vector_iterator;
};
is the traits class for 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)