Skip to content
Snippets Groups Projects
Commit c66173c3 authored by Anton Akhmerov's avatar Anton Akhmerov Committed by Christoph Groth
Browse files

pep8 and typo fix for tutorials

parent 1a077ad2
No related branches found
No related tags found
No related merge requests found
...@@ -8,7 +8,7 @@ ...@@ -8,7 +8,7 @@
# global variable governing the behavior of potential() in # global variable governing the behavior of potential() in
# make_system() # make_system()
@@ -75,19 +76,26 @@ @@ -76,19 +77,26 @@
smatrix = kwant.solve(sys, energy) smatrix = kwant.solve(sys, energy)
data.append(smatrix.transmission(1, 0)) data.append(smatrix.transmission(1, 0))
......
...@@ -8,7 +8,7 @@ ...@@ -8,7 +8,7 @@
# define Pauli-matrices for convenience # define Pauli-matrices for convenience
sigma_0 = numpy.eye(2) sigma_0 = numpy.eye(2)
@@ -72,19 +73,25 @@ @@ -73,19 +74,25 @@
smatrix = kwant.solve(sys, energy) smatrix = kwant.solve(sys, energy)
data.append(smatrix.transmission(1, 0)) data.append(smatrix.transmission(1, 0))
......
...@@ -50,10 +50,10 @@ ...@@ -50,10 +50,10 @@
- pyplot.figure() - pyplot.figure()
+ fig = pyplot.figure() + fig = pyplot.figure()
pyplot.plot(momenta, energy_list) pyplot.plot(momenta, energy_list)
- pyplot.xlabel("momentum [in untis of (lattice constant)^-1]") - pyplot.xlabel("momentum [in units of (lattice constant)^-1]")
- pyplot.ylabel("energy [in units of t]") - pyplot.ylabel("energy [in units of t]")
- pyplot.show() - pyplot.show()
+ pyplot.xlabel("momentum [in untis of (lattice constant)^-1]", + pyplot.xlabel("momentum [in units of (lattice constant)^-1]",
+ fontsize=latex.mpl_label_size) + fontsize=latex.mpl_label_size)
+ pyplot.ylabel("energy [in units of t]", + pyplot.ylabel("energy [in units of t]",
+ fontsize=latex.mpl_label_size) + fontsize=latex.mpl_label_size)
......
--- original --- original
+++ modified +++ modified
@@ -17,6 +17,7 @@ @@ -16,6 +16,7 @@
# For plotting # For plotting
from matplotlib import pyplot from matplotlib import pyplot
...@@ -8,7 +8,7 @@ ...@@ -8,7 +8,7 @@
tau_x = np.array([[0, 1], [1, 0]]) tau_x = np.array([[0, 1], [1, 0]])
tau_z = np.array([[1, 0], [0, -1]]) tau_z = np.array([[1, 0], [0, -1]])
@@ -47,12 +48,20 @@ @@ -46,12 +47,20 @@
# the bandstructure # the bandstructure
energy_list = [lead.energies(k) for k in momenta] energy_list = [lead.energies(k) for k in momenta]
......
...@@ -59,10 +59,10 @@ def make_system(a=1, t=1.0, W=10, L=30): ...@@ -59,10 +59,10 @@ def make_system(a=1, t=1.0, W=10, L=30):
sys.attach_lead(lead1) sys.attach_lead(lead1)
return sys return sys
#HIDDEN_END_yxot #HIDDEN_END_yxot
#HIDDEN_BEGIN_ayuk
#HIDDEN_BEGIN_ayuk
def plot_conductance(sys, energies): def plot_conductance(sys, energies):
# Compute conductance # Compute conductance
data = [] data = []
......
...@@ -19,6 +19,7 @@ from matplotlib import pyplot ...@@ -19,6 +19,7 @@ from matplotlib import pyplot
#HIDDEN_BEGIN_ehso #HIDDEN_BEGIN_ehso
pot = 0 pot = 0
def make_system(a=1, t=1.0, W=10, L=30, L_well=10): def make_system(a=1, t=1.0, W=10, L=30, L_well=10):
# Start with an empty tight-binding system and a single square lattice. # Start with an empty tight-binding system and a single square lattice.
# `a` is the lattice constant (by default set to 1 for simplicity. # `a` is the lattice constant (by default set to 1 for simplicity.
......
...@@ -73,6 +73,7 @@ def make_system(a=1, t=1.0, alpha=0.5, e_z=0.08, W=10, L=30): ...@@ -73,6 +73,7 @@ def make_system(a=1, t=1.0, alpha=0.5, e_z=0.08, W=10, L=30):
return sys return sys
def plot_conductance(sys, energies): def plot_conductance(sys, energies):
# Compute conductance # Compute conductance
data = [] data = []
......
...@@ -25,9 +25,9 @@ sin_30, cos_30 = (1 / 2, sqrt(3) / 2) ...@@ -25,9 +25,9 @@ sin_30, cos_30 = (1 / 2, sqrt(3) / 2)
graphene = kwant.make_lattice([(1, 0), (sin_30, cos_30)], graphene = kwant.make_lattice([(1, 0), (sin_30, cos_30)],
[(0, 0), (0, 1 / sqrt(3))]) [(0, 0), (0, 1 / sqrt(3))])
a, b = graphene.sublattices a, b = graphene.sublattices
#HIDDEN_END_hnla #HIDDEN_END_hnla
#HIDDEN_BEGIN_shzy #HIDDEN_BEGIN_shzy
def make_system(r=10, w=2.0, pot=0.1): def make_system(r=10, w=2.0, pot=0.1):
...@@ -135,7 +135,7 @@ def plot_bandstructure(flead, momenta): ...@@ -135,7 +135,7 @@ def plot_bandstructure(flead, momenta):
pyplot.figure() pyplot.figure()
pyplot.plot(momenta, energy_list) pyplot.plot(momenta, energy_list)
pyplot.xlabel("momentum [in untis of (lattice constant)^-1]") pyplot.xlabel("momentum [in units of (lattice constant)^-1]")
pyplot.ylabel("energy [in units of t]") pyplot.ylabel("energy [in units of t]")
pyplot.show() pyplot.show()
......
...@@ -13,7 +13,6 @@ ...@@ -13,7 +13,6 @@
import kwant import kwant
import numpy as np import numpy as np
from math import pi
# For plotting # For plotting
from matplotlib import pyplot from matplotlib import pyplot
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment