import numpy as np
import matplotlib.pylab as plt
from numpy import sqrt, sin, cos, pi
from scipy.optimize import curve_fit
eig_vbm= -1.3286 # fermi energy level in scf output for metals
Eks_DFT = np.load('eig.npy') - eig_vbm
Ek_DFT = Eks_DFT[:,12]
Ek_DFT = Ek_DFT[:110]
def func_tight_binding(k, t1, t2, t3, t4, t5):
xi = 0.5 * k[0,:]
eta = 0.5 * sqrt(3) * k[1, :]
tk1 = t1*(2*cos(xi)*cos(eta) + cos(2*xi))
tk2 = t2*(2*cos(3*xi)*cos(eta) + cos(2*eta))
tk3 = t3*(2*cos(2*xi)*cos(2*eta) + cos(4*xi))
tk4 = t4*(2*cos(xi)*cos(3*eta) + cos(5*xi)*cos(eta) + cos(4*xi)*cos(2*eta))
tk5 = t5*(2*cos(3*xi)*cos(3*eta) + cos(6*xi))
Ek = tk1 + tk2 + tk3 + tk4 + tk5
return Ek
N_G_M = 40
kx = []
ky = []
kx_G_M = [0 for i in range(N_G_M)]
ky_G_M = [i * pi / N_G_M for i in range(N_G_M)]
N_M_K = 30
kx.extend(kx_G_M)
ky.extend(ky_G_M)
kx_M_K = [i * pi / sqrt(3) /N_M_K for i in range(N_M_K)]
ky_M_K = [pi for i in range(N_M_K)]
kx.extend(kx_M_K)
ky.extend(ky_M_K)
N_K_G = 40
kx_K_G = [i * pi / sqrt(3) /N_K_G for i in range(N_K_G, 0, -1)]
ky_K_G = [i * pi / N_K_G for i in range(N_K_G, 0, -1)]
kx.extend(kx_K_G)
ky.extend(ky_K_G)
k = np.array([kx, ky])
print(k.shape)
popt, pcov = curve_fit(func_tight_binding, k, Ek_DFT)
print(popt)
Ek = func_tight_binding(k, *popt)
Ef = [0 for i in range(Ek.size)]
plt.plot(Ek_DFT, color = "blue")
plt.plot(Ek, color = "red")
plt.plot(Ef)
plt.plot()
plt.show()
单带拟合很容易出现hopping越来越大的情况,对于该模型,单带效果不是很好。