Recursive Green's Function
On this page
TwoTerminal solves a device cut into slices between two leads by the recursive Green's function: one slice at a time, with one dense inversion of the size of a slice per slice. It gives the Caroli transmission and, from two sweeps, every diagonal block of the Green's function and its columns at the two leads, which the local quantities of Keldysh need. Its cost grows as \(O(L W^3)\) for \(L\) slices of \(W\) orbitals, against \(O(L W^2)\) for nested dissection, which computes the transmissions of large samples. The recursive Green's function stays as the reference of the tests, for slice-by-slice quantities, and as the method of the thesis codes, whose results caroli reproduces with it.
The slice decomposition
TwoTerminal::from_model cuts the region along a primitive vector into slices \(n = 0, \dots, N - 1\), the sites of each cell coordinate along it (Two leads along an axis). The Hamiltonian is then block tridiagonal: \(H_{nn}\) is the Hamiltonian of slice \(n\) (slices[n]) and \(V_n = \langle n \rvert H \lvert n + 1 \rangle\) couples it to the next (couplings[n]). The model's hoppings must not reach further than the next slice along the axis. Slices may differ in size, as in a constriction; \(V_n\) is then rectangular. In a uniform field, slices and couplings are expressed in the Landau gauge invariant along the axis, as the leads are.
The left lead adds its self-energy \(\Sigma_L\) to slice 0 and the right lead \(\Sigma_R\) to slice \(N - 1\) (Lead Modes and Self-Energies). The matrix to invert at the energy \(E\) (\(z = E\) for mode matching, \(E + i\eta\) with decimation) is
$$ A = z - H - \Sigma = \begin{pmatrix} z - H_{00} - \Sigma_L & -V_0 & & \\ -V_0^{\dagger} & z - H_{11} & -V_1 & \\ & \ddots & \ddots & \ddots \\ & & -V_{N-2}^{\dagger} & z - H_{N-1,N-1} - \Sigma_R \end{pmatrix}, $$
and the transmission needs only its block \(G_{1N}\) between the first and the last slice (\(G_{0,N-1}\) in the 0-based indices of the code). The fields of TwoTerminal are public: a system can be assembled by hand from its slices, couplings and leads, as the tests do for chains. Built from a model, it also keeps the sites of each slice (regions), which the bond currents need.
Left-connected Green's functions and the transmission
Cut the system after slice \(n\) and keep slices \(0, \dots, n\) with the left lead only. Its Green's function on slice \(n\) is the left-connected Green's function \(g^L_n\). Eliminating slices \(0, \dots, n - 1\) (a Schur complement) leaves them on slice \(n\) as the self-energy \(V_{n-1}^{\dagger}\, g^L_{n-1}\, V_{n-1}\), hence the recursion
$$ g^L_0 = (z - H_{00} - \Sigma_L)^{-1}, \qquad g^L_n = \big( z - H_{nn} - V_{n-1}^{\dagger}\, g^L_{n-1}\, V_{n-1} \big)^{-1}, $$
with \(\Sigma_R\) subtracted too at \(n = N - 1\), where the system is complete. The first row follows from Dyson's equation for the slice added at each step,
$$ G_{0n} = G_{0,n-1}\, V_{n-1}\, g^L_n, \qquad G_{00} = g^L_0, $$
and at \(n = N - 1\) it is the block \(G_{1N}\) of the whole system. The transmission is the Caroli formula (The Caroli formula),
$$ T(E) = \mathrm{Tr}\,\big[\Gamma_L\, G_{1N}\, \Gamma_R\, G_{1N}^{\dagger}\big], \qquad \Gamma_{L,R} = i\,(\Sigma_{L,R} - \Sigma_{L,R}^{\dagger}). $$
TwoTerminal::solve runs this recursion and returns the self-energies and \(G_{1N}\) (EndToEnd); EndToEnd::transmission takes the trace with two products. Each slice costs one inversion (an LU with partial pivoting, solved against the identity) and four matrix products, two for \(V^{\dagger} g V\) and two for the first row. Only the current \(g^L_n\) and \(G_{0n}\) are kept. A device of one slice is a single inversion of \(z - H_{00} - \Sigma_L - \Sigma_R\).
For a chain with hopping \(-1\), the recursion gives \(T = 1\) inside the band to \(10^{-12}\), including \(E = 0\) and \(E = 10^{-9}\), and \(T = 0\) outside it. With one impurity of strength \(u\), \(T = 1/(1 + (u / 2 \sin k)^2)\) with \(E = -2 \cos k\), to \(10^{-12}\) (chain_transmission_modes, chain_impurity).
Sweeps from both ends
TwoTerminal::sweeps runs the recursion from both ends and keeps every step (Sweeps): left[n] is \(g^L_n\), here without \(\Sigma_R\) even on the last slice, and right[n] is the right-connected \(g^R_n\), the Green's function on slice \(n\) of slices \(n, \dots, N - 1\) with the right lead only:
$$ g^R_{N-1} = (z - H_{N-1,N-1} - \Sigma_R)^{-1}, \qquad g^R_n = \big( z - H_{nn} - V_n\, g^R_{n+1}\, V_n^{\dagger} \big)^{-1}. $$
Seen from slice \(n\), the left part of the system acts as the self-energy \(\Sigma^{\mathrm{left}}_n = V_{n-1}^{\dagger}\, g^L_{n-1}\, V_{n-1}\) (\(\Sigma_L\) on slice 0) and the right part as \(\Sigma^{\mathrm{right}}_n = V_n\, g^R_{n+1}\, V_n^{\dagger}\) (\(\Sigma_R\) on slice \(N - 1\)). Everything follows:
$$ G_{nn} = \big( z - H_{nn} - \Sigma^{\mathrm{left}}_n - \Sigma^{\mathrm{right}}_n \big)^{-1}, \qquad G_{n0} = g^R_n\, V_{n-1}^{\dagger}\, G_{n-1,0}, \qquad G_{n,N-1} = g^L_n\, V_n\, G_{n+1,N-1}. $$
The column recursions come from Dyson's equation across the bond between slices \(n - 1\) and \(n\) (and \(n\), \(n + 1\)): the part on the far side of the bond enters through its connected Green's function. Sweeps::diagonal gives \(G_{nn}\), first_column the column \(G_{n0}\) of every slice, starting from \(G_{00}\), and last_column the column \(G_{n,N-1}\), starting from \(G_{N-1,N-1}\). The two sweeps cost one inversion per slice each, and a column two products per slice.
These blocks are what local quantities need. The local density of states is \(-\mathrm{Im}\, G_{aa}/\pi\) on the diagonal blocks. The electrons injected by the left lead have the lesser Green's function \(G_{n0}\, \Sigma^{\lt}_L\, G_{m0}^{\dagger}\), those of the right lead \(G_{n,N-1}\, \Sigma^{\lt}_R\, G_{m,N-1}^{\dagger}\), with \(\Sigma^{\lt}_p = i f_p \Gamma_p\): caroli_keldysh::Lesser builds its diagonal blocks and its blocks between neighbouring slices from the two columns, and from them the occupations and bond currents (Keldysh).
The test sweeps_match_full_inversion takes a chain of six sites with two impurities, at \(E = 0.37\), and checks every \(G_{nn}\), \(G_{n0}\), \(G_{n,N-1}\) and \(G_{1N}\) against the direct inversion of the whole matrix, to \(10^{-12}\).
Numerical stability
Each step of the recursion inverts the Green's function of an open system: slices \(0\) to \(n\) with the left lead, or \(n\) to \(N - 1\) with the right one. At a real energy, \((z - H - \Sigma_L)\, \psi = 0\) requires \(\psi^{\dagger} \Gamma_L\, \psi = 0\) (the imaginary part of \(\psi^{\dagger}(z - H - \Sigma_L)\psi\) is \(\psi^{\dagger}\Gamma_L\psi / 2\)): a state that no open channel of the lead reaches, a bound state of the partial system at \(E\). Such states occur at isolated energies only, and elsewhere every inversion is regular. Nested dissection, in contrast, eliminates closed pieces of the sample at the real energy, which are singular at their own eigenvalues and need delayed pivots (Delayed pivots); this is also why the recursion keeps more digits in single precision. TwoTerminal does not test its inversions: at such an isolated energy it returns non-finite values.
Cost and memory
Each slice costs a few dense operations on \(W \times W\) blocks, \(O(W^3)\), and the transmission \(O(L W^3)\): \(O(n^4)\) for an \(n \times n\) sample, against \(O(n^3)\) for nested dissection. A device stored by slices holds \(2L - 1\) dense blocks of \(W^2\) complex entries; the transmission adds two blocks to it, the sweeps \(2L\). The recursion along the slices is sequential; transmissions runs the energies in parallel. It also solves the independent blocks of the cross-section separately: the two spin blocks of BHZ take a quarter of the arithmetic of the whole cross-section (Independent blocks).
On the benchmark problems, one thread on a Mac mini M4 Pro (benchmarks/results/report-2026-10-12-53d13c9.md; the recursive solver at commit 69a6eff, nested dissection at 53d13c9), per energy:
| Problem | \(W\) | Recursive | Nested dissection | Peak memory, recursive / nested |
|---|---|---|---|---|
| Square lattice, disorder \(w = 2\), \(W \times W\) | 64 | 7.3 ms | 2.6 ms | 18 MB / 15 MB |
| 128 | 67 ms | 13 ms | 81 MB / 39 MB | |
| 256 | 730 ms | 71 ms | 564 MB / 152 MB | |
| Long strip, length 2048 | 128 | 1.04 s | 0.19 s | 1118 MB / 292 MB |
| Graphene, \(W \times W\) | 256 | 5.69 s | 0.33 s | 2281 MB / 312 MB |
| BHZ (4 orbitals per site), \(W \times W\) | 256 | 12.9 s | 3.21 s | 12456 MB / 808 MB |
From \(W = 128\) to \(256\) on the square lattice, the recursive time grows elevenfold and the nested one fivefold; the asymptotic ratios are 16 and 8. The memory of the recursive solver is mostly the device stored as dense slices.
What it serves for
- The reference. Every nested-dissection test of two-terminal systems compares with it, to \(10^{-9}(1 + T)\): clean and disordered square lattices (with \(E = 0\), where blocks of the clean lattice are singular), BHZ, graphene, a constriction, a strip of length 80, devices of one to three slices, cubic samples, bond disorder and quantum Hall ribbons in a field. Measured on the square and BHZ samples, the two agree to \(1.2 \cdot 10^{-14}\) and \(2.0 \cdot 10^{-14}\) (28 November 2026, on Linux with faer's kernels).
- Slice-by-slice quantities, through
Sweeps: the recursive lesser Green's function ofcaroli-keldysh, with which the local currents and densities of the thesis are reproduced, and against which the scattering states of nested dissection are checked (to \(10^{-10}\), Scattering states). - The choice of the lead method (
SelfEnergyMethod), and with it the thesis formula below. - Reduced precision. In single precision the recursion is more accurate than nested dissection (largest error \(2.5 \cdot 10^{-2}\) at \(W = 128\) against \(6.2 \cdot 10^{-2}\), Precision), but its cost is not worth it, and it is not offered.
The thesis formula
The thesis codes computed conductances with the recursive Green's function too, in a form that differs from caroli's in three points:
- the lead self-energies were computed at \(E + i\eta\) (\(\eta = 10^{-5}\) in their inputs) by a generalised Schur decomposition, the device staying at the real energy (the four-terminal code puts \(E + i\eta\) on its last recursion slice as well);
- the sample had one clean lead slice at each end;
- the broadenings were truncated to their real part, entry by entry: \(\Gamma_p \to \mathrm{Re}\,\Gamma_p\), and \(T = \mathrm{Tr}\,[\mathrm{Re}\,\Gamma_L\, G_{1N}\, \mathrm{Re}\,\Gamma_R\, G_{1N}^{\dagger}]\).
The truncation is an error. \(\Gamma\) is Hermitian, so its real part is symmetric and its imaginary part antisymmetric, and the entry-wise real part \((\Gamma + \bar\Gamma)/2\) is the average of the broadening and of its complex conjugate, the broadening of the lead with every hopping conjugated. The two coincide only when the lead Hamiltonian is real. The BHZ model is not: the hoppings of its \(A\) term are complex. The truncated broadening then belongs to no lead, and the transmission of a clean ribbon is no longer an integer.
SelfEnergyMethod::ModesBroadened { eta } solves the leads as the thesis did, by mode matching at \(E + i\eta\), with the device at the real energy. The validation crate (not published) applies the truncation to the solution of TwoTerminal::solve, or to that of MultiTerminal::solve for four terminals, with the thesis's impurity configurations drawn from a gfortran-compatible random stream (Validation). caroli's own transmission keeps the whole broadening. Against the golden outputs of the thesis codes (the validation tests print these numbers; measured on 28 November 2026, on Linux with faer's kernels):
| Golden case | System | Thesis formula against the golden values | caroli's transmission against the golden values |
|---|---|---|---|
ti-cond2t-clean | Clean BHZ ribbon 16 × 10, 13 energies | Not compared | Within 0.025, caroli giving integers to \(10^{-8}\); the thesis's values lie between 1.988 and 2.012 around the plateau of 2 |
ti-cond2t-same-g | BHZ ribbon, magnetic impurities along \(z\), same-g | \(6.3 \cdot 10^{-14}\) | Up to 0.22 |
ti-cond2t-isotropic | The same with isotropic moments | \(4.4 \cdot 10^{-14}\) | Up to 0.20 |
ti-cond2t-opposite-g | The same with opposite-g coupling | \(6.4 \cdot 10^{-14}\) | Up to 0.14 |
ti-cond4t-anderson | Four-terminal \(8 \times 8\) cross, Anderson disorder, spin-up block | \(2.6 \cdot 10^{-5}\) | Up to 0.70 |
The tests assert \(10^{-9}\) for the two-terminal cases and \(10^{-4}\) for the four-terminal one, whose difference comes from the \(E + i\eta\) on one slice of the thesis code. The magnetic cases are ribbons only 10 sites wide; at the width of 64 sites of the thesis production runs, the truncation changes the averaged conductance maps by less than \(10^{-3}\) (caroli-validation/examples/gamma_impact.rs).
In the code
Crate caroli-green:
| Item | What |
|---|---|
TwoTerminal | Slices, couplings, leads; solve (the recursion for \(G_{1N}\)), transmission, transmission_with, transmissions, sweeps, self_energies |
EndToEnd | \(\Sigma_L\), \(\Sigma_R\) and \(G_{1N}\); transmission |
Sweeps | \(g^L_n\), \(g^R_n\); diagonal, first_column, last_column |
SelfEnergyMethod | Modes, ModesBroadened { eta }, Decimation { eta } |
Lesser (caroli-keldysh) | The lesser Green's function from the two columns of Sweeps |
References
- D. J. Thouless, S. Kirkpatrick, Conductivity of the disordered linear chain, J. Phys. C: Solid State Phys. 14, 235 (1981).
- P. A. Lee, D. S. Fisher, Anderson localization in two dimensions, Phys. Rev. Lett. 47, 882 (1981).
- A. MacKinnon, The calculation of transport properties and density of states of disordered solids, Z. Phys. B 59, 385 (1985).
- C. H. Lewenkopf, E. R. Mucciolo, The recursive Green's function method for graphene, J. Comput. Electron. 12, 203 (2013).
- C. Caroli, R. Combescot, P. Nozières, D. Saint-James, Direct calculation of the tunneling current, J. Phys. C: Solid State Phys. 4, 916 (1971).