I am trying to figure out the numerical interpretation of density of states for a fermionic system under a periodic potential.
The equation for the density of states reads
$$ DOS(E) = \sum_{k \in BZ, n} \delta(E-E_n(k)), $$
where $E_n(k)$ are the eigenvalues of the particular Hamiltonian matrix I am solving. I would like to use the Cauchy/Lorentzian approximation of the Delta function such that the first equation now becomes
$$ DOS(E) = \frac{1}{\pi} \lim_{\epsilon\to 0} \sum_{k \in BZ, n} \frac{\epsilon}{(E-E_n(k))^2+\epsilon^2}. $$
From here on, I am confused on how to interpret the second equation numerically. I have the respective eigenvalues of the Hamiltonian, but I don't know how to obtain the DOS using $E$. How do I include $E$ in my code? Discretizing E to me means that I grab a certain energy window around a certain value $E$, but I don't know how to structure it, or if needs to be an array, a grid...or something else. If E should be a grid, should it be a grid between the minimum and maximum values of the energy eigenvalues?
EDIT: Hey all. After pondering about Murali's answer I have come up with a pseudo code that is rather bad but I would like to know if I am going in the right direction.
I basically coded a function for the Lorentzian broadened delta function like so:
def delta_l(x):
return (1/np.pi)*(epsilon/(epsilon**2 + x**2))
def dos(Egrid,Eigen):
DOS = np.zeros((AllK,1))
for j in range(Allk):
DOS[j] = (1/AllK)*sum([delta(Egrid[j]-Eigen[i]) for i in range(np.shape(Eigen)[0])])
return DOS
Here epsilon is given a value of 0.1 just to test. The eigenvectors of the Hamiltonian were obtained by inputting points of the FBZ:
AllK = len(np.arange(0, 1, 0.01)) * len(np.arange(0, 1, 0.01))
E = np.zeros((AllK,4*n), float)
count = 0
for m in np.arange(0, 1, 0.01):
for f in np.arange(0, 1, 0.01):
kx = (m-f) * np.sqrt(3)/2
ky = (m+f) * 3.0/2 - 1
E[count] = Hamiltonian(kx*Kmag, ky*Kmag)
count = count + 1
import pandas as pd
EinBZ = E.flatten()
So then I get all the eigenvalues of the FBZ in this array. Am I going in the right direction?