-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathSSH_1D.jl
51 lines (46 loc) · 853 Bytes
/
SSH_1D.jl
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
using LinearAlgebra, PyPlot
# 1D
function Hamiltonian(N, t1, t2;period=1)
n = 2*N
hopping1 = zeros(ComplexF64,n-1)
for i = 1:n-1
if i % 2 == 0
hopping1[i] = t2
else
hopping1[i] = t1
end
end
H = diagm(1 => hopping1, -1=> hopping1)
if period == 1
H[1,end] = t2
H[end,1] = t2
end
return H
end
N = 100
H = Hamiltonian(N,1,2;period=1)
E,V=eigen(H)
#figure()
#plot(E,"k*")
#grid()
#plot(V[:,N],"k.")
x = 0:2N-1
phi = diagm(exp.(im*2*pi*x/(2N-1)))
# Px
S = V[:,1:N]' * phi * V[:,1:N]
imag.(log.(det(S)))/2/pi
# LDOS
sumV = 0
for i =1:N
V0=abs.(V[:,i]).^2
sumV = sumV .+ V0
end
sumVi = zeros(N)
for i = 1:N
sumVi[i] = sum(sumV[(i-1)*2+1:i*2])
end
figure(figsize=(2.5,2.5));plot(sumVi,"k.");
ylim([0.5,1.5])
xlabel("site")
ylabel("LDOS")
grid()