I know that the band diagram for the SSH can be easily obtained analytically, but I was wondering how one would go about it using kwant.

If I understand correctly we require a translational symmetry such as to have an infinite lattice, so I defined a lead and tried to get the band structure from there. Unfortunately my code does not work and stops with a TypeError: Expecting an instance of SiteFamily. I thought that I implemented the hopping similar to the one from the graphene tutorial.  Furthermore, I am wondering whether the definition of the lattice correct actually? To me it seems that the lattice vector [1,0] leaves us on the site of the b-sublattice. If I change it to [2,0] however I get a commensurate error

The code that I have so far is below.

Thank you,

Steffen

import numpy as np
import kwant

t = 1

SSH = kwant.lattice.general([[1, 0]],  # lattice vectors
                                 [[0,0], [1,0]])  # Coordinates of the sites)
a,b = SSH.sublattices
SSH_lead = kwant.Builder(kwant.TranslationalSymmetry([-1, 0]))
SSH_lead[a.shape((lambda pos: abs(pos[0]) == 0), (0, 0))] = 1
SSH_lead[b.shape((lambda pos: abs(pos[0]) == 1), (0, 0))] = 1

LongBond = (((1, 0), a, b))
ShortBond = (((-1, 0), a, b))
SSH_lead[[kwant.builder.HoppingKind(*hopping) for hopping in LongBond]] = 2
SSH_lead[[kwant.builder.HoppingKind(*hopping) for hopping in ShortBond]] = 1

kwant.plot(SSH_lead)
kwant.plotter.bands(SSH_lead.finalized())