Dear Diego,
I tried yours script and I think that the issue is the one
spotted by Joe:
as leads are translationally invariant, you should also use
functions to set their
Hamiltonian matrix elements that are translationally
invariant as Kwant does not guarantee
the results otherwise (indeed internally the lead is
translated to the fundamental domain but you
don't really need to know that).
The following script, adapted from yours, gives results which
are independent from
p.mu_inside if you use onsite_lead or dependent if you use
onsite on the line where one sets the
lead matrix elements
Best regards,
Xavier
PS: the magic line to get the Hall resistance looks something
like
R= numpy.linalg.solve(G[:-1,:-1], [1, 0, -1])
where G is the transmission matrix in the Buttiker sense I =
(e^2/h) G V
PPS: Michael was faster than me, but I post this anyway as
you can run the script below directly
PPPS Joe, you're on vacation, remember?
import kwant
import scipy, scipy.io
from numpy import *
from pylab import *
import sys
from numpy import mod
from math import pi,atan2
import matplotlib as mpl
from matplotlib import pyplot
import random; import pickle
import tinyarray
import scipy.sparse.linalg
class SimpleNamespace(object):
"""A simple container for parameters."""
def __init__(self, **kwargs):
self.__dict__.update(kwargs)
s_0 = identity(2)
s_z = array([[1, 0], [0, -1]])
s_x = array([[0, 1], [1, 0]])
s_y = array([[0, -1j], [1j, 0]])
#=================================================================================
def make_system(a=1, W=10, r1=10, r2=20):
lat = kwant.lattice.square(a)
sys = kwant.Builder()
def ring(pos):
(x, y) = pos
rsq = x ** 2 + y ** 2
return (r1 ** 2 < rsq < r2 ** 2)
def mu(site, p):
(x, y) = site.pos
if abs(x) < r1/2 and abs(y) < r1/2:
return p.mu_inside # this is the critical
line: changing mu values inside the ring should not change the
ring conductance
else:
return p.mu_ring
def onsite_lead(site, p):
return ( 4.0 * p.t - p.mu_ring) * s_0
def onsite(site, p):
return ( 4.0 * p.t - mu(site, p)) * s_0
def hopping(site0, site1, p):
return -p.t * s_0
#
===============================================================================
sys[lat.shape(ring, (0, r1 + 1))] = onsite
sys[lat.neighbors()] = hopping
#
===================================================================================
sym_lead = kwant.TranslationalSymmetry((-a, 0))
lead = kwant.Builder(sym_lead)
def lead_shape(pos):
(x, y) = pos
return (-W / 2 < y < W / 2)
lead[lat.shape(lead_shape, (0, 0))] = onsite #
onsite_lead CHANGE THIS TO GET DIFFERENT BEHAVIOR
lead[lat.neighbors()] = hopping
sys.attach_lead(lead)
sys.attach_lead(lead.reversed())
return sys
def plot_conductance(sys, p):
smatrix = kwant.smatrix(sys,3., args=[p])
print "CONDUCTANCE: ",smatrix.transmission(1, 0)
def main():
sys = make_system()
kwant.plot(sys)
sys = sys.finalized()
params = SimpleNamespace(t=1.0, mu_ring=0.0,
mu_inside=-1.02)
plot_conductance(sys, p=params)
if __name__ == '__main__':
main()
__________________________________________
Xavier Waintal
SPSMS-INAC-CEA,17 rue des Martyrs, 38054 Grenoble
CEDEX 9, FRANCE
Tel: 33 (0)4 38 78 03 27
email:
xavier.waintal@cea.fr
Hi,
thanks again for your time and your input.
I tried what you said, by setting by hand the onsite
elements of the lead, but it's not solving the problem.
The result is identical to the one with the previous
onsite function.
Diego
On 25/3/14 2:04 AM, Joseph
Weston wrote:
I've just had a thought as to what it could
be, but I can't test it myself right now as
I don't have access to a proper computer.
I think this may be due to the way that kwant
handles leads.
When you create a Builder with a symmetry and
add sites to it then kwant first translates
the sites into the fundamental domain
of the symmetry and adds those to the Builder.
For translational symmetries the fundamental
domain is the one which contains
the point (0, 0). This means that when you
construct your leads with::
lead[lat.shape(lead_shape, (0, 0))] = onsite
then some of the onsites will actually evaluate
to ``mu_inside`` as the lead sites satisfy the
condition within ``onsite``.
You can test this hypothesis by setting the
"sub-region" to something which does not include
the lead's fundamental domain
(in your case a single line of sites in the
y-direction between -W/2 and W/2 passing through the
origin), or by setting the lead
onsites "manually" for testing.
Joe