% Student Project Advanced Solid State Physics
% Summer Semester 2012
% Gernot Kraberger
%
% Calculation of the DOS of a 2d square crystal

% tight binding parameters
eps = 0;
t = 1;

% number of k values per dimension
lv = 5000;
% number of bins for the DOS
nbins = 101;

% vector of k values
k=linspace(-pi,pi,lv);

[kx,ky] = meshgrid(k,k);

% calculate the energy
E = eps - 2 * t * (cos(kx)+cos(ky));

% bin the energy to get the DOS
[DOS, Eval] = hist(E(:),nbins);

% normalize
DOS = DOS/(Eval(2)-Eval(1))/lv.^2;

% spin
DOS = DOS * 2;


plot(Eval,DOS)
