While studying 2.3.transport_through_barrier.ipynb, a tutorial in gitlab, I tried to find the transimission by changing the lattice to a graphene nanoribbon rather than a square. Here is the code I tried.
import numpy as np
import kwant
from matplotlib import pyplot
lat = kwant.lattice.general([[1, 0], [1/2, np.sqrt(3)/2]], # lattice vectors
[[0, 0], [0, 1/np.sqrt(3)]]) # Coordinates of the sites
a, b = lat.sublattices
def make_lead_x(W=10, t=1):
syst = kwant.Builder(kwant.TranslationalSymmetry([-1, 0]))
syst[(lat(0, y) for y in range(W))] = 4 * t
syst[lat.neighbors()] = -t
return syst
def make_wire_with_flat_potential(W=10, L=2, t=1):
def onsite(s, V):
return (4 - V) * t
# Construct the scattering region.
sr = kwant.Builder()
sr[(lat(x, y) for x in range(L) for y in range(W))] = onsite
sr[lat.neighbors()] = -t
# Build and attach lead from both sides.
lead = make_lead_x(W, t)
sr.attach_lead(lead)
sr.attach_lead(lead.reversed())
return sr
def plot_transmission(syst, energy, params):
# Compute conductance
trans = []
for param in params:
smatrix = kwant.smatrix(syst, energy, args=[param])
trans.append(smatrix.transmission(1, 0))
pyplot.plot(params, trans)
_syst = make_wire_with_flat_potential()
kwant.plot(_syst)
_syst = _syst.finalized()
kwant.plotter.bands(_syst.leads[0])
plot_transmission(_syst, 1, np.linspace(-2, 0, 51))
Error says 'Polyatomic' object is not callable.
I did a search
lat = kwant.lattice.general([[1, 0], [1/2, np.sqrt(3)/2]], # lattice vectors
[[0, 0], [0, 1/np.sqrt(3)]]) # Coordinates of the sites
a, b = lat. sublattices
I understand that this code is polyatomic, and it is not correct to apply it to (lat(x, y).
But i can't find a solution. Can you help me?