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\) forMeshCycLat, or simply the index \(n = d\) forMeshImTime;an optional value – e.g. Matsubara frequencies \(i\omega_n\) for
MeshImFreq, real-space lattice vectors \(\mathbf{R}^{\mathbf{n}}\) forMeshCycLat, imaginary time points \(\tau_n \in [0, \beta]\) forMeshImTime.
For all C++-wrapped mesh classes, a MeshPoint
can be accessed in two equivalent ways:
mp = mesh(n)– function-call syntax, wherenis the mesh-native index.mp = mesh[d]– subscript syntax, wheredis 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, andmesh.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:
MeshPointrepresents a single mesh pointMeshValueGeneratoriterates over mesh points and yields their values on the fly,MeshProductrepresents a cartesian product of meshes for multi-variable Green’s functions, andMatsubaraFreqis a stand-alone Matsubara frequency type usable outside a mesh context.
Modules
Stand-alone Matsubara frequency objects for use outside a mesh context. |
|
Lightweight Python representation of a single point on a TRIQS mesh. |
|
Cartesian product of TRIQS meshes for multi-variable Green's functions. |
|
Different mesh types provided by the TRIQS library. |