triqs.mesh

Practical representations of function domains.

Meshes form the basis for the Green’s function containers in triqs.gfs: they fix the mathematical domain of the underlying function, its in-memory representation and how it is evaluated.

A mesh consists of \(N\) mesh points (see MeshPoint), and each mesh point carries:

  • a data index \(d \in \{0, \dots, N-1\}\) (a tuple of such indices for product meshes) – the position used to address the corresponding value in the underlying data array of a Green’s function;

  • a mesh-native index \(n\) whose meaning depends on the mesh – e.g. the Matsubara index \(n \in \mathbb{Z}\) for MeshImFreq, the integer triple \(\mathbf{n} \in \mathbb{Z}^3\) for MeshCycLat, or simply the index \(n = d\) for MeshImTime;

  • an optional value – e.g. Matsubara frequencies \(i\omega_n\) for MeshImFreq, real-space lattice vectors \(\mathbf{R}^{\mathbf{n}}\) for MeshCycLat, imaginary time points \(\tau_n \in [0, \beta]\) for MeshImTime.

For all C++-wrapped mesh classes, a MeshPoint can be accessed in two equivalent ways:

  • mp = mesh(n) – function-call syntax, where n is the mesh-native index.

  • mp = mesh[d] – subscript syntax, where d is the data index \(d \in \{0, \dots, N-1\}\).

Furthermore, the following useful statements hold for all meshes types:

  • for mp in mesh: ... iterates over the mesh points in data-index order,

  • len(mesh) returns the size \(N\),

  • mesh.to_index(d) / mesh.to_data_index(n) / mesh.to_value(n) perform explicit index / value conversions, and

  • mesh.values() returns an array of all mesh-point values at once.

The mesh classes wrapped from C++ live in triqs.mesh.meshes and are re-exported at the package level.

A handful of small pure-Python helpers complete the public API:

  • MeshPoint represents a single mesh point

  • MeshValueGenerator iterates over mesh points and yields their values on the fly,

  • MeshProduct represents a cartesian product of meshes for multi-variable Green’s functions, and

  • MatsubaraFreq is a stand-alone Matsubara frequency type usable outside a mesh context.

Modules

matsubara_freq

Stand-alone Matsubara frequency objects for use outside a mesh context.

mesh_point

Lightweight Python representation of a single point on a TRIQS mesh.

mesh_product

Cartesian product of TRIQS meshes for multi-variable Green's functions.

meshes

Different mesh types provided by the TRIQS library.