I am trying to reproduce Novoselov paper the magnetoresistance curve.Plese
help me correct this program.
Thanks!
#system Building
def make(a=160,b=70,t=1,alpha= .0):
def Square(pos):
x , y = pos
return 0<=x<=a and 0<y<=b
def hopx(site1,site2,B=1):
xi,yi = site1.pos
xj,yj = site1.pos
return -t * exp(-1j* B *(yj-yi)*(xj+xi)/2)*s_0
def hopy(site1,site2,B=1):
xi,yi = site1.pos
xj,yj = site1.pos
return -t * exp(-1j* B *(yj-yi)*a) * s_0
def gate(site1,g=0):
return g*s_0
sys = kwant.Builder()
sys[lat.shape(Square,(2.46,0))] = gate
sys[kwant.builder.HoppingKind((0, 0), A,B )]= -t * s_0
sys[kwant.builder.HoppingKind((0,1), A,B )] = hopx
sys[kwant.builder.HoppingKind((-1,1), A,B )] = -t * s_0
#left lead
sym0 = kwant.TranslationalSymmetry(lat.vec((-1,0)))
def shape(pos):
x, y = pos
return (0< y <=b)
lead0 = kwant.Builder(sym0)
lead0[lat.shape(shape, (2.46, 0))] = gate
lead0[kwant.builder.HoppingKind((0, 0), A,B )]= hopy
lead0[kwant.builder.HoppingKind((0,1), A,B )] = hopy
lead0[kwant.builder.HoppingKind((-1,1), A,B )] = hopy
sys.attach_lead(lead0)
#right lead
sys.attach_lead(lead0.reversed())
#LEAD PAIR
sym1 = kwant.TranslationalSymmetry(lat.vec((0,1)))
def shape(pos):
x, y = pos
return (a/5< x <=2*a/5)
lead1 = kwant.Builder(sym1)
lead1[lat.shape(shape, (2.46*a/10, 0))] = gate
lead1[lat.neighbors()] = -t * s_0
sys.attach_lead(lead1)
#right lead
sys.attach_lead(lead1.reversed())
#LEAD PAIR
sym2 = kwant.TranslationalSymmetry(lat.vec((0,1)))
def shape(pos):
x, y = pos
return (3*a/5< x <=4*a/5)
lead2 = kwant.Builder(sym2)
lead2[lat.shape(shape, (2.46*3*a/10, 0))] = gate
lead2[lat.neighbors()] = -t * s_0
sys.attach_lead(lead2)
#right lead
sys.attach_lead(lead2.reversed())
return sys.finalized()
def plot_conductance(sys, energy, gates):
data = []
for g in gates:
smatrix = kwant.smatrix(sys, energy,args=[g])
cond = np.array([[smatrix.transmission(i, j) for j in xrange(6)]
for i in xrange(6)])
cond -= np.diag(cond.sum(axis=0))
cm = cond[:-1, :-1]
nonlocal_resistance = np.linalg.solve(cm, [-1,1,0,0,0])[3]
print nonlocal_resistance
data.append(nonlocal_resistance)
dos = kwant.ldos(sys, energy=1)
x = np.empty(len(dos)/2, float)
for i in xrange(len(dos)/2):
x[i] = dos[2*i]
pyplot.figure()
pyplot.plot(gates, data)
pyplot.xlabel("Vg")
pyplot.ylabel("Resistance")
pyplot.show()
kwant.plotter.map(sys,dos, num_lead_cells=5)
def main():
def family_site(site):
return 'b' if site.family == A else 'y'
sys = make()
kwant.plot(sys)
#plot_conductance(sys, energy=1, Bfields=[i* 0.006 for i in
#xrange(100)])
plot_conductance(sys,energy= 0, gates= np.linspace(-1,1,100))
if __name__ == '__main__':
main()