Re: How the spin is positioned in the Smatrix?
I searched a lot and got the answer! Here it is some links that helped me Some exemples links: https://kwantproject.org/doc/1/tutorial/spin_potential_shape.html?highlight... https://kwantproject.org/doc/1/_downloads/spin_orbit.py https://kwantproject.org/doc/1/tutorial/superconductors.html?highlight=norb... Some forum threads links: https://www.mailarchive.com/kwantdiscuss@kwantproject.org/msg01353.html https://kwantdiscuss.kwantproject.narkive.com/96MScaQw/kwantspincurrents... Summarizing: To obtain spin upup, updown, downup and downdown transmissions, it is required use norbs = 2 in a lattice construction and make the scattering matrix ordered. Attention in lat and lead declaration Code exemple: import kwant import numpy as np # For plotting from matplotlib import pyplot # For matrix support import tinyarray # define Paulimatrices for convenience 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]]) def make_system(t=1.0, alpha=0.5, e_z=0.08, W=10, L=30): # Start with an empty tightbinding system and a single square lattice. # `a` is the lattice constant (by default set to 1 for simplicity). lat = kwant.lattice.square(norbs = 2) # these orbitals will be one to spin up and one to spin down syst = kwant.Builder() #### Define the scattering region. #### syst[(lat(x, y) for x in range(L) for y in range(W))] = \ 4 * t * sigma_0 + e_z * sigma_z # hoppings in xdirection syst[kwant.builder.HoppingKind((1, 0), lat, lat)] = \ t * sigma_0 + 1j * alpha * sigma_y / 2 # hoppings in ydirections syst[kwant.builder.HoppingKind((0, 1), lat, lat)] = \ t * sigma_0  1j * alpha * sigma_x / 2 #### Define the left lead. #### lead = kwant.Builder(kwant.TranslationalSymmetry((1, 0)), conservation_law=sigma_z) # this sorts the blocks: "up" modes come first, and then the "down" lead[(lat(0, j) for j in range(W))] = 4 * t * sigma_0 + e_z * sigma_z # hoppings in xdirection lead[kwant.builder.HoppingKind((1, 0), lat, lat)] = \ t * sigma_0 + 1j * alpha * sigma_y / 2 # hoppings in ydirections lead[kwant.builder.HoppingKind((0, 1), lat, lat)] = \ t * sigma_0  1j * alpha * sigma_x / 2 #### Attach the leads and return the finalized system. #### syst.attach_lead(lead) syst.attach_lead(lead.reversed()) return syst def plot_conductance(syst, energies): # Compute conductance data = [] #total transmission data_uu = [] #upup transmission data_ud = [] #updown transmission data_du = [] #downup transmission data_du = [] #downup transmission for energy in energies: smatrix = kwant.smatrix(syst, energy) t = np.matrix(smat.submatrix(1, 0)) #transmission block tt = np.matmul(t, t.getH()) #t*t_dagger matrix in case of especific cases, i prefer work with this form data.append(smatrix.transmission(1, 0)) # transmission lead 0 to lead 1 data_uu.append(smatrix.transmission((1,0), (0,0))) # transmission lead 0 up to lead 1 up data_ud.append(smatrix.transmission((1,1), (0,0))) # transmission lead 0 up to lead 1 down data_du.append(smatrix.transmission((1,0), (0,1))) # transmission lead 0 down to lead 1 up data_dd.append(smatrix.transmission((1,0), (0,0))) # transmission lead 0 down to lead 1 down pyplot.figure() pyplot.plot(energies, data) pyplot.xlabel("energy [t]") pyplot.ylabel("conductance [e^2/h]") pyplot.show() pyplot.figure() pyplot.plot(energies, data_uu) pyplot.xlabel("energy [t]") pyplot.ylabel("upup conductance [e^2/h]") pyplot.show() pyplot.figure() pyplot.plot(energies, data_ud) pyplot.xlabel("energy [t]") pyplot.ylabel("updown conductance [e^2/h]") pyplot.show() pyplot.figure() pyplot.plot(energies, data_du) pyplot.xlabel("energy [t]") pyplot.ylabel("downup conductance [e^2/h]") pyplot.show() pyplot.figure() pyplot.plot(energies, data_dd) pyplot.xlabel("energy [t]") pyplot.ylabel("downdown conductance [e^2/h]") pyplot.show() def main(): syst = make_system() # Check that the system looks as intended. kwant.plot(syst) # Finalize the system. syst = syst.finalized() # We should see nonmonotonic conductance steps. plot_conductance(syst, energies=[0.01 * i  0.3 for i in range(100)]) # Call the main function if the script gets executed (as opposed to imported). # See <http://docs.python.org/library/__main__.html>. if __name__ == '__main__': main() Hope it helps!
hello, I copy your code to run with kwant 1.4.2. But, I get the error "IndexError: index 2 is out of bounds for axis 0 with size 2", when calculate data_ud.append(smatrix.transmission((1,1), (0,0))) # transmission lead 0 up to lead 1 down. Did you meet the same problem？
Hey, I get the same issue when I exclude conservation_law = sigma_z inside the left lead builder. But according to the documentation there should be a way to run the code without the conservation law I suppose? But I have had no luck in doing that, does anyone have an idea how to do that? Sincerely, Binayyak
participants (4)

binayyr＠g.clemson.edu

Diego Bruno

diegobruno244＠gmail.com

木呆 叶