gftool.matrix

Functions to work with Green’s functions in matrix from.

A main use case of this library is the calculation of the Green’s function as the resolvent of the Hermitian or from Dyson equation. Instead of calculating the inverse for every frequency/k-point it is oftentimes more efficient, to calculate an eigendecomposition once.

For example, let us calculate the Green’s function for 1D tight-binding chain using:

\[G(z) = [1z - H]^{-1} = [1z - UλU^†]^{-1} = U [z-λ]^{-1} U^†\]
>>> N = 51  # system size
>>> t = 1   # hopping amplitude
>>> hamilton = np.zeros((N, N))
>>> row, col = np.diag_indices(N)
>>> hamilton[row[:-1], col[1:]] = hamilton[row[1:], col[:-1]] = -t
>>> ww = np.linspace(-2.5, 2.5, num=201) + 1e-1j
>>> dec = gt.matrix.decompose_her(hamilton)
>>> gf_ww = dec.reconstruct(eig=1.0/(ww[:, np.newaxis] - dec.eig))

Let’s check that it agrees with the inversion:

>>> gf_inv = np.linalg.inv(np.eye(N)*ww[0] - hamilton)
>>> np.allclose(gf_ww[0], gf_inv)
True

If we only need the diagonal (local) elements, we can calculate them using:

>>> gf_ww = dec.reconstruct(eig=1.0/(ww[:, np.newaxis] - dec.eig), kind='diag')

API

Functions

construct_gf(rv, diag_inv, rv_inv)

Construct Green’s function from decomposition of its inverse.

decompose_gf(g_inv)

Decompose the inverse Green’s function into eigenvalues and eigenvectors.

decompose_hamiltonian(hamilton)

Decompose the Hamiltonian matrix into eigenvalues and eigenvectors.

decompose_her(her_mat[, check])

Decompose Hermitian matrix her_mat into eigenvalues and (right) eigenvectors.

decompose_mat(mat)

Decompose matrix mat into eigenvalues and (right) eigenvectors.

decompose_sym(sym_mat[, check])

Decompose symmetric matrix sym_mat into eigenvalues and (right) eigenvectors.

gf_2x2_z(z, eps0, eps1, hopping[, hilbert_trafo])

Calculate the diagonal Green’s function elements for a 2x2 system.

Classes

Decomposition(rv, eig, rv_inv)

Decomposition of a matrix into eigenvalues and eigenvectors.

UDecomposition(rv, eig, rv_inv)

Unitary decomposition of a matrix into eigenvalues and eigenvectors.