Impurity Solver Tutorial

This tutorial goes through using the Hartree-Fock ImpuritySolver for a simple one band case. We start by importing the required modules:

[1]:
import numpy as np
from triqs.gf import *
from triqs.operators import *
from h5 import HDFArchive
from triqs_hartree_fock import ImpuritySolver
from triqs.plot.mpl_interface import oplot
Warning: could not identify MPI environment!
Starting serial run at: 2022-05-02 14:09:51.982050

Next we define G0, h_int, and the parameters that we will pass to the solver

[2]:
beta = 40
n_iw = 1025

g0 = GfImFreq(beta=40, n_points=1025, target_shape=[1,1])
g0 << inverse(iOmega_n + 2)
G0 = BlockGf(name_list=['up', 'down'], block_list=[g0, g0], make_copies=True)

h_int = 3*n('up', 0)*n('down', 0)

gf_struct = [('up', 1), ('down', 1)]

Now we are ready to initialize the solver:

[3]:
S = ImpuritySolver(gf_struct=gf_struct, beta=beta, n_iw=n_iw)

Next we pass G0 to the solver:

[4]:
S.G0_iw << G0
[4]:
Green Function G composed of 2 blocks:
 Greens Function G_up with mesh Matsubara Freq Mesh of size 2050, Domain: Matsubara domain with beta = 40, statistic = 1, positive_only : 0 and target_rank 2:

 Greens Function G_down with mesh Matsubara Freq Mesh of size 2050, Domain: Matsubara domain with beta = 40, statistic = 1, positive_only : 0 and target_rank 2:

Finally, we are ready to call the solve method. By default with_fock is True but can be turned to False to only include Hartree terms.

[5]:
S.solve(h_int=h_int, with_fock=True)

╔╦╗╦═╗╦╔═╗ ╔═╗  ┬ ┬┌─┐
 ║ ╠╦╝║║═╬╗╚═╗  ├─┤├┤
 ╩ ╩╚═╩╚═╝╚╚═╝  ┴ ┴└
TRIQS: Hartree-Fock solver

Running Impurity Solver
beta = 40.0000
h_int =
3*c_dag('down',0)*c_dag('up',0)*c('up',0)*c('down',0)
mode: self-consistent
Including Fock terms:
True
Self Consistent Hartree-Fock converged successfully
Calculated self energy:
Sigma_HF['up']:
[[1.9833+0.j]]
Sigma_HF['down']:
[[1.9833+0.j]]