def func_2vN(Ek, Ek_grid, l, eta, hfk):
"""
Linearly interpolate the value of hfk on Ek_grid at point Ek.
Parameters
----------
Ek : float
Energy value (not necessarily a grid point).
Ek_grid : array
Energy grid.
l : int
Lead label.
eta : int
Integer describing (+/-1) if infinitesimal eta is positive or negative.
hfk : array
Array containing Hilbert transform of Fermi function (or 1-Fermi).
Returns
-------
float
Interpolated value of hfk at Ek.
"""
if Ek<Ek_grid[0] or Ek>Ek_grid[-1]:
return 0
#
b_idx = int((Ek-Ek_grid[0])/(Ek_grid[1]-Ek_grid[0]))+1
if b_idx == len(Ek_grid): b_idx -= 1
a_idx = b_idx - 1
b, a = Ek_grid[b_idx], Ek_grid[a_idx]
#
fb = hfk[l, b_idx]
fa = hfk[l, a_idx]
rez = (fb-fa)/(b-a)*Ek + (b*fa-a*fb)/(b-a)
return pi*rez if eta+1 else pi*rez.conjugate()
评论列表
文章目录