1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170
| function idx(ix::Int64,iy::Int64,nx::Int64)::Int64 idx=(iy-1)*nx+ix end function pauli() s0 = zeros(ComplexF64,2,2) s1 = zeros(ComplexF64,2,2) s2 = zeros(ComplexF64,2,2) s3 = zeros(ComplexF64,2,2) s0[1,1] = 1 s0[2,2] = 1 s1[1,2] = 1 s1[2,1] = 1 s2[1,2] = -im s2[2,1] = im s3[1,1] = 1 s3[2,2] = -1 return s0,s1,s2,s3 end
function gamma() s0,s1,s2,s3=pauli() g0=s0 g1=s1 g2=s2 g3=s3 return g0,g1,g2,g3 end
function hamr(nx::Int64,ny::Int64,gamma::Float64,flag_pbc::Int64) t1=1.0 t2=0.2 m=0.0 phi=pi/2
ham=zeros(ComplexF64,N,N) for y in 1:ny for x in 1:nx ham[idx(x,y,nx),idx(x,y,nx)]=m+im*gamma ham[idx(x,y,nx)+nxy,idx(x,y,nx)+nxy]=-(m+im*gamma) end end for y in 1:ny for x in 1:nx ham[idx(x,y,nx),idx(x,y,nx)+nxy]=t1 ham[idx(x,y,nx)+nxy,idx(x,y,nx)]=t1 end end for y in 1:ny for x in 2:nx ham[idx(x,y,nx),idx(x-1,y,nx)+nxy]=t1 ham[idx(x-1,y,nx)+nxy,idx(x,y,nx)]=t1 end end for y in 2:ny for x in 1:nx ham[idx(x,y,nx),idx(x,y-1,nx)+nxy]=t1 ham[idx(x,y-1,nx)+nxy,idx(x,y,nx)]=t1 end end for y in 1:ny for x in 1:nx-1 ham[idx(x,y,nx),idx(x+1,y,nx)]=t2*exp(im*phi) ham[idx(x+1,y,nx),idx(x,y,nx)]=t2*exp(-im*phi) ham[idx(x,y,nx)+nxy,idx(x+1,y,nx)+nxy]=t2*exp(-im*phi) ham[idx(x+1,y,nx)+nxy,idx(x,y,nx)+nxy]=t2*exp(im*phi) end end for y in 2:ny for x in 1:nx ham[idx(x,y,nx),idx(x,y-1,nx)]=t2*exp(im*phi) ham[idx(x,y-1,nx),idx(x,y,nx)]=t2*exp(-im*phi) ham[idx(x,y,nx)+nxy,idx(x,y-1,nx)+nxy]=t2*exp(-im*phi) ham[idx(x,y-1,nx)+nxy,idx(x,y,nx)+nxy]=t2*exp(im*phi) end end for y in 1:ny-1 for x in 2:nx ham[idx(x,y,nx),idx(x-1,y+1,nx)]=t2*exp(im*phi) ham[idx(x-1,y+1,nx),idx(x,y,nx)]=t2*exp(-im*phi) ham[idx(x,y,nx)+nxy,idx(x-1,y+1,nx)+nxy]=t2*exp(-im*phi) ham[idx(x-1,y+1,nx)+nxy,idx(x,y,nx)+nxy]=t2*exp(+im*phi) end end
if flag_pbc==1 for x in 1:nx ham[idx(x,1,nx),idx(x,ny,nx)+nxy]=t1 ham[idx(x,ny,nx)+nxy,idx(x,1,nx)]=t1 ham[idx(x,1,nx),idx(x,ny,nx)]=t2*exp(im*phi) ham[idx(x,ny,nx),idx(x,1,nx)]=t2*exp(-im*phi) ham[idx(x,1,nx)+nxy,idx(x,ny,nx)+nxy]=t2*exp(-im*phi) ham[idx(x,ny,nx)+nxy,idx(x,1,nx)+nxy]=t2*exp(+im*phi) end for y in 1:ny ham[idx(1,y,nx),idx(nx,y,nx)+nxy]=t1 ham[idx(nx,y,nx)+nxy,idx(1,y,nx)]=t1 ham[idx(nx,y,nx),idx(1,y,nx)]=t2*exp(+im*phi) ham[idx(1,y,nx),idx(nx,y,nx)]=t2*exp(-im*phi) ham[idx(nx,y,nx)+nxy,idx(1,y,nx)+nxy]=t2*exp(-im*phi) ham[idx(1,y,nx)+nxy,idx(nx,y,nx)+nxy]=t2*exp(+im*phi) end for x in 2:nx ham[idx(x,ny,nx),idx(x-1,1,nx)]=t2*exp(+im*phi) ham[idx(x-1,1,nx),idx(x,ny,nx)]=t2*exp(-im*phi) ham[idx(x,ny,nx)+nxy,idx(x-1,1,nx)+nxy]=t2*exp(-im*phi) ham[idx(x-1,1,nx)+nxy,idx(x,ny,nx)+nxy]=t2*exp(im*phi) end for y in 1:ny-1 ham[idx(1,y,nx),idx(nx,y+1,nx)]=t2*exp(+im*phi) ham[idx(nx,y+1,nx),idx(1,y,nx)]=t2*exp(-im*phi) ham[idx(1,y,nx)+nxy,idx(nx,y+1,nx)+nxy]=t2*exp(-im*phi) ham[idx(nx,y+1,nx)+nxy,idx(1,y,nx)+nxy]=t2*exp(im*phi) end ham[idx(1,ny,nx),idx(nx,1,nx)]=t2*exp(+im*phi) ham[idx(nx,1,nx),idx(1,ny,nx)]=t2*exp(-im*phi) ham[idx(1,ny,nx)+nxy,idx(nx,1,nx)+nxy]=t2*exp(-im*phi) ham[idx(nx,1,nx)+nxy,idx(1,ny,nx)+nxy]=t2*exp(+im*phi) end if flag_pbc==0 ham[1,1+nxy]=0 ham[1+nxy,1]=0 ham[idx(nx,ny,nx),idx(nx,ny,nx)+nxy]=0 ham[idx(nx,ny,nx)+nxy,idx(nx,ny,nx)]=0 ham[idx(1,1,nx),idx(1,1,nx)]=0 ham[idx(1,1,nx),idx(2,1,nx)]=0 ham[idx(2,1,nx),idx(1,1,nx)]=0 ham[idx(1,1,nx),idx(1,2,nx)]=0 ham[idx(2,1,nx),idx(1,1,nx)]=0 ham[idx(nx,ny,nx)+nxy,idx(nx,ny,nx)+nxy]=0 ham[idx(nx,ny,nx)+nxy,idx(nx-1,ny,nx)+nxy]=0 ham[idx(nx,nx,nx)+nxy,idx(nx,ny-1,nx)+nxy]=0 ham[idx(nx-1,ny,nx)+nxy,idx(nx,ny,nx)+nxy]=0 ham[idx(nx,ny-1,nx)+nxy,idx(nx,ny,nx)+nxy]=0 end return ham end
function hamk(k1::Float64,k2::Float64) t1=1.0 t2=0.2 m,γ=0.0,0.2 phi=pi/2 g0,g1,g2,g3=gamma() ham=zeros(ComplexF64,2,2) ham[1,2]=t1*(1+exp(-im*k1)+exp(-im*k2)) ham[2,1]=conj(ham[1,2]) temp_1=t2*exp(im*phi)*(exp(im*k1)+exp(-im*k2)+exp(im*(k2-k1))) ham[1,1]=temp_1+conj(temp_1)+m+im*γ temp_2=t2*exp(-im*phi)*(exp(im*k1)+exp(-im*k2)+exp(im*(k2-k1))) ham[2,2]=temp_2+conj(temp_2)-m-im*γ return ham end
|