Forked from
kwant / kwant
1084 commits behind the upstream repository.
-
Christoph Groth authoredChristoph Groth authored
ab_ring.py.diff 3.61 KiB
--- original
+++ modified
@@ -12,6 +12,7 @@
# example, but in the tutorial main text)
# - Modifcations of hoppings/sites after they have been added
+import _defs
from cmath import exp
from math import pi
@@ -81,6 +82,50 @@
return sys
+def make_system_note1(a=1, t=1.0, 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)
+ sys[lat.shape(ring, (0, 11))] = 4 * t
+ sys[lat.neighbors()] = -t
+ sym_lead0 = kwant.TranslationalSymmetry((-a, 0))
+ lead0 = kwant.Builder(sym_lead0)
+ def lead_shape(pos):
+ (x, y) = pos
+ return (-1 < x < 1) and ( 0.5 * W < y < 1.5 * W )
+ lead0[lat.shape(lead_shape, (0, W))] = 4 * t
+ lead0[lat.neighbors()] = -t
+ lead1 = lead0.reversed()
+ sys.attach_lead(lead0)
+ sys.attach_lead(lead1)
+ return sys
+
+
+def make_system_note2(a=1, t=1.0, 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)
+ sys[lat.shape(ring, (0, 11))] = 4 * t
+ sys[lat.neighbors()] = -t
+ sym_lead0 = kwant.TranslationalSymmetry((-a, 0))
+ lead0 = kwant.Builder(sym_lead0)
+ def lead_shape(pos):
+ (x, y) = pos
+ return (-1 < x < 1) and ( -W/2 < y < W/2 )
+ lead0[lat.shape(lead_shape, (0, 0))] = 4 * t
+ lead0[lat.neighbors()] = -t
+ lead1 = lead0.reversed()
+ sys.attach_lead(lead0)
+ sys.attach_lead(lead1, lat(0, 0))
+ return sys
+
+
def plot_conductance(sys, energy, fluxes):
# compute conductance
@@ -90,18 +135,31 @@
smatrix = kwant.smatrix(sys, energy, args=[flux])
data.append(smatrix.transmission(1, 0))
- pyplot.figure()
+ fig = pyplot.figure()
pyplot.plot(normalized_fluxes, data)
- pyplot.xlabel("flux [flux quantum]")
- pyplot.ylabel("conductance [e^2/h]")
- pyplot.show()
+ pyplot.xlabel("flux [flux quantum]",
+ fontsize=_defs.mpl_label_size)
+ pyplot.ylabel("conductance [e^2/h]",
+ fontsize=_defs.mpl_label_size)
+ pyplot.setp(fig.get_axes()[0].get_xticklabels(),
+ fontsize=_defs.mpl_tick_size)
+ pyplot.setp(fig.get_axes()[0].get_yticklabels(),
+ fontsize=_defs.mpl_tick_size)
+ fig.set_size_inches(_defs.mpl_width_in, _defs.mpl_width_in * 3. / 4.)
+ fig.subplots_adjust(left=0.15, right=0.95, top=0.95, bottom=0.15)
+ fig.savefig("ab_ring_result.pdf")
+ fig.savefig("ab_ring_result.png", dpi=_defs.dpi)
def main():
sys = make_system()
# Check that the system looks as intended.
- kwant.plot(sys)
+ size = (_defs.figwidth_in, _defs.figwidth_in)
+ for extension in ('pdf', 'png'):
+ kwant.plot(sys, file="ab_ring_sys." + extension,
+ fig_size=size, dpi=_defs.dpi)
+
# Finalize the system.
sys = sys.finalized()
@@ -111,6 +169,17 @@
for i in xrange(100)])
+ # Finally, some plots needed for the notes
+ sys = make_system_note1()
+ for extension in ('pdf', 'png'):
+ kwant.plot(sys, file="ab_ring_note1." + extension,
+ fig_size=size, dpi=_defs.dpi)
+ sys = make_system_note2()
+ for extension in ('pdf', 'png'):
+ kwant.plot(sys, file="ab_ring_note2." + extension,
+ fig_size=size, dpi=_defs.dpi)
+
+
# Call the main function if the script gets executed (as opposed to imported).
# See <http://docs.python.org/library/__main__.html>.
if __name__ == '__main__':