TRIQS/TRIQS 4.0.0
Researching Interacting Quantum Systems
Loading...
Searching...
No Matches
triqs::mesh::cyclat

#include <triqs/mesh/cyclat.hpp>

Detailed Description

Cyclic lattice mesh type for Bravais lattices with Born-von Karman periodic boundary conditions.

A cyclic lattice mesh is defined by an underlying Bravais lattice and the number of unit cells in each of the three dimensions, \( N_1 \), \( N_2 \) and \( N_3 \), which define the supercell and the periodic boundary conditions (PBC) \( f(\mathbf{R}^{\mathbf{n}}) = f(\mathbf{R}^{\mathbf{n}} + \mathbf{T}^{\mathbf{m}})\). Here, \( \mathbf{T}^{\mathbf{m}} = \sum_{i=1}^3 \mathbf{a}_i N_i m_i = \tilde{\mathbf{A}} \mathbf{m} \) is a supercell translation vector, \( \mathbf{a}_i \) is a Bravais lattice basis vector in direction \( i \) and \( \mathbf{m} = (m_1, m_2, m_3) \) with \( m_i \in \mathbb{Z} \).

It has the following properties:

  • Each mesh point is identified by
    • a unique index in the supercell \( \mathbf{n} = (n_1, n_2, n_3) \), where \( 0 \leq n_i < N_i \), and
    • an infinite set of indices due to the periodic boundary conditions, i.e. \( \{ \tilde{\mathbf{n}} = \mathbf{n} + \mathbf{N} \mathbf{m} : \mathbf{N} \mathbf{m} = (N_1 m_1, N_2 m_2, N_3 m_3) \in \mathbb{Z}^3 \} \).
  • The size of the mesh is \( N = N_1 \, N_2 \, N_3 \), i.e. the total number of unit cells in the supercell.
  • An index \( \mathbf{n} \) is mapped to the corresponding data index \( d \) by the function \( d(\mathbf{n}) = n_3 + N_3 (n_2 + N_2 n_1) = n_3 + n_2 N_3 + n_1 N_2 N_3 \). The inverse map is \( \mathbf{n}(d) = (\lfloor d / s_1 \rfloor, \lfloor (d \mod s_1) / s_2 \rfloor, (d \mod s_1) \mod s_2 ) \), where \( s_1 = N_2 N_3 \) and \( s_2 = N_3 \).
  • An index \( \mathbf{n} \) is mapped to the corresponding value (lattice point) \( \mathbf{R}(\mathbf{n}) \equiv \mathbf{R}^{\mathbf{n}} = \sum_{i=1}^3 \mathbf{a}_i n_i = \mathbf{A} \mathbf{n} \), where \( \mathbf{a}_i \) is the Bravais lattice basis vectors in direction \( i \). The inverse map is then \( \mathbf{n}(\mathbf{R}^{\mathbf{n}}) = \mathbf{A}^{-1} \mathbf{R}^{\mathbf{n}} = \mathbf{n} \).

Green's function containers that are based on a cyclic lattice mesh store the function values at the discrete lattice points \( \mathbf{R}^{\mathbf{n}} \), i.e. \( f_{\mathbf{n}} = f(\mathbf{R}^{\mathbf{n}}) \). Because of the PBC, the container only has to store values for indices with \( 0 \leq n_i < N_i \). To evaluate the function at an arbitrary lattice point, it is first mapped to the supercell using the PBC and then the corresponding function value is returned.

Definition at line 88 of file cyclat.hpp.

Classes

class  mesh_point_t
 Mesh point of a triqs::mesh::cyclat mesh. More...

Public Types

using data_index_t = long
 Data index type.
using index_t = std::array<long, 3>
 Index type.
using value_t = bravais_lattice::point_t
 Value type.

Public Member Functions

 cyclat (bravais_lattice const &bl, long L)
 Construct a cyclic lattice mesh on a Bravais lattice with a cubic supercell.
 cyclat (bravais_lattice const &bl, nda::matrix< long > const &M)
 Construct a cyclic lattice mesh on a Bravais lattice with the given periodization matrix.
 cyclat (bravais_lattice const &bl, std::array< long, 3 > const &dims)
 Construct a cyclic lattice mesh on a Bravais lattice with the given supercell dimensions.
 cyclat (long L1=1, long L2=1, long L3=1)
 Construct a cyclic lattice mesh on a cubic Bravais lattice with \( a = 1 \) and the given supercell dimensions.
auto begin () const
 Get an iterator to the beginning of the mesh.
auto cbegin () const
 Get a const iterator to the beginning of the mesh.
auto cend () const
 Get a const iterator to the end of the mesh.
void deserialize (auto &ar)
 Deserialize the mesh from a generic archive.
auto const & dims () const
 Get the number of unit cells in each of the three dimensions.
auto end () const
 Get an iterator to the end of the mesh.
index_t index_modulo (index_t const &n_tilde) const
 Map an arbitrary index \( \tilde{\mathbf{n}} \) to the unique index \( \mathbf{n} \) in the supercell.
bool is_index_valid (index_t const &n) const noexcept
 Check if an index \( \mathbf{n} \) is valid, i.e. corresponds to a unit cell/lattice point in the supercell.
auto const & lattice () const noexcept
 Get the underlying Bravais lattice.
uint64_t mesh_hash () const
 Get the hash value of the mesh.
mesh_point_t operator() (index_t const &n) const
 Function call operator to access a mesh point by its index \( \mathbf{n} \).
bool operator== (cyclat const &m) const
 Equal-to comparison operator compares the underlying Bravais lattice and the number of unit cells in each of the three dimensions.
mesh_point_t operator[] (closest_mesh_point_t< value_t > const &cmp) const
 Subscript operator to access a mesh point by a lattice point \( \mathbf{R}^{\mathbf{n}} \) contained in a triqs::mesh::closest_mesh_point_t.
mesh_point_t operator[] (long d) const
 Subscript operator to access a mesh point by its data index \( d \in \{0, 1, \ldots, N-1\} \).
void serialize (auto &ar) const
 Serialize the mesh to a generic archive.
long size () const
 Get the size \( N \) of the mesh, i.e. the number of unit cells in the supercell.
data_index_t to_data_index (closest_mesh_point_t< value_t > const &cmp) const
 Map a lattice point \( \mathbf{R}^{\mathbf{n}} \) to its data index \( d(\mathbf{R}^{\mathbf{n}}) \).
data_index_t to_data_index (index_t const &n) const
 Map an index \( \mathbf{n} \) to its corresponding data index \( d(\mathbf{n}) \).
index_t to_index (closest_mesh_point_t< value_t > const &cmp) const
 Map a lattice point \( \mathbf{R}^{\mathbf{n}} \) to its index \( \mathbf{n} \).
index_t to_index (data_index_t d) const
 Map a data index \( d \in \{0, 1, \ldots, N-1\} \) to the corresponding index \( \mathbf{n}(d) \).
value_t to_value (index_t const &n) const
 Map an index \( \mathbf{n} \) to its corresponding lattice point \( \mathbf{R}^{\mathbf{n}} \).
auto units () const
 Get the matrix \( \mathbf{A}^T \) containing the basis vectors of the Bravais lattice in its rows.

Static Public Member Functions

static std::string hdf5_format ()
 Get the HDF5 format tag.

Friends

void h5_read (h5::group g, std::string const &name, cyclat &m)
 Read a triqs::mesh::cyclat mesh from HDF5.
void h5_write (h5::group g, std::string const &name, cyclat const &m)
 Write a triqs::mesh::cyclat mesh to HDF5.
std::ostream & operator<< (std::ostream &sout, cyclat const &m)
 Write a triqs::mesh::cyclat mesh to a std::ostream.

Constructor & Destructor Documentation

◆ cyclat() [1/4]

triqs::mesh::cyclat::cyclat ( bravais_lattice const & bl,
std::array< long, 3 > const & dims )
inline

Construct a cyclic lattice mesh on a Bravais lattice with the given supercell dimensions.

Parameters
blBravais lattice object representing the underlying Bravais lattice.
dimsNumber of unit cells in the supercell along each of the three dimensions, i.e. \( (N_1, N_2, N_3) \).

Definition at line 158 of file cyclat.hpp.

◆ cyclat() [2/4]

triqs::mesh::cyclat::cyclat ( bravais_lattice const & bl,
nda::matrix< long > const & M )
inline

Construct a cyclic lattice mesh on a Bravais lattice with the given periodization matrix.

Note
At the moment, only diagonal periodization matrices are supported. They should contain the number of unit cells along each of the three dimensions on the diagonal.
Parameters
bltriqs::lattice::bravais_lattice object representing the underlying Bravais lattice.
M\( 3 \times 3 \) periodization matrix.

Definition at line 179 of file cyclat.hpp.

◆ cyclat() [3/4]

triqs::mesh::cyclat::cyclat ( bravais_lattice const & bl,
long L )
inline

Construct a cyclic lattice mesh on a Bravais lattice with a cubic supercell.

Parameters
blBravais lattice object representing the underlying Bravais lattice.
LNumber of unit cells in the supercell along each of the three dimensions.

Definition at line 190 of file cyclat.hpp.

◆ cyclat() [4/4]

triqs::mesh::cyclat::cyclat ( long L1 = 1,
long L2 = 1,
long L3 = 1 )
inline

Construct a cyclic lattice mesh on a cubic Bravais lattice with \( a = 1 \) and the given supercell dimensions.

Parameters
L1Number of unit cells in the supercell along the first dimension.
L2Number of unit cells in the supercell along the second dimension.
L3Number of unit cells in the supercell along the third dimension.

Definition at line 200 of file cyclat.hpp.

Member Function Documentation

◆ deserialize()

void triqs::mesh::cyclat::deserialize ( auto & ar)
inline

Deserialize the mesh from a generic archive.

Parameters
arArchive to deserialize from.

Definition at line 363 of file cyclat.hpp.

◆ index_modulo()

index_t triqs::mesh::cyclat::index_modulo ( index_t const & n_tilde) const
inlinenodiscard

Map an arbitrary index \( \tilde{\mathbf{n}} \) to the unique index \( \mathbf{n} \) in the supercell.

Parameters
n_tildeIndex \( \tilde{\mathbf{n}} \) to map back to the supercell.
Returns
Corresponding index \( \mathbf{n} \) in the supercell such that \( \tilde{\mathbf{n}} = \mathbf{n} + \mathbf{N} \mathbf{m} \).

Definition at line 320 of file cyclat.hpp.

◆ is_index_valid()

bool triqs::mesh::cyclat::is_index_valid ( index_t const & n) const
inlinenodiscardnoexcept

Check if an index \( \mathbf{n} \) is valid, i.e. corresponds to a unit cell/lattice point in the supercell.

Parameters
nIndex \( \mathbf{n} \) to check.
Returns
True if \( 0 \leq n_i < N_i \; \forall i \), false otherwise.

Definition at line 209 of file cyclat.hpp.

◆ operator()()

mesh_point_t triqs::mesh::cyclat::operator() ( index_t const & n) const
inlinenodiscard

Function call operator to access a mesh point by its index \( \mathbf{n} \).

Parameters
nIndex \( \mathbf{n} \) of the mesh point.
Returns
mesh_point_t with the index \( \mathbf{n} \), data index \( d(\mathbf{n}) = d(\mathbf{n}) = n_3 + N_3 (n_2 + N_2 n_1) \) and the hash value and underlying Bravais lattice of the current mesh.

Definition at line 283 of file cyclat.hpp.

◆ operator[]() [1/2]

mesh_point_t triqs::mesh::cyclat::operator[] ( closest_mesh_point_t< value_t > const & cmp) const
inlinenodiscard

Subscript operator to access a mesh point by a lattice point \( \mathbf{R}^{\mathbf{n}} \) contained in a triqs::mesh::closest_mesh_point_t.

Parameters
cmptriqs::mesh::closest_mesh_point_t containing the lattice point.
Returns
mesh_point_t with the index \( \mathbf{n} \), data index \( d(\mathbf{n}) = d(\mathbf{n}) = n_3 + N_3 (n_2 + N_2 n_1) \) and the hash value and underlying Bravais lattice of the current mesh.

Definition at line 274 of file cyclat.hpp.

◆ operator[]() [2/2]

mesh_point_t triqs::mesh::cyclat::operator[] ( long d) const
inlinenodiscard

Subscript operator to access a mesh point by its data index \( d \in \{0, 1, \ldots, N-1\} \).

Parameters
dData index \( d \) of the mesh point.
Returns
mesh_point_t with the index \( \mathbf{n}(d) = (\lfloor d / s_1 \rfloor, \lfloor (d \mod s_1) / s_2 \rfloor, (d \mod s_1) \mod s_2 ) \), data index \( d \) and the hash value and underlying Bravais lattice of the current mesh.

Definition at line 264 of file cyclat.hpp.

◆ serialize()

void triqs::mesh::cyclat::serialize ( auto & ar) const
inline

Serialize the mesh to a generic archive.

Parameters
arArchive to serialize to.

Definition at line 357 of file cyclat.hpp.

◆ to_data_index() [1/2]

data_index_t triqs::mesh::cyclat::to_data_index ( closest_mesh_point_t< value_t > const & cmp) const
inlinenodiscard

Map a lattice point \( \mathbf{R}^{\mathbf{n}} \) to its data index \( d(\mathbf{R}^{\mathbf{n}}) \).

Parameters
cmptriqs::mesh::closest_mesh_point_t containing the lattice point \( \mathbf{R}^{\mathbf{n}} \).
Returns
Data index \( d(\mathbf{R}^{\mathbf{n}}) = n_3 + N_3 (n_2 + N_2 n_1) \).

Definition at line 232 of file cyclat.hpp.

◆ to_data_index() [2/2]

data_index_t triqs::mesh::cyclat::to_data_index ( index_t const & n) const
inlinenodiscard

Map an index \( \mathbf{n} \) to its corresponding data index \( d(\mathbf{n}) \).

Parameters
nIndex \( \mathbf{n} \) to map.
Returns
Data index \( d(\mathbf{n}) = n_3 + N_3 (n_2 + N_2 n_1) \).

Definition at line 221 of file cyclat.hpp.

◆ to_index() [1/2]

index_t triqs::mesh::cyclat::to_index ( closest_mesh_point_t< value_t > const & cmp) const
inlinenodiscard

Map a lattice point \( \mathbf{R}^{\mathbf{n}} \) to its index \( \mathbf{n} \).

Parameters
cmptriqs::mesh::closest_mesh_point_t containing the lattice point \( \mathbf{R}^{\mathbf{n}} \).
Returns
Index \( \mathbf{n} \).

Definition at line 254 of file cyclat.hpp.

◆ to_index() [2/2]

index_t triqs::mesh::cyclat::to_index ( data_index_t d) const
inlinenodiscard

Map a data index \( d \in \{0, 1, \ldots, N-1\} \) to the corresponding index \( \mathbf{n}(d) \).

Parameters
dData index \( d \) to map.
Returns
Index \( \mathbf{n}(d) = (\lfloor d / s_1 \rfloor, \lfloor (d \mod s_1) / s_2 \rfloor, (d \mod s_1) \mod s_2 ) \).

Definition at line 242 of file cyclat.hpp.

◆ to_value()

value_t triqs::mesh::cyclat::to_value ( index_t const & n) const
inlinenodiscard

Map an index \( \mathbf{n} \) to its corresponding lattice point \( \mathbf{R}^{\mathbf{n}} \).

Parameters
nIndex \( \mathbf{n} \) to map.
Returns
Bravais lattice point \( \mathbf{R}^{\mathbf{n}} \).

Definition at line 291 of file cyclat.hpp.

◆ h5_read

void h5_read ( h5::group g,
std::string const & name,
cyclat & m )
friend

Read a triqs::mesh::cyclat mesh from HDF5.

Parameters
gh5::group to be read from.
nameName of the subgroup.
mMesh object to be read into.

Definition at line 389 of file cyclat.hpp.

◆ h5_write

void h5_write ( h5::group g,
std::string const & name,
cyclat const & m )
friend

Write a triqs::mesh::cyclat mesh to HDF5.

Parameters
gh5::group to be written to.
nameName of the subgroup.
mMesh object to be written.

Definition at line 375 of file cyclat.hpp.

◆ operator<<

std::ostream & operator<< ( std::ostream & sout,
cyclat const & m )
friend

Write a triqs::mesh::cyclat mesh to a std::ostream.

Parameters
soutstd::ostream object.
mMesh to be written.
Returns
Reference to std::ostream object.

Definition at line 349 of file cyclat.hpp.


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