|
TRIQS/TRIQS 4.0.0
Researching Interacting Quantum Systems
|
The gf class is the central container of TRIQS. A Green's function gf<Mesh, Target> couples a mesh (the domain — real or imaginary time, real or imaginary frequency, Legendre, DLR, Brillouin zone, ...) with a target (the value at each mesh point — a scalar, a matrix, or a higher-rank tensor). The same container therefore represents \(G(\tau)\), \(G(i\omega_n)\), \(G(t)\), \(G(\omega)\), ... with a uniform interface.
The examples below show how to construct these objects, fill them, and evaluate them. Each section is a self-contained main() whose source lives in doc/doxygen/examples/ and is compiled by doc/doxygen/examples/CMakeLists.txt, so the snippets cannot drift out of sync with the library.
For the equivalent Python usage, see the Python user guide and the triqs.gfs API documentation.
A single-variable Matsubara Green's function lives on a mesh::imfreq (fermionic or bosonic). Here we construct \(G(i\omega) = \frac{1}{i\omega - 3}\) by filling it from a placeholder expression and then read back a value. The mesh, target shape and statistic are fixed at construction.
Output:
Green's functions can also depend on several arguments. The next example builds a two-frequency object \(G(i\omega, i\nu) = \frac{1}{i\omega + i\nu - 4}\) on a product of two Matsubara meshes, illustrating how gf generalizes to multi-variable domains.
Output:
The imaginary-time counterpart \(G(\tau)\) lives on a mesh::imtime. The construction mirrors the Matsubara case — only the mesh type changes — which is the whole point of the generic gf container.
A real-time Green's function \(G(t)\) is defined on a mesh::retime spanning [t_min, t_max]. The target determines the value stored at each time. For a scalar-valued \(G(t)\):
For a matrix-valued target of size n x m (e.g. a multi-orbital propagator):
The target can have any rank — here a three-index tensor:
Just like the two-frequency example above, a real-time object can depend on two times \(G(t, t')\) by using a product mesh:
TRIQS Green's functions integrate with the CLEF placeholder mini-language: assigning a lazy expression in a placeholder fills every mesh point without writing an explicit loop. This is the idiomatic way to initialize a gf from a closed-form expression.
Calling a Green's function with parentheses evaluates it at an arbitrary point of its domain using the interpolation rule the mesh declares (linear in imaginary time, exact in Matsubara, etc.) — as opposed to bracket access [], which looks up an existing mesh point.
Output: