% The Zhang lattice is a simple lattce that naturally has type-II Dirac points
% It was created by Yiqi Zhang's group in 2020
% This is the code for solving for the band structure of the Zhang lattice
% by using the tight-binding method with the nearest-neighbor coupling
% considered only according to Eq. (2)
% zhangyiqi@xjtu.edu.cn

clc
clear all
close all

a=1;
t=1;

v1=[-a/2; 2*a+sqrt(3)*a/2];
v2=[+a/2; 2*a+sqrt(3)*a/2];

K=2*pi/a;

flag1=1;
for kx=linspace(-K/2,K/2,1000)
    flag2=1;
    for ky=linspace(-K/4,K/4,500)
        k=[kx,ky];
        H=t*[2*cos(k*(v2-v1)) 1 exp(-1i*k*v1)+exp(-1i*k*v2);
            1 2*cos(k*(v2-v1)) 1;
            exp(+1i*k*v1)+exp(+1i*k*v2) 1 2*cos(k*(v2-v1))];
        eigval=eig(H);
        
        eigval1(flag2,flag1)=eigval(1);
        eigval2(flag2,flag1)=eigval(2);
        eigval3(flag2,flag1)=eigval(3);
        
        flag2=flag2+1;
    end
    
    flag1=flag1+1;
end
[kx,ky]=meshgrid(linspace(-K/2,K/2,1000),linspace(-K/4,K/4,500));
figure('Units','pixels','Position',[128 128 1000 1000],...
    'PaperUnits','inches','PaperPositionMode','manual',...
    'PaperPosition',[0 0 10 10]);
hold on
surf(kx,ky,eigval1)
surf(kx,ky,eigval2)
surf(kx,ky,eigval3)
shading interp
camlight head
hold off
axis equal
axis([-pi pi -pi/2 pi/2 -3.5 5])
view(10,25)
box on
