Skip to content
Snippets Groups Projects
Forked from kwant / kwant
1563 commits behind the upstream repository.
graphene.py.diff 3.47 KiB
--- original
+++ modified
@@ -17,6 +17,7 @@
 
 # For plotting
 from matplotlib import pyplot
+import _defs
 
 
 # Define the graphene lattice
@@ -63,7 +64,7 @@
         return (-1 < x < 1) and (-0.4 * r < y < 0.4 * r)
 
     lead0 = kwant.Builder(sym0)
-    lead0[graphene.shape(lead0_shape, (0, 0))] = -pot
+    lead0[graphene.shape(lead0_shape, (0, 0))] = - pot
     for hopping in hoppings:
         lead0[lead0.possible_hoppings(*hopping)] = -1
 
@@ -105,22 +106,40 @@
         smatrix = kwant.solve(sys, energy)
         data.append(smatrix.transmission(0, 1))
 
-    pyplot.figure()
+    fig = pyplot.figure()
     pyplot.plot(energies, data)
-    pyplot.xlabel("energy [in units of t]")
-    pyplot.ylabel("conductance [in units of e^2/h]")
-    pyplot.show()
+    pyplot.xlabel("energy [in units of t]",
+                 fontsize=_defs.mpl_label_size)
+    pyplot.ylabel("conductance [in units of 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("graphene_result.pdf")
+    fig.savefig("graphene_result.png", dpi=_defs.dpi)
 
 
 def plot_bandstructure(flead, momenta):
     bands = kwant.physics.Bands(flead)
     energies = [bands(k) for k in momenta]
 
-    pyplot.figure()
+    fig = pyplot.figure()
     pyplot.plot(momenta, energies)
-    pyplot.xlabel("momentum [in units of (lattice constant)^-1]")
-    pyplot.ylabel("energy [in units of t]")
-    pyplot.show()
+    pyplot.xlabel("momentum [in units of (lattice constant)^-1]",
+                 fontsize=_defs.mpl_label_size)
+    pyplot.ylabel("energy [in units of t]",
+                 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("graphene_bs.pdf")
+    fig.savefig("graphene_bs.png", dpi=_defs.dpi)
 
 
 def main():
@@ -133,17 +152,22 @@
         return 0 if site.group == a else 1
 
     # Plot the closed system without leads.
-    kwant.plot(sys, site_color=group_colors, colorbar=False)
-
-    # Compute some eigenvalues.
-    compute_evs(sys.finalized())
+    size = (_defs.figwidth_in, _defs.figwidth_in)
+    kwant.plot(sys, site_color=group_colors, colorbar=False,
+               file="graphene_sys1.pdf", fig_size=size, dpi=_defs.dpi)
+    kwant.plot(sys, site_color=group_colors, colorbar=False,
+               file="graphene_sys1.png", fig_size=size, dpi=_defs.dpi)
 
     # Attach the leads to the system.
     for lead in leads:
         sys.attach_lead(lead)
 
     # Then, plot the system with leads.
-    kwant.plot(sys, site_color=group_colors, colorbar=False)
+    size = (_defs.figwidth_in, 0.9 * _defs.figwidth_in)
+    kwant.plot(sys, site_color=group_colors, colorbar=False,
+               file="graphene_sys2.pdf", fig_size=size, dpi=_defs.dpi)
+    kwant.plot(sys, site_color=group_colors, colorbar=False,
+               file="graphene_sys2.png", fig_size=size, dpi=_defs.dpi)
 
     # Finalize the system.
     sys = sys.finalized()