-
Notifications
You must be signed in to change notification settings - Fork 83
Description
Continuing my attempt to extend DLR for everything, if you construct a hybridization
WARNING: max(abs(imag(S.Delta_tau[0][0, 0]))) = 1.82808e-10 setting to zero.
Feeding this into a full DMFT loop eventually leads to errors such as (S.G0_iw violates fundamental Green Function property G0(iw)[i,j] = G0(-iw)*[j,i] ) and the code eventually crashing.
Attempting at least the simplest tail-fitting (taken from here for example) does not alleviate this problem.
I believe this is a core TRIQS issue rather than a CTHYB issue, but I'm not sure the best place for the solution. Perhaps there is just some hermiticity / fitting post-processing that should be added to the function make_gf_imfreq ?
from triqs.gf import *
import numpy as np
from triqs.operators import *
from triqs_cthyb import Solver
class IPTSolver:
def __init__(self, beta):
self.beta = beta
# Matsubara frequency Green's functions
iw_mesh = MeshDLRImFreq(beta=beta, statistic='Fermion', w_max= 10, eps =10e-10, symmetrize = True)
self.G_iw = BlockGf(mesh=iw_mesh, gf_struct = [('up',1), ('down',1)] )
self.G0_iw = self.G_iw.copy() # self.G0 will be set by the user after initialization
self.Sigma_iw = self.G_iw.copy()
# Imaginary time
tau_mesh = MeshDLRImTime(beta=beta, statistic='Fermion', w_max= 10, eps =10e-10, symmetrize = True)
self.G0_tau = BlockGf(mesh=tau_mesh, gf_struct = [('up',1), ('down',1)] )
self.G_tau = self.G0_tau.copy()
self.Sigma_tau = self.G0_tau.copy()
def solve(self, U):
self.G0_tau << make_gf_dlr_imtime(self.G0_iw)
self.Sigma_tau << (U**2) * self.G0_tau * self.G0_tau * self.G0_tau
self.Sigma_iw << make_gf_dlr_imfreq(self.Sigma_tau)
# Dyson
self.G_iw << inverse(inverse(self.G0_iw) - self.Sigma_iw)
t = 1.0
U = 5.0
beta = 20
n_iw = 2**12+3
w_max= 10
dlr_error =10e-10
S = IPTSolver(beta = beta)
S.G_iw << SemiCircular(2*t)
S_CTHYB = Solver(beta = beta, gf_struct = [('up',1), ('down',1)] , n_iw = n_iw)
#n_loops = 1
#for i in range(n_loops):
for block, g in S.G_iw:
S.G0_iw[block] << inverse( iOmega_n + U/2.0 - t**2 * g)
for block, g0 in S.G0_iw:
S_CTHYB.G0_iw[block] = make_gf_imfreq(S.G0_iw[block], n_iw = n_iw)
S_CTHYB.solve(h_int = U * n('up',0) * n('down',0), # Local Hamiltonian
n_cycles = 50000, # Number of QMC cycles
n_warmup_cycles = 5000, # Warmup cycles
)`