shape mismatch occuers when computing smatrix in 1-D chain

Dear Kwant Community I am new in Kwant and trying to compute a simple 1-D system's conductance. However something strange confuse me that when the Fermi energy gets adjusted into some specific range (like (0,1) or (-1,2)), the Jupyter says: "shape mismatch: value array of shape (2,2) could not be broadcast to indexing result of shape (2,4)". More mystical, if I tuned it to other range (like(-5,5)) or considered 2-D condition,the error would disappear. I don't know what happend QAQ , could anyone please give me some explanation? This is my code: import kwant # For plotting from matplotlib import pyplot import numpy as np sigma_0=np.array([[1,0],[0,1]]) sigma_x=np.array([[0,1],[1,0]]) sigma_y=np.array([[0,-1j],[1j,0]]) sigma_z=np.array([[1,0],[0,-1]]) U=4 def make_system(a=1, t=1.0, L=5): lat = kwant.lattice.chain(a,norbs=2) syst = kwant.Builder() #### Define the scattering region. #### for x in range (L): syst[(lat(x))] = (2*t+U)*sigma_0 syst[lat.neighbors()] = -t*sigma_0 #### Define and attach the leads. #### lead0 = kwant.Builder(kwant.TranslationalSymmetry([-a])) lead0[(lat(0))] = 2*t*sigma_0 lead0[lat.neighbors()] = -t*sigma_0 lead1 = kwant.Builder(kwant.TranslationalSymmetry([a])) lead1[(lat(0))] = 2*t*sigma_0 lead1[lat.neighbors()] = -t*sigma_0 syst.attach_lead(lead0) syst.attach_lead(lead1) return syst #================================================================ def plot_conductance(sys,energies): data=[] for energy in energies: #<-Fermi energy smatrix=kwant.smatrix(sys,energy) data.append(smatrix.transmission(1,0)) plt.figure() plt.plot(energies, data) plt.xlabel("energy") plt.ylabel("conductance [e^2/h]") plt.show() def main(): syst=make_system() kwant.plot(syst) sys=syst.finalized() Es = np.linspace(-1,1, 100) #<-Fermi energy plot_conductance(sys,Es) if __name__ == '__main__': main() I guess it occuers because zero energy may causes some singular conditions, but I badly don't know why XD. Thanks for reading. Sincerely, Intpret
participants (1)
-
1223234765@qq.com