-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathdriven-SSH.py
115 lines (100 loc) · 4.04 KB
/
driven-SSH.py
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
"""
Calculate and plot the quasienergy spectra from the bulk hamiltoninan
of the Su-Schrieffer-Heeger (SSH) tigh biding model where the hoppings
are modulated in time.
For detailed information about the system consult the article:
Dal Lago, V., Atala, M., & Torres, L. F. (2015). Floquet topological
transitions in a driven one-dimensional topological insulator.
Physical Review A, 92(2), 023624.
This code reproduce the results in FIG. 2. from Dal Lago, et al. 2015
Author: Carla Borja Espinosa
Date: Febrero 2019
Example command line in terminal to run the program:
$ python3 0.5 0.5 0 1.5 1
"""
import sympy as sp
import numpy as np
import matplotlib.pyplot as plt
from numpy import linalg as la
from sympy.printing.str import StrPrinter
from sys import argv
from sympy.abc import t
class Hamiltonian(object):
"""Define the total hamiltonian for the system"""
def __init__(self):
"""Variables"""
self.v = float(argv[1]) #intracell hoping
self.w = float(argv[2]) #extracell hoping
self.V = float(argv[3]) #driving amplitude
self.T = float(argv[4])*sp.pi #period of the perturbation
self.harm = int(argv[5]) #number of harmonics
self.G = 2*sp.pi/self.T
self.k = sp.Symbol('k',real=True)
"""Functions"""
self.FreeHamiltonian()
self.ModulatedHamiltonian()
self.FHamiltonian(self.harm)
self.EigenvalsPlot()
def FreeHamiltonian(self):
"""Define the free evolution hamiltonian"""
self.Ho = -sp.Matrix([[0,self.v+self.w*sp.exp(-sp.I*self.k)],[self.v+self.w*sp.exp(sp.I*self.k),0]])
self.size = self.Ho.shape[1]
def ModulatedHamiltonian(self):
"""Define the hamiltonian for the time-dependent periodic
perturbation"""
m = 2*self.V*sp.cos(self.G*t) #modulation of hoppings
self.Vt = sp.Matrix([[0,m-m*sp.exp(-sp.I*self.k)],
[m-m*sp.exp(sp.I*self.k),0]])
def NonDiagonalElements(self,n=0,m=1):
"""Calculate the non diagonal elements of the time-independent
Floquet hamiltonian"""
Hnm = sp.zeros(self.size,self.size)
for i in range(0,self.size):
for j in range(0,self.size):
Hnm[i,j] = 1/self.T*sp.integrate(self.Vt[i,j]*sp.exp(-sp.I*(m-n)*self.G*t),(t,0,self.T),conds='none')
return(Hnm)
def DiagonalElements(self,n):
"""Calculate the diagonal elements of the time-independent
Floquet hamiltonian"""
return(self.Ho+n*self.G*sp.eye(2))
def FHamiltonian(self,n):
"""Set up the time-independent Floquet hamiltonian"""
Hf = sp.Matrix([])
ndep = self.NonDiagonalElements(0,1)
nden = self.NonDiagonalElements(1,0)
for i in range(-n,n+1):
fila = sp.Matrix([])
for j in range(-n,n+1):
if j==i:
fila = fila.row_join(self.DiagonalElements(i))
elif j==i+1:
fila = fila.row_join(ndep)
elif j==i-1:
fila = fila.row_join(nden)
else:
fila = fila.row_join(sp.Matrix([[0,0],[0,0]]))
Hf = Hf.col_join(fila)
Hf.simplify()
#printer = StrPrinter()
#print(Hf.table(printer,align='center'))
self.Hf = Hf
def EigenvalsPlot(self):
"""Calculate and plot the eigenvalues of the time-independent
Floquet hamiltonian"""
Hfk = sp.lambdify('k',self.Hf)
k_vals = np.arange(-np.pi,np.pi,0.001)
size_k = np.size(k_vals)
size_aut = self.Hf.shape[1]
graph = np.empty([size_k,size_aut])
for i in range(0,size_k):
energies,vectors = la.eig(Hfk(k_vals[i]))
energies = np.sort(np.real(energies))
graph[i] = energies
for i in range(0,size_aut):
plt.plot(k_vals,graph[:,i],'g')
#plt.ylim(-2,2)
plt.show()
#plt.ylim(self.G/2, self.G/2) #Brillouin Zone
#plt.show()
"""Command Line Executable"""
Hamiltonian()