dyson.expressions#
Expressions for constructing Green’s functions and self-energies.
Subclasses of BaseExpression expose various methods which
provide different representations of the self-energy or Green’s function for the given level of
theory. The Green’s function is related to the resolvent
where \(\mathbf{H}\) is the Hamiltonian, and in the presence of correlation, takes the form of a self-energy supermatrix
which possesses its own Lehmann representation. For more details on these representations, see the
representations module.
The BaseExpression interface provides a
from_mf() constructor to create an expression of
that level of theory from a mean-field object
>>> from dyson import util, quiet, FCI
>>> quiet() # Suppress output
>>> mf = util.get_mean_field("H 0 0 0; H 0 0 1", "6-31g")
>>> fci = FCI.h.from_mf(mf)
The BaseExpression interface provides methods to compute the
matrix-vector operations and diagonal of the self-energy supermatrix
>>> import numpy as np
>>> ham = fci.build_matrix()
>>> np.allclose(np.diag(ham), fci.diagonal())
True
>>> vec = np.random.random(fci.shape[0])
>>> np.allclose(fci.apply_hamiltonian(vec), ham @ vec)
True
More precisely, the Green’s function requires also the excitation operators to connect to the ground state
which may be a simple projection when the ground state is mean-field, or otherwise in the case of correlated ground states. The interface can provide these vectors
>>> bra = fci.get_excitation_bras()
>>> ket = fci.get_excitation_kets()
which are vectors with shape (nphys, nconfig) where nphys is the number of physical states.
These methods can be used to construct the moments of the Green’s function
which are important for some of the novel approaches implemented in dyson. In the case of
some levels of theory, analytic expressions for the moments of the self-energy are also available.
These moments can be calculated using
>>> gf_moments = fci.build_gf_moments(nmom=6)
A list of available expressions is provided in the documentation of dyson. Each expression
is an instance of ExpressionCollection, which provides the
subclasses of BaseExpression for various sectors such as the
hole and particle.