def pade_tr(blockgf_iw, pade_n_omega_n, pade_eta, dos_n_points, dos_window, clip_threshold=0, n_points=1200): g_iw = blockgf_iw indices = [ind for ind in g_iw.indices] tr_g = GfImFreq(indices = [0], mesh = g_iw[indices[0]].mesh) for s, b in g_iw: for i in range(len(b.data[0, :, :])): tr_g << tr_g + b[i, i] tr_g_lat_pade = GfReFreq(indices = [0], window = dos_window, n_points = dos_n_points, name = 'Tr$G_{lat}$') tr_g_lat_pade.set_from_pade(clip_g(tr_g, clip_threshold), n_points = pade_n_omega_n, freq_offset = pade_eta) return tr_g_lat_pade
from pytriqs.gf.local import GfReFreq, Omega, Wilson, inverse import numpy eps_d,t = 0.3, 0.2 # Create the real-frequency Green's function and initialize it g = GfReFreq(indices = ['s','d'], window = (-2, 2), n_points = 1000, name = "$G_\mathrm{s+d}$") g['d','d'] = Omega - eps_d g['d','s'] = t g['s','d'] = t g['s','s'] = inverse( Wilson(1.0) ) g.invert() # Plot it with matplotlib. 'S' means: spectral function ( -1/pi Imag (g) ) from pytriqs.plot.mpl_interface import oplot oplot( g['d','d'], '-o', RI = 'S', x_window = (-1.8,1.8), name = "Impurity" ) oplot( g['s','s'], '-x', RI = 'S', x_window = (-1.8,1.8), name = "Bath" )
L = 10 # Number of Matsubara frequencies used in the Pade approximation eta = 0.01 # Imaginary frequency shift ## Test Green's functions ## # Two Lorentzians def GLorentz(z): return 0.7/(z-2.6+0.3*1j) + 0.3/(z+3.4+0.1*1j) # Semicircle def GSC(z): return 2.0*(z + sqrt(1-z**2)*(log(1-z) - log(-1+z))/pi) # A superposition of GLorentz(z) and GSC(z) with equal weights def G(z): return 0.5*GLorentz(z) + 0.5*GSC(z) # Matsubara GF gm = GfImFreq(indices = [0], beta = beta, name = "gm") gm << Function(G) gm.tail.zero() gm.tail[1] = array([[1.0]]) # Analytic continuation of gm g_pade = GfReFreq(indices = [0], window = (-5.995, 5.995), n_points = 1200, name = "g_pade") g_pade.set_from_pade(gm, n_points = L, freq_offset = eta) from pytriqs.archive import HDFArchive R = HDFArchive('pade.output.h5','w') R['g_pade'] = g_pade
from pytriqs.gf.local import GfReFreq, Omega, Wilson, inverse import numpy eps_d,t = 0.3, 0.2 # Create the real-frequency Green's function and initialize it g = GfReFreq(indices = ['s','d'], window = (-2, 2), n_points = 1000, name = "$G_\mathrm{s+d}$") g['d','d'] = Omega - eps_d g['d','s'] = t g['s','d'] = t g['s','s'] = inverse( Wilson(1.0) ) g.invert() # Plot it with matplotlib. 'S' means: spectral function ( -1/pi Imag (g) ) from pytriqs.plot.mpl_interface import * oplot( g['d','d'], '-o', RI = 'S', x_window = (-1.8,1.8), name = "Impurity" ) oplot( g['s','s'], '-x', RI = 'S', x_window = (-1.8,1.8), name = "Bath" ) plt.show()
def GLorentz(z): return 0.7 / (z - 2.6 + 0.3 * 1j) + 0.3 / (z + 3.4 + 0.1 * 1j) # Semicircle def GSC(z): return 2.0 * (z + sqrt(1 - z**2) * (log(1 - z) - log(-1 + z)) / pi) # A superposition of GLorentz(z) and GSC(z) with equal weights def G(z): return 0.5 * GLorentz(z) + 0.5 * GSC(z) # Matsubara GF gm = GfImFreq(indices=[0], beta=beta, name="gm") gm << Function(G) gm.tail.zero() gm.tail[1] = array([[1.0]]) # Analytic continuation of gm g_pade = GfReFreq(indices=[0], window=(-5.995, 5.995), n_points=1200, name="g_pade") g_pade.set_from_pade(gm, n_points=L, freq_offset=eta) from pytriqs.archive import HDFArchive R = HDFArchive('pade.output.h5', 'w') R['g_pade'] = g_pade
def pade_spin(blockgf_iw, spin, pade_n_omega_n, pade_eta, dos_n_points, dos_window, clip_threshold=0, n_points=1200): g_iw = blockgf_iw[spin] indices = g_iw.indices g_pade = GfReFreq(indices = indices, window = dos_window, n_points = dos_n_points, name = 'Tr$G_{lat}$') g_pade.set_from_pade(g_iw, n_points = pade_n_omega_n, freq_offset = pade_eta) return g_pade
from pytriqs.gf.local import GfReFreq, Omega, Wilson, inverse import numpy eps_d,V = 0.3, 0.2 # Create the real-frequency Green's function and initialize it g = GfReFreq(indices = ['s','d'], window = (-2, 2), n_points = 1000, name = "s+d") g['d','d'] = Omega - eps_d g['d','s'] = V g['s','d'] = V g['s','s'] = inverse( Wilson(1.0) ) g.invert() # Plot it with matplotlib. 'S' means: spectral function ( -1/pi Imag (g) ) from pytriqs.plot.mpl_interface import oplot oplot( g['d','d'], '-o', RI = 'S', x_window = (-1.8,1.8), name = "Impurity" ) oplot( g['s','s'], '-x', RI = 'S', x_window = (-1.8,1.8), name = "Bath" )
from pytriqs.gf.local import GfReFreq from pytriqs.gf.local.descriptors import SemiCircular from pytriqs.archive import HDFArchive import numpy R = HDFArchive('myfile.h5', 'w') for D in range(1, 10, 2): g = GfReFreq(indices=[0], window=(-2.00, 2.00), name="D=%s" % D) g << SemiCircular(half_bandwidth=0.1 * D) R[g.name] = g
import numpy as np from pytriqs.gf.local import GfReFreq, SemiCircular g = GfReFreq(indices=['eg1', 'eg2'], window=(-5, 5), n_points=1000, name="egBlock") g['eg1', 'eg1'] = SemiCircular(half_bandwidth=1) g['eg2', 'eg2'] = SemiCircular(half_bandwidth=2) from pytriqs.plot.mpl_interface import oplot oplot(g['eg1', 'eg1'], '-o', RI='S') # S : spectral function oplot(g['eg2', 'eg2'], '-x', RI='S')