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:
>>> 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')
Recommended functions
decompose_mat
to createDecomposition
of general matricesdecompose_sym
to createDecomposition
of complex symmetric matricesdecompose_her
to createUDecomposition
of Hermitian matrices
Rest are mostly legacy functions.
API
Functions
|
Construct Green's function from decomposition of its inverse. |
|
Decompose the inverse Green's function into eigenvalues and eigenvectors. |
|
Decompose the Hamiltonian matrix into eigenvalues and eigenvectors. |
|
Decompose Hermitian matrix her_mat into eigenvalues and (right) eigenvectors. |
|
Decompose matrix mat into eigenvalues and (right) eigenvectors. |
|
Decompose symmetric matrix sym_mat into eigenvalues and (right) eigenvectors. |
|
Calculate the diagonal Green's function elements for a 2x2 system. |
Classes
|
Decomposition of a matrix into eigenvalues and eigenvectors. |
|
Unitary decomposition of a matrix into eigenvalues and eigenvectors. |