Skip to content
Snippets Groups Projects

Compare revisions

Changes are shown as if the source revision was being merged into the target revision. Learn more about comparing revisions.

Source

Select target project
No results found

Target

Select target project
  • kwant/kwant
  • jbweston/kwant
  • anton-akhmerov/kwant
  • cwg/kwant
  • Mathieu/kwant
  • slavoutich/kwant
  • pacome/kwant
  • behrmann/kwant
  • michaelwimmer/kwant
  • albeercik/kwant
  • eunjongkim/kwant
  • basnijholt/kwant
  • r-j-skolasinski/kwant
  • sahmed95/kwant
  • pablopiskunow/kwant
  • mare/kwant
  • dvarjas/kwant
  • Paul/kwant
  • bbuijtendorp/kwant
  • tkloss/kwant
  • torosdahl/kwant
  • kel85uk/kwant
  • kpoyhonen/kwant
  • Fromeworld/kwant
  • quaeritis/kwant
  • marwahaha/kwant
  • fernandodfufrpe/kwant
  • oly/kwant
  • jiamingh/kwant
  • mehdi2369/kwant
  • ValFadeev/kwant
  • Kostas/kwant
  • chelseabaptiste03/kwant
33 results
Show changes
Showing
with 25 additions and 691 deletions
......@@ -3,7 +3,7 @@
<svg
xmlns:dc="http://purl.org/dc/elements/1.1/"
xmlns:cc="http://creativecommons.org/ns#"
xmlns:cc="https://creativecommons.org/ns#"
xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
xmlns:svg="http://www.w3.org/2000/svg"
xmlns="http://www.w3.org/2000/svg"
......
......@@ -3,7 +3,7 @@
<svg
xmlns:dc="http://purl.org/dc/elements/1.1/"
xmlns:cc="http://creativecommons.org/ns#"
xmlns:cc="https://creativecommons.org/ns#"
xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
xmlns:svg="http://www.w3.org/2000/svg"
xmlns="http://www.w3.org/2000/svg"
......
......@@ -3,7 +3,7 @@
<svg
xmlns:dc="http://purl.org/dc/elements/1.1/"
xmlns:cc="http://creativecommons.org/ns#"
xmlns:cc="https://creativecommons.org/ns#"
xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
xmlns:svg="http://www.w3.org/2000/svg"
xmlns="http://www.w3.org/2000/svg"
......
################################################################
# Make matplotlib work without X11
################################################################
import matplotlib
matplotlib.use('Agg')
################################################################
# Prepend Kwant's build directory to sys.path
################################################################
import sys
from distutils.util import get_platform
sys.path.insert(0, "../../../build/lib.{0}-{1}.{2}".format(
get_platform(), *sys.version_info[:2]))
################################################################
# Define constants for plotting
################################################################
pt_to_in = 1. / 72.
# Default width of figures in pts
figwidth_pt = 600
figwidth_in = figwidth_pt * pt_to_in
# Width for smaller figures
figwidth_small_pt = 400
figwidth_small_in = figwidth_small_pt * pt_to_in
# Sizes for matplotlib figures
mpl_width_in = figwidth_pt * pt_to_in
mpl_label_size = None # font sizes in points
mpl_tick_size = None
# dpi for conversion from inches
dpi = 90
--- 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 syst
+def make_system_note1(a=1, t=1.0, W=10, r1=10, r2=20):
+ lat = kwant.lattice.square(a)
+ syst = kwant.Builder()
+ def ring(pos):
+ (x, y) = pos
+ rsq = x**2 + y**2
+ return ( r1**2 < rsq < r2**2)
+ syst[lat.shape(ring, (0, 11))] = 4 * t
+ syst[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()
+ syst.attach_lead(lead0)
+ syst.attach_lead(lead1)
+ return syst
+
+
+def make_system_note2(a=1, t=1.0, W=10, r1=10, r2=20):
+ lat = kwant.lattice.square(a)
+ syst = kwant.Builder()
+ def ring(pos):
+ (x, y) = pos
+ rsq = x**2 + y**2
+ return ( r1**2 < rsq < r2**2)
+ syst[lat.shape(ring, (0, 11))] = 4 * t
+ syst[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()
+ syst.attach_lead(lead0)
+ syst.attach_lead(lead1, lat(0, 0))
+ return syst
+
+
def plot_conductance(syst, energy, fluxes):
# compute conductance
@@ -90,18 +135,31 @@
smatrix = kwant.smatrix(syst, 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():
syst = make_system()
# Check that the system looks as intended.
- kwant.plot(syst)
+ size = (_defs.figwidth_in, _defs.figwidth_in)
+ for extension in ('pdf', 'png'):
+ kwant.plot(syst, file="ab_ring_syst." + extension,
+ fig_size=size, dpi=_defs.dpi)
+
# Finalize the system.
syst = syst.finalized()
@@ -111,6 +169,17 @@
for i in range(100)])
+ # Finally, some plots needed for the notes
+ syst = make_system_note1()
+ for extension in ('pdf', 'png'):
+ kwant.plot(syst, file="ab_ring_note1." + extension,
+ fig_size=size, dpi=_defs.dpi)
+ syst = make_system_note2()
+ for extension in ('pdf', 'png'):
+ kwant.plot(syst, 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__':
--- original
+++ modified
@@ -9,6 +9,7 @@
# --------------------------
# - Computing the band structure of a finalized lead.
+import _defs
import kwant
# For plotting.
@@ -36,10 +37,19 @@
def main():
lead = make_lead().finalized()
- kwant.plotter.bands(lead, show=False)
- pyplot.xlabel("momentum [(lattice constant)^-1]")
- pyplot.ylabel("energy [t]")
- pyplot.show()
+ fig = kwant.plotter.bands(lead, show=False)
+ pyplot.xlabel("momentum [(lattice constant)^-1]",
+ fontsize=_defs.mpl_label_size)
+ pyplot.ylabel("energy [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)
+ for extension in ('pdf', 'png'):
+ fig.savefig("band_structure_result." + extension, dpi=_defs.dpi)
+
# Call the main function if the script gets executed (as opposed to imported).
--- original
+++ modified
@@ -11,6 +11,7 @@
# - Use of `hamiltonian_submatrix` in order to obtain a Hamiltonian
# matrix.
+import _defs
from cmath import exp
import numpy as np
import kwant
@@ -68,29 +69,39 @@
energies.append(ev)
- pyplot.figure()
+ fig = pyplot.figure()
pyplot.plot(Bfields, energies)
- pyplot.xlabel("magnetic field [arbitrary units]")
- pyplot.ylabel("energy [t]")
- pyplot.show()
+ pyplot.xlabel("magnetic field [arbitrary units]",
+ fontsize=_defs.mpl_label_size)
+ pyplot.ylabel("energy [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)
+ for extension in ('pdf', 'png'):
+ fig.savefig("closed_system_result." + extension, dpi=_defs.dpi)
def plot_wave_function(syst):
+ size = (_defs.figwidth_in, _defs.figwidth_in)
+
# Calculate the wave functions in the system.
ham_mat = syst.hamiltonian_submatrix(sparse=True)
evecs = sla.eigsh(ham_mat, k=20, which='SM')[1]
# Plot the probability density of the 10th eigenmode.
- kwant.plotter.map(syst, np.abs(evecs[:, 9])**2,
- colorbar=False, oversampling=1)
+ for extension in ('pdf', 'png'):
+ kwant.plotter.map(
+ syst, np.abs(evecs[:, 9])**2, colorbar=False, oversampling=1,
+ file="closed_system_eigenvector." + extension,
+ fig_size=size, dpi=_defs.dpi)
def main():
syst = make_system()
- # Check that the system looks as intended.
- kwant.plot(syst)
-
# Finalize the system.
syst = syst.finalized()
# !/bin/sh
# This script regenerates the .diff files in this directory. It's these files
# that are kept under vesion control instead of the scripts themselves.
for f in [a-zA-Z]*.py; do
# We use custom labels to suppress the time stamps which are unnecessary
# here and would only lead to noise in version control.
grep -v '#HIDDEN' ../tutorial/$f |
diff -u --label original --label modified - $f >$f.diff_
if cmp $f.diff_ $f.diff >/dev/null 2>&1; then
rm $f.diff_
else
mv $f.diff_ $f.diff
fi
done
--- original
+++ modified
@@ -10,6 +10,7 @@
# - Application of all the aspects of tutorials 1-3 to a more complicated
# lattice, namely graphene
+import _defs
from math import pi, sqrt, tanh
import kwant
@@ -96,22 +97,40 @@
smatrix = kwant.smatrix(syst, energy)
data.append(smatrix.transmission(0, 1))
- pyplot.figure()
+ fig = pyplot.figure()
pyplot.plot(energies, data)
- pyplot.xlabel("energy [t]")
- pyplot.ylabel("conductance [e^2/h]")
- pyplot.show()
+ pyplot.xlabel("energy [t]",
+ 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)
+ for extension in ('pdf', 'png'):
+ fig.savefig("graphene_result." + extension, 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 [(lattice constant)^-1]")
- pyplot.ylabel("energy [t]")
- pyplot.show()
+ pyplot.xlabel("momentum [(lattice constant)^-1]",
+ fontsize=_defs.mpl_label_size)
+ pyplot.ylabel("energy [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)
+ for extension in ('pdf', 'png'):
+ fig.savefig("graphene_bs." + extension, dpi=_defs.dpi)
def main():
@@ -123,8 +142,11 @@
def family_colors(site):
return 0 if site.family == a else 1
- # Plot the closed system without leads.
- kwant.plot(syst, site_color=family_colors, site_lw=0.1, colorbar=False)
+ size = (_defs.figwidth_in, _defs.figwidth_in)
+ for extension in ('pdf', 'png'):
+ kwant.plot(syst, site_color=family_colors, site_lw=0.1, colorbar=False,
+ file="graphene_syst1." + extension,
+ fig_size=size, dpi=_defs.dpi)
# Compute some eigenvalues.
compute_evs(syst.finalized())
@@ -133,9 +155,11 @@
for lead in leads:
syst.attach_lead(lead)
- # Then, plot the system with leads.
- kwant.plot(syst, site_color=family_colors, site_lw=0.1,
- lead_site_lw=0, colorbar=False)
+ size = (_defs.figwidth_in, 0.9 * _defs.figwidth_in)
+ for extension in ('pdf', 'png'):
+ kwant.plot(syst, site_color=family_colors, colorbar=False, site_lw=0.1,
+ file="graphene_syst2." + extension,
+ fig_size=size, dpi=_defs.dpi, lead_site_lw=0)
# Finalize the system.
syst = syst.finalized()
--- original
+++ modified
@@ -9,6 +9,7 @@
# --------------------------
# - demonstrate different ways of plotting
+import _defs
import kwant
from matplotlib import pyplot
@@ -22,7 +23,7 @@
return x**2 + y**2 < r**2
syst = kwant.Builder()
- syst[lat.shape(circle, (0, 0))] = 0
+ syst[lat.shape(circle, (0,0))] = 0
syst[lat.neighbors()] = t
syst.eradicate_dangling()
if tp:
@@ -32,9 +33,11 @@
def plot_system(syst):
- kwant.plot(syst)
- # the standard plot is ok, but not very intelligible. One can do
- # better by playing wioth colors and linewidths
+ # standard plot - not very intelligible for this particular situation
+ size = (_defs.figwidth_in, _defs.figwidth_in)
+ for extension in ('pdf', 'png'):
+ kwant.plot(syst, file="plot_graphene_syst1." + extension,
+ fig_size=size, dpi=_defs.dpi)
# use color and linewidths to get a better plot
def family_color(site):
@@ -43,7 +46,11 @@
def hopping_lw(site1, site2):
return 0.04 if site1.family == site2.family else 0.1
- kwant.plot(syst, site_lw=0.1, site_color=family_color, hop_lw=hopping_lw)
+ size = (_defs.figwidth_in, _defs.figwidth_in)
+ for extension in ('pdf', 'png'):
+ kwant.plot(syst, site_lw=0.1, site_color=family_color,
+ hop_lw=hopping_lw, file="plot_graphene_syst2." + extension,
+ fig_size=size, dpi=_defs.dpi)
def plot_data(syst, n):
@@ -58,7 +65,11 @@
# the usual - works great in general, looks just a bit crufty for
# small systems
- kwant.plotter.map(syst, wf, oversampling=10, cmap='gist_heat_r')
+ size = (_defs.figwidth_in, _defs.figwidth_in)
+ for extension in ('pdf', 'png'):
+ kwant.plotter.map(syst, wf, oversampling=10, cmap='gist_heat_r',
+ file="plot_graphene_data1." + extension,
+ fig_size=size, dpi=_defs.dpi)
# use two different sort of triangles to cleanly fill the space
def family_shape(i):
@@ -68,15 +79,22 @@
def family_color(i):
return 'black' if syst.site(i).family == a else 'white'
- kwant.plot(syst, site_color=wf, site_symbol=family_shape,
- site_size=0.5, hop_lw=0, cmap='gist_heat_r')
+ size = (_defs.figwidth_in, _defs.figwidth_in)
+ for extension in ('pdf', 'png'):
+ kwant.plot(syst, site_color=wf, site_symbol=family_shape,
+ site_size=0.5, hop_lw=0, cmap='gist_heat_r',
+ file="plot_graphene_data2." + extension,
+ fig_size=size, dpi=_defs.dpi)
# plot by changing the symbols itself
def site_size(i):
return 3 * wf[i] / wf.max()
- kwant.plot(syst, site_size=site_size, site_color=(0, 0, 1, 0.3),
- hop_lw=0.1)
+ size = (_defs.figwidth_in, _defs.figwidth_in)
+ for extension in ('pdf', 'png'):
+ kwant.plot(syst, site_size=site_size, site_color=(0,0,1,0.3),
+ hop_lw=0.1, file="plot_graphene_data3." + extension,
+ fig_size=size, dpi=_defs.dpi)
def main():
--- original
+++ modified
@@ -9,6 +9,7 @@
# --------------------------
# - demonstrate different ways of plotting in 3D
+import _defs
import kwant
from matplotlib import pyplot
@@ -33,7 +34,10 @@
# checking shapes:
syst = make_cuboid()
- kwant.plot(syst)
+ size = (_defs.figwidth_in, _defs.figwidth_in)
+ for extension in ('pdf', 'png'):
+ kwant.plot(syst, file="plot_zincblende_syst1." + extension,
+ fig_size=size, dpi=_defs.dpi)
# visualize the crystal structure better for a very small system
syst = make_cuboid(a=1.5, b=1.5, c=1.5)
@@ -41,8 +45,12 @@
def family_colors(site):
return 'r' if site.family == a else 'g'
- kwant.plot(syst, site_size=0.18, site_lw=0.01, hop_lw=0.05,
- site_color=family_colors)
+ size = (_defs.figwidth_in, _defs.figwidth_in)
+ for extension in ('pdf', 'png'):
+ kwant.plot(syst, site_size=0.18, site_lw=0.01, hop_lw=0.05,
+ site_color=family_colors,
+ file="plot_zincblende_syst2." + extension,
+ fig_size=size, dpi=_defs.dpi)
# Call the main function if the script gets executed (as opposed to imported).
--- original
+++ modified
@@ -9,6 +9,7 @@
# --------------------------
# - Functions as values in Builder
+import _defs
import kwant
# For plotting
@@ -55,19 +56,25 @@
smatrix = kwant.smatrix(syst, energy, args=[-welldepth])
data.append(smatrix.transmission(1, 0))
- pyplot.figure()
+ fig = pyplot.figure()
pyplot.plot(welldepths, data)
- pyplot.xlabel("well depth [t]")
- pyplot.ylabel("conductance [e^2/h]")
- pyplot.show()
+ pyplot.xlabel("well depth [t]",
+ 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)
+ for extension in ('pdf', 'png'):
+ fig.savefig("quantum_well_result." + extension, dpi=_defs.dpi)
def main():
syst = make_system()
- # Check that the system looks as intended.
- kwant.plot(syst)
-
# Finalize the system.
syst = syst.finalized()
--- original
+++ modified
@@ -11,6 +11,7 @@
# - Making scattering region and leads
# - Using the simple sparse solver for computing Landauer conductance
+import _defs
from matplotlib import pyplot
import kwant
@@ -69,7 +70,10 @@
syst.attach_lead(right_lead)
# Plot it, to make sure it's OK
-kwant.plot(syst)
+size = (_defs.figwidth_in, 0.3 * _defs.figwidth_in)
+for extension in ('pdf', 'png'):
+ kwant.plot(syst, file="quantum_wire_syst." + extension,
+ fig_size=size, dpi=_defs.dpi)
# Finalize the system
syst = syst.finalized()
@@ -90,8 +94,13 @@
# Use matplotlib to write output
# We should see conductance steps
-pyplot.figure()
+fig = pyplot.figure()
pyplot.plot(energies, data)
-pyplot.xlabel("energy [t]")
-pyplot.ylabel("conductance [e^2/h]")
-pyplot.show()
+pyplot.xlabel("energy [t]", 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)
+for extension in ('pdf', 'png'):
+ fig.savefig("quantum_wire_result." + extension, dpi=_defs.dpi)
--- original
+++ modified
@@ -13,6 +13,7 @@
# --------------------------
# - Numpy matrices as values in Builder
+import _defs
import kwant
# For plotting
@@ -70,19 +71,24 @@
smatrix = kwant.smatrix(syst, energy)
data.append(smatrix.transmission(1, 0))
- pyplot.figure()
+ fig = pyplot.figure()
pyplot.plot(energies, data)
- pyplot.xlabel("energy [t]")
- pyplot.ylabel("conductance [e^2/h]")
- pyplot.show()
+ pyplot.xlabel("energy [t]", 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)
+ for extension in ('pdf', 'png'):
+ fig.savefig("spin_orbit_result." + extension, dpi=_defs.dpi)
def main():
syst = make_system()
- # Check that the system looks as intended.
- kwant.plot(syst)
-
# Finalize the system.
syst = syst.finalized()
--- original
+++ modified
@@ -13,6 +13,7 @@
# - Main motivation is to contrast to the implementation of superconductivity
# in tutorial5b.py
+import _defs
import kwant
import numpy as np
@@ -49,11 +50,20 @@
# Make system and finalize it right away.
lead = make_lead().finalized()
- kwant.plotter.bands(lead, momenta=np.linspace(-1.5, 1.5, 101), show=False)
+ fig = kwant.plotter.bands(lead, momenta=np.linspace(-1.5, 1.5, 101),
+ show=False)
pyplot.xlabel("momentum [(lattice constant)^-1]")
pyplot.ylabel("energy [t]")
pyplot.ylim([-0.8, 0.8])
- pyplot.show()
+ 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)
+ for extension in ('pdf', 'png'):
+ fig.savefig("superconductor_band_structure_result." + extension,
+ dpi=_defs.dpi)
# Call the main function if the script gets executed (as opposed to imported).
--- original
+++ modified
@@ -10,6 +10,7 @@
# - Implementing electron and hole ("orbital") degrees of freedom
# using different lattices
+import _defs
import kwant
# For plotting
@@ -85,19 +86,24 @@
smatrix.transmission(0, 0) +
smatrix.transmission(1, 0))
- pyplot.figure()
+ fig = pyplot.figure()
pyplot.plot(energies, data)
pyplot.xlabel("energy [t]")
pyplot.ylabel("conductance [e^2/h]")
- pyplot.show()
+ 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)
+ for extension in ('pdf', 'png'):
+ fig.savefig("superconductor_transport_result." + extension,
+ dpi=_defs.dpi)
def main():
syst = make_system()
- # Check that the system looks as intended.
- kwant.plot(syst)
-
# Finalize the system.
syst = syst.finalized()
......@@ -4,7 +4,7 @@ Kwant |release| documentation
.. toctree::
:maxdepth: 2
:numbered: 3
:numbered: 2
pre/index
tutorial/index
......
......@@ -21,14 +21,14 @@ New MUMPS-based solver
----------------------
The code for sparse matrix solvers has been reorganized and a new solver has
been added next to `kwant.solvers.sparse`: `kwant.solvers.mumps`. The new
solver uses the `MUMPS <http://graal.ens-lyon.fr/MUMPS/>`_ software package and
solver uses the `MUMPS <https://graal.ens-lyon.fr/MUMPS/>`_ software package and
is much (typically several times) faster than the UMFPACK-based old solver.
In addition, MUMPS uses considerably less memory for a given system while at
the same time it is able to take advantage of more than 2 GiB of RAM.
New tutorial dealing with superconductivity
-------------------------------------------
:doc:`../../tutorial/tutorial5`
:doc:`../../tutorial/superconductors`
New `~kwant.plotter` module
---------------------------
......@@ -71,7 +71,7 @@ Band structure functionality has been moved
The functionality that used to be provided by the method ``energies`` of
`kwant.system.InfiniteSystem` has been moved to the `kwant.physics` package.
See the documentation of `kwant.physics.Bands` and
:doc:`../../tutorial/tutorial3`.
:doc:`../../tutorial/spectrum`.
Calculation of the local density of states
------------------------------------------
......@@ -89,6 +89,6 @@ wave function in the scattering region due to any mode of any lead.
Return value of sparse solver
-----------------------------
The function `~kwant.solvers.default.solve` of sparse solvers now
always returns a single instance of `~kwant.solvers.common.BlockResult`. The
always returns a single instance of ``BlockResult``. The
latter has been generalized to include more information for leads defined as
infinite systems.
......@@ -2,8 +2,9 @@ What's new in Kwant 1.0
=======================
This article explains the new features in Kwant 1.0 compared to Kwant 0.2.
Kwant 1.0 was released on 9 September 2013.
Please consult the `full list of changes in Kwant <http://git.kwant-project.org/kwant/log/?h=v1.0.5>`_ for all the changes up to the most recent bugfix release.
Kwant 1.0 was released on 9 September 2013. Please consult the `full list of
changes in Kwant <https://gitlab.kwant-project.org/kwant/kwant/-/commits/v1.0.5>`_
for all the changes up to the most recent bugfix release.
Lattice and shape improvements
......@@ -61,7 +62,7 @@ Some renames
scattering matrix, the latter the retarded Green's function between the sites
adjacent to the leads. It is temporarily not possible to mix self-energy and
modes leads within the same system.
* The object that contained the results, `BlockResult` was also split into
* The object that contained the results, ``BlockResult`` was also split into
`~kwant.solvers.common.SMatrix` and `~kwant.solvers.common.GreensFunction`.
Band structure plots
......@@ -71,8 +72,8 @@ structure was implemented.
Immutable site families
-----------------------
In order to make naming more consistent, `kwant.make_lattice` was renamed and
can be found now as `~kwant.lattice.general`. Classes ``Chain``, ``Square``,
In order to make naming more consistent, ``kwant.make_lattice`` was renamed and
can be found now as `kwant.lattice.general`. Classes ``Chain``, ``Square``,
and ``Honeycomb`` from `~kwant.lattice` were made functions
`~kwant.lattice.chain`, `~kwant.lattice.square`, and
`~kwant.lattice.honeycomb`.
......@@ -83,7 +84,7 @@ lattices. This often led to confusions in more convoluted use cases, so this
behavior was changed. Now two site families created with the same parameters
are actually indistinguishable by Kwant. If it is desired to make two site
families which have the same geometry, but mean different things, as for
instance in :doc:`../../tutorial/tutorial5`, then the ``name`` argument has to
instance in :doc:`../../tutorial/superconductors`, then the ``name`` argument has to
be used when creating a lattice, e.g. ``a = kwant.lattice.square(name='a'); b =
kwant.lattice.square(name='b')``.
......
What's new in Kwant 1.1
=======================
This article explains the user-visible changes in Kwant 1.1, released on 21 October 2015.
Please consult the `full list of changes in Kwant <http://git.kwant-project.org/kwant/log/?h=stable>`_ for all the changes up to the most recent bugfix release.
This article explains the user-visible changes in Kwant 1.1.0, released on 21
October 2015. See also the `full list of changes up to the most recent bugfix
release of the 1.1 series
<https://gitlab.kwant-project.org/kwant/kwant/-/compare/v1.1.0...latest-1.1>`_.
Harmonize `~kwant.physics.Bands` with `~kwant.physics.modes`
------------------------------------------------------------
......@@ -51,11 +53,11 @@ book by S. Datta.
Deduction of transmission probabilities
---------------------------------------
If `kwant.smatrix` or `kwant.greens_function` have been called with
``check_hermicity=True`` (on by default) and a restricted number of leads in
the ``out_leads`` and ``in_leads`` parameters, calls to ``transmission`` and
``conductance_matrix`` will work whenever it is possible to deduce the result
from current conservation.
If `~kwant.solvers.common.smatrix` or `~kwant.solvers.common.greens_function`
have been called with ``check_hermicity=True`` (on by default) and a restricted
number of leads in the ``out_leads`` and ``in_leads`` parameters, calls to
``transmission`` and ``conductance_matrix`` will work whenever it is possible
to deduce the result from current conservation.
This allows leaving out one lead (preferably the widest) from ``out_leads``
and ``in_leads``, and still to calculate all transmission probabilities.
......@@ -76,7 +78,7 @@ the error message will be more helpful now.
Please continue reporting confusing error messages on the Kwant mailing list.
New option ``pos_transform`` of `~kwant.plotter.map`
New option ``pos_transform`` of `kwant.plotter.map`
----------------------------------------------------------------
This option which already existed for `kwant.plotter.plot` is now also
available for `kwant.plotter.map`.