Download Mathematica notebook · Manual, chapter 10
Start a fresh Mathematica kernel with SNEG installed. Evaluate the cells in order.
Needs["sneg`"]
Build the atomic Hamiltonian with a level energy measured relative to the chemical potential.
Needs["sneg`"];
snegfermionoperators[c, d];
snegrealconstants[t, U, ϵ];
atom = ϵ number[d[]] + U hubbard[d[]];
{number[d[]], hubbard[d[]]}
![{Subsuperscript[d, \[DownArrow], \[Dagger]]\[CenterDot]Subsuperscript[d, \[DownArrow], ]+Subsuperscript[d, \[UpArrow], \[Dagger]]\[CenterDot]Subsuperscript[d, \[UpArrow], ],-(Subsuperscript[d, \[DownArrow], \[Dagger]]\[CenterDot]Subsuperscript[d, \[UpArrow], \[Dagger]]\[CenterDot]Subsuperscript[d, \[DownArrow], ]\[CenterDot]Subsuperscript[d, \[UpArrow], ])}](output-1.png)
The opposite-spin occupation assigns weights to the two addition energies. Keep it symbolic.
gatom = greensfunction[d[AN, UP], d[CR, UP], atom, z];
g = gatom /. avg[number[d[], DO]] -> w;
Apart[g, z]
![(1-w)/(z-\[Epsilon])+w/(-U+z-\[Epsilon])](output-2.png)
At particle-hole symmetry the two poles have equal weight. Check the high-frequency normalization.
ph = Factor[g /. {ϵ -> -U/2, w -> 1/2}];
{ph, Limit[z ph, z -> Infinity]}

Move away from symmetry and calculate the transition energies and thermal weights independently by a Lehmann sum.
asym = atom /. {ϵ -> -1/4, U -> 2};
poles = lehmann[d[AN, UP], d[CR, UP], asym, {d}, 1/2];
TableForm[N[Round[poles, 1/1000]], TableHeadings -> {None, {"Frequency", "Residue"}}]

At a complex test frequency compare the Lehmann result with the equation of motion using the exact thermal occupation.
wth = thermalaverage[number[d[], DO], asym, {d}, 1/2];
z0 = 1/3 + I/4;
gtrace = Total[poles[[All, 2]]/(z0 - poles[[All, 1]])];
{Abs[1 - Total[poles[[All, 2]]]] < 10^-12,
Abs[gtrace - (g /. {z -> z0, ϵ -> -1/4, U -> 2, w -> wth})] < 10^-12}
