Hi, thanks for the answer. I also think that It might be something from
matplotlib, but I'm not sure. The following code completely reproduces the bug,
and the #sys shows how it deslocates. Taking of some f the lattices also
doesn't fix, it can be checked.
import kwant
import tinyarray
import numpy as np
from matplotlib import pyplot
#Pauli Matrices
sigma_0 = tinyarray.array([[1, 0], [0, 1]])
sigma_x = tinyarray.array([[0, 1], [1, 0]])
sigma_y = tinyarray.array([[0, -1j], [1j, 0]])
sigma_z = tinyarray.array([[1, 0], [0, -1]])
barrier=1.5
phi = 0.005
U0 = 0.3
salt = 13
mu=0.4
Delta=0.1
t=1.0
#Onsite + Disorder
from kwant.digest import uniform
def onsite_sc(site):
return (4 * t - mu) * np.tensordot(sigma_z,sigma_0, axes=0) + Delta *
np.tensordot(sigma_x,sigma_0, axes=0)
def onsite_tu(site):
return (4 * t + barrier - mu) * np.tensordot(sigma_z,sigma_0, axes=0)
def make_system(a=1, W=21, L=15, H=4, Hs=6, barrier=1.5, phi = 0.005, U0 = 0.3,
salt = 13, mu=0.4, Delta=0.1, t=1.0):
lat_ti = kwant.lattice.cubic(a,name='TopIns')
lat_sc = kwant.lattice.cubic(a,name='Supercondutor', norbs=2)
lat_tu = kwant.lattice.cubic(a,name='Tunelamento', norbs=2)
syst = kwant.Builder()
syst[(lat_ti(x, y, z) for x in range(W) for y in range(L) for z in
range(H-1))] = 0
syst[(lat_ti(x, y, z) for x in range(int(W/3),int(2*W/3)) for y in range(L)
for z in range(H-1,H))] = 0
syst[(lat_sc(x, y, z) for x in range(int(W/3)) for y in range(L) for z in
range(H+1,H+Hs))] = onsite_sc
syst[(lat_sc(x, y, z) for x in range(int(2*W/3),W) for y in range(L) for z
in range(H+1,H+Hs))] = onsite_sc
#syst[(lat_sc(W-1, 0, H+Hs+10))] = 0 #bug ?
# The tunnel barrier
syst[(lat_tu(x, y, z) for x in range(int(W/3)) for y in range(L) for z in
range(H-1, H+1))] = onsite_tu
syst[(lat_tu(x, y, z) for x in range(int(2*W/3),W) for y in range(L) for z
in range(H-1,H+1))] = onsite_tu
def family_color(site):
if site.family == lat_sc:
return 'yellow'
if site.family == lat_ti:
return 'green'
if site.family == lat_tu:
return 'blue'
return syst, family_color
def main():
syst = make_system()[0]
# Check that the system looks as intended.
kwant.plot(syst, site_color=make_system()[1])
if __name__ == '__main__':
main()