In [1]:
import sys

sys.path.append("../../code")
from init_mooc_nb import *

init_notebook()

from scipy import linalg as la
from functools import reduce

pi_ticks = [
(-np.pi, r"$-\pi$"),
(-np.pi / 2, r"$-\pi/2$"),
(0, r"$0$"),
(np.pi / 2, r"$\pi/2$"),
(np.pi, r"$\pi$"),
]

def checkerboard(W=None):
lat = kwant.lattice.general([[2, 0], [1, 1]], [(0, 0), (1, 0)])
a, b = lat.sublattices
if W:

(x, y) = pos
return 0 <= y < W and 0 <= x < W

syst = kwant.Builder(kwant.TranslationalSymmetry((1, 1)))
else:
syst = kwant.Builder(kwant.TranslationalSymmetry(*lat.prim_vecs))
syst[lat.shape(lambda pos: True, (0, 0))] = 0
syst[kwant.HoppingKind((0, 0), b, a)] = lambda s1, s2, p: -p.t1
syst[kwant.HoppingKind((-1, 1), b, a)] = lambda s1, s2, p: -p.t2
syst[kwant.HoppingKind((1, 0), a, b)] = lambda s1, s2, p: -p.t3
syst[kwant.HoppingKind((0, 1), a, b)] = lambda s1, s2, p: -p.t4
return syst

def evolution_operator(hamiltonians, T):
n = len(hamiltonians)
exps = [la.expm(-1j * h * T / n) for h in hamiltonians]
return reduce(np.dot, exps)


Populated the namespace with: