Hi,Seems to me that in your onsite function::
def mu(site, p):
(x, y) = site.pos
if abs(x) < r1 and abs(y) < r1:
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
the condition ``abs(x) < r1 and abs(y) < r1`` actually describes a *square* centred on (0, 0) with sides of length ``2 * r1``, and **not**
a circle centred on (0, 0) with radius ``r1``. There are thus some sites at the corners which are included in this square, the onsites
of which are affected when you change the value of ``mu_inside``. Changing the onsite function to the following should fix your problem::
def mu(site, p):
(x, y) = site.pos
if x**2 + y**2 < 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
Regards,
Joe
P.S. I have not tested the above code. You may need to change your shape function to::
def ring(pos):
(x, y) = pos
rsq = x ** 2 + y ** 2
return (r1 ** 2 <= rsq < r2 ** 2) # changed `<` to `<=`
to avoid some possible annoying edge case