Is this code correct for the voltage applied in the 3rd lead?
import kwant
# For plotting
from matplotlib import pyplot
import numpy as np

a=1
t=1.0
W=10
L=10
mu=1.75
Delta=0.1
Deltapos=4
B0=4.0e-5

sys = kwant.Builder()
#sqlat = kwant.lattice.square(a)

	# Start with an empty tight-binding system and two square lattices,
	# corresponding to electron and hole degree of freedom
sqlat_e = kwant.lattice.square(a, name='e')
#sqlat_h = kwant.lattice.square(a, name='h')


def sinai(position):
	x, y = position
	x = max (abs(x)-70, 0)
	return x**2 + y**2 < 100**2 
	
sys[sqlat_e.shape(sinai, (0, 0))] = 4 * t - mu
sys[sqlat_e.neighbors()] = -t 

#sys[sqlat_h.shape(sinai, (0, 0))] = mu - 4 * t
#sys[sqlat_h.neighbors()] = t 



	# the tunnel barrier
#sys[(sqlat_e(x, y) for x in range(barrierpos[0], barrierpos[1])
         #for y in range(W))] = 4 * t + barrier - mu
#sys[(sqlat_h(x, y) for x in range(barrierpos[0], barrierpos[1])
         #for y in range(W))] = mu - 4 * t - barrier

	# hoppings for both electrons and holes
sys[sqlat_e.neighbors()] =  t 


	# Superconducting order parameter enters as hopping between
	 #electrons and holes
sys[((sqlat_e(x, y)) for x in range(Deltapos, L)
         for y in range(W))] = Delta

	
def hopx(site1, site2, B=0):
        # The magnetic field is controlled by the parameter B
	y = site1.pos[1]
	return -t * np.exp(-1j * B * y)
        
#def hopy(site1, site2, B=0):
#        # The magnetic field is controlled by the parameter B
#        x = site1.pos[1]
#        return -t * np.exp(0.5*1j * B * x)        

sys[sqlat_e.shape(sinai, (0, 0))] = 4 * t - mu
sys[sqlat_e.neighbors()] = -t 

#sys[sqlat_h.shape(sinai, (0, 0))] = mu - 4 * t
#sys[sqlat_h.neighbors()] = t

    # hoppings in x-direction
sys[kwant.builder.HoppingKind((1, 0), sqlat_e, sqlat_e)] = hopx
    # hoppings in y-directions
sys[kwant.builder.HoppingKind((0, 1), sqlat_e, sqlat_e)] = -t

#def in_hole(site):
    #x, y = site.pos / a - (0, 0)  # position relative to centre
    #x = max (abs(x)-10, 0)
    #return x**2/90**2+y**2/30**2< 1
#for site in filter(in_hole, list(sys.sites())):
    #del sys[site]   
#kwant.plot(sys) 


lead0_symmetry = kwant.TranslationalSymmetry([1,0])
for start, end in [(5, 10)]:
	lead0 = kwant.Builder(lead0_symmetry)
	lead0[(sqlat_e(0, y) for y in range(start, end))] = 4 * t - mu
	#lead0[(sqlat_h(0, y) for y in range(start, end))] = mu - 4 * t
	lead0[sqlat_e.neighbors()] =-1
	#lead0[sqlat_h.neighbors()] =1
	sys.attach_lead(lead0)
#sys.attach_lead(lead0.reversed())

lead_symmetry = kwant.TranslationalSymmetry([0,-1])
for start, end in [(-55, -50)]:
	lead = kwant.Builder(lead_symmetry)
	lead[(sqlat_e(0, x) for x in range(start, end))] = 4 * t - mu
	#lead[(sqlat_h(0, y) for y in range(start, end))] = mu - 4 * t
	lead[sqlat_e.neighbors()] =-1
	#lead[sqlat_h.neighbors()] =1
	sys.attach_lead(lead)

lead_symmetry = kwant.TranslationalSymmetry([0,-1])
for start, end in [(45, 50)]:
	lead = kwant.Builder(lead_symmetry)
	lead[(sqlat_e(0, x) for x in range(start, end))] = Delta
	#lead[(sqlat_h(0, y) for y in range(start, end))] = mu - 4 * t
	lead[sqlat_e.neighbors()] =-1
	#lead[sqlat_h.neighbors()] =1
	sys.attach_lead(lead)
	    #return sys
	

sys = sys.finalized()

#kwant.plot(sys)

print("Lower:")
smat=kwant.smatrix(sys,0.45,[B0]) 
print(smat)
    
print("Upper:")
smat=kwant.smatrix(sys,0.5,[B0])
print(smat)


outF = open("phaseleads.dat", "w")


    
for i in range(1):
	print(i)
	enr=0.45 + 0.5e-5*i
	smat=kwant.smatrix(sys, enr, [B0])
	sm=smat.data
	#compute conductance
	cond=smat.transmission(1, 0)
#	sme=[sm[0,0].real, sm[0,0].imag, sm[0,1].real, sm[0,1].imag,sm[1,0].real, sm[1,0].imag,sm[1,1].real, sm[1,1].imag]
	outF.write("%s %s %s %s %s %s %s %s %s %s %s %s %s %s %s %s %s %s %s %s\n" %(str(enr), str(cond), str(sm[0,0].real), str(sm[0,0].imag), str(sm[0,1].real),str(sm[0,1].imag), str(sm[0,2].real), str(sm[0,2].imag), str(sm[1,0].real), str(sm[1,0].imag), str(sm[1,1].real),str(sm[1,1].imag), str(sm[1,2].real), str(sm[1,2].imag), str(sm[2,0].real), str(sm[2,0].imag), str(sm[2,1].real), str(sm[2,1].imag), str(sm[2,2].real), str(sm[2,2].imag) ))
	                  
outF.close()

#compute_conductance(sys, enr_init, enr_fin,fluxes=[0])


#local_dos = kwant.ldos(sys, energy=.6)

#from matplotlib import pyplot
#pyplot.plot(energies, conductances)
#pyplot.show()
#kwant.plotter.map(sys, local_dos, num_lead_cells=10)

Reply via email to