In [1]:
import sys

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

init_notebook()
%output size=150
pi_ticks = [(-np.pi, r"$-\pi$"), (0, "0"), (np.pi, r"$\pi$")]

def Qi_Wu_Zhang(w=None):
def onsite(site, p):
return -p.mu * pauli.sz

def hopx(site1, site2, p):
return -0.5j * p.delta * pauli.sy - p.t * pauli.sz

def hopy(site1, site2, p):
return -1j * p.gamma * pauli.sx - p.gamma * pauli.sz

lat = kwant.lattice.square()

if w == None:
syst = kwant.Builder(kwant.TranslationalSymmetry(*lat.prim_vecs))
syst[lat.shape(lambda pos: True, (0, 0))] = onsite
else:

def ribbon_shape(pos):
return 0 <= pos[1] < w

sym = kwant.TranslationalSymmetry((1, 0))
syst = kwant.Builder(sym)
syst[lat.shape(ribbon_shape, (0, 0))] = onsite

syst[kwant.HoppingKind((1, 0), lat)] = hopx
syst[kwant.HoppingKind((0, 1), lat)] = hopy
return syst

def title(p):
title = r"$t={:.2}$, $\mu={:.2}$, $\Delta={:.2}$, $\gamma={:.2}$"
title = title.format(p.t, p.mu, p.delta, p.gamma)
return title

Populated the namespace with:
np, matplotlib, kwant, holoviews, init_notebook, SimpleNamespace, pprint_matrix, scientific_number, pretty_fmt_complex, plt, pf, display_html
from code/edx_components:
MoocVideo, MoocDiscussion, MoocCheckboxesAssessment, MoocMultipleChoiceAssessment, MoocSelfAssessment
from code/functions:
spectrum, hamiltonian_array, h_k, pauli
Using kwant 1.4.2 and holoviews 1.13.2
Executed on 2021-03-06 at 14:56:45.124647.