Skip to content
Snippets Groups Projects
Commit c28d9988 authored by Joseph Weston's avatar Joseph Weston
Browse files

run 2to3 on documentation

parent 9e873a9a
No related branches found
No related tags found
No related merge requests found
......@@ -42,8 +42,8 @@ source_suffix = '.rst'
master_doc = 'index'
# General information about the project.
project = u'Kwant'
copyright = u'2011-2015, C. W. Groth (CEA), M. Wimmer, A. R. Akhmerov, X. Waintal (CEA), and others'
project = 'Kwant'
copyright = '2011-2015, C. W. Groth (CEA), M. Wimmer, A. R. Akhmerov, X. Waintal (CEA), and others'
# The version info for the project you're documenting, acts as replacement for
# |version| and |release|, also used in various other places throughout the
......@@ -208,7 +208,7 @@ r"""\makeatletter
# We use "et al." as it is shorter and there's not much space left horizontally.
latex_documents = [
('index', 'kwant.tex', 'Kwant {0} documentation'.format(release),
u'C. W. Groth, M. Wimmer, A. R. Akhmerov, X. Waintal, et al.',
'C. W. Groth, M. Wimmer, A. R. Akhmerov, X. Waintal, et al.',
'manual'),
]
......@@ -249,9 +249,9 @@ class BoundMethodDocumenter(autodoc.FunctionDocumenter):
# Return True iff `member` is a bound method. Taken from
# <http://stackoverflow.com/a/1260881>.
return (isinstance(member, types.MethodType) and
member.im_self is not None and
not issubclass(member.im_class, type) and
member.im_class is not types.ClassType)
member.__self__ is not None and
not issubclass(member.__self__.__class__, type) and
member.__self__.__class__ is not type)
def format_args(self):
args = super(BoundMethodDocumenter, self).format_args()
......
......@@ -118,7 +118,7 @@ def main():
# We should see a conductance that is periodic with the flux quantum
plot_conductance(sys, energy=0.15, fluxes=[0.01 * i * 3 * 2 * pi
for i in xrange(100)])
for i in range(100)])
# Call the main function if the script gets executed (as opposed to imported).
......
......@@ -24,7 +24,7 @@ def make_lead(a=1, t=1.0, W=10):
# build up one unit cell of the lead, and add the hoppings
# to the next unit cell
for j in xrange(W):
for j in range(W):
lead[lat(0, j)] = 4 * t
if j > 0:
......
......@@ -106,7 +106,7 @@ def main():
try:
# We should observe energy levels that flow towards Landau
# level energies with increasing magnetic field.
plot_spectrum(sys, [iB * 0.002 for iB in xrange(100)])
plot_spectrum(sys, [iB * 0.002 for iB in range(100)])
# Plot an eigenmode of a circular dot. Here we create a larger system for
# better spatial resolution.
......@@ -114,8 +114,8 @@ def main():
plot_wave_function(sys)
except ValueError as e:
if e.message == "Input matrix is not real-valued.":
print "The calculation of eigenvalues failed because of a bug in SciPy 0.9."
print "Please upgrade to a newer version of SciPy."
print("The calculation of eigenvalues failed because of a bug in SciPy 0.9.")
print("Please upgrade to a newer version of SciPy.")
else:
raise
......
......@@ -10,7 +10,6 @@
# - Application of all the aspects of tutorials 1-3 to a more complicated
# lattice, namely graphene
from __future__ import division # so that 1/2 == 0.5, and not 0
from math import pi, sqrt, tanh
import kwant
......@@ -102,7 +101,7 @@ def compute_evs(sys):
sparse_mat = sys.hamiltonian_submatrix(sparse=True)
evs = sla.eigs(sparse_mat, 2)[0]
print evs.real
print(evs.real)
#HIDDEN_END_zydk
......@@ -166,11 +165,11 @@ def main():
sys = sys.finalized()
# Compute the band structure of lead 0.
momenta = [-pi + 0.02 * pi * i for i in xrange(101)]
momenta = [-pi + 0.02 * pi * i for i in range(101)]
plot_bandstructure(sys.leads[0], momenta)
# Plot conductance.
energies = [-2 * pot + 4. / 50. * pot * i for i in xrange(51)]
energies = [-2 * pot + 4. / 50. * pot * i for i in range(51)]
plot_conductance(sys, energies)
......
......@@ -43,7 +43,7 @@ def make_system(a=1, t=1.0, W=10, L=30, L_well=10):
#### Define and attach the leads. ####
lead = kwant.Builder(kwant.TranslationalSymmetry((-a, 0)))
lead[(lat(0, j) for j in xrange(W))] = 4 * t
lead[(lat(0, j) for j in range(W))] = 4 * t
lead[lat.neighbors()] = -t
sys.attach_lead(lead)
sys.attach_lead(lead.reversed())
......@@ -79,7 +79,7 @@ def main():
# We should see conductance steps.
plot_conductance(sys, energy=0.2,
welldepths=[0.01 * i for i in xrange(100)])
welldepths=[0.01 * i for i in range(100)])
# Call the main function if the script gets executed (as opposed to imported).
......
......@@ -35,8 +35,8 @@ L = 30
# Define the scattering region
for i in xrange(L):
for j in xrange(W):
for i in range(L):
for j in range(W):
# On-site Hamiltonian
sys[lat(i, j)] = 4 * t
......@@ -59,7 +59,7 @@ left_lead = kwant.Builder(sym_left_lead)
#HIDDEN_END_xcmc
#HIDDEN_BEGIN_ndez
for j in xrange(W):
for j in range(W):
left_lead[lat(0, j)] = 4 * t
if j > 0:
left_lead[lat(0, j), lat(0, j - 1)] = -t
......@@ -75,7 +75,7 @@ sys.attach_lead(left_lead)
sym_right_lead = kwant.TranslationalSymmetry((a, 0))
right_lead = kwant.Builder(sym_right_lead)
for j in xrange(W):
for j in range(W):
right_lead[lat(0, j)] = 4 * t
if j > 0:
right_lead[lat(0, j), lat(0, j - 1)] = -t
......@@ -98,7 +98,7 @@ sys = sys.finalized()
#HIDDEN_BEGIN_buzn
energies = []
data = []
for ie in xrange(100):
for ie in range(100):
energy = ie * 0.01
# compute the scattering matrix at a given energy
......
......@@ -39,7 +39,7 @@ def make_system(a=1, t=1.0, W=10, L=30):
# Construct the left lead.
#HIDDEN_BEGIN_iepx
lead = kwant.Builder(kwant.TranslationalSymmetry((-a, 0)))
lead[(lat(0, j) for j in xrange(W))] = 4 * t
lead[(lat(0, j) for j in range(W))] = 4 * t
lead[lat.neighbors()] = -t
#HIDDEN_END_iepx
......@@ -79,7 +79,7 @@ def main():
sys = sys.finalized()
# We should see conductance steps.
plot_conductance(sys, energies=[0.01 * i for i in xrange(100)])
plot_conductance(sys, energies=[0.01 * i for i in range(100)])
#HIDDEN_END_cjel
......
......@@ -55,7 +55,7 @@ def make_system(a=1, t=1.0, alpha=0.5, e_z=0.08, W=10, L=30):
lead = kwant.Builder(kwant.TranslationalSymmetry((-a, 0)))
#HIDDEN_BEGIN_yliu
lead[(lat(0, j) for j in xrange(W))] = 4 * t * sigma_0 + e_z * sigma_z
lead[(lat(0, j) for j in range(W))] = 4 * t * sigma_0 + e_z * sigma_z
# hoppings in x-direction
lead[kwant.builder.HoppingKind((1, 0), lat, lat)] = \
-t * sigma_0 - 1j * alpha * sigma_y
......@@ -95,7 +95,7 @@ def main():
sys = sys.finalized()
# We should see non-monotonic conductance steps.
plot_conductance(sys, energies=[0.01 * i - 0.3 for i in xrange(100)])
plot_conductance(sys, energies=[0.01 * i - 0.3 for i in range(100)])
# Call the main function if the script gets executed (as opposed to imported).
......
......@@ -35,7 +35,7 @@ def make_lead(a=1, t=1.0, mu=0.7, Delta=0.1, W=10):
# build up one unit cell of the lead, and add the hoppings
# to the next unit cell
for j in xrange(W):
for j in range(W):
lead[lat(0, j)] = (4 * t - mu) * tau_z + Delta * tau_x
if j > 0:
......
......@@ -55,12 +55,12 @@ def make_system(a=1, W=10, L=10, barrier=1.5, barrierpos=(3, 4),
# left electron lead
lead0 = kwant.Builder(sym_left)
lead0[(lat_e(0, j) for j in xrange(W))] = 4 * t - mu
lead0[(lat_e(0, j) for j in range(W))] = 4 * t - mu
lead0[lat_e.neighbors()] = -t
# left hole lead
lead1 = kwant.Builder(sym_left)
lead1[(lat_h(0, j) for j in xrange(W))] = mu - 4 * t
lead1[(lat_h(0, j) for j in range(W))] = mu - 4 * t
lead1[lat_h.neighbors()] = t
#HIDDEN_END_ttth
......@@ -72,7 +72,7 @@ def make_system(a=1, W=10, L=10, barrier=1.5, barrierpos=(3, 4),
lead2 = kwant.Builder(sym_right)
lead2 += lead0
lead2 += lead1
lead2[((lat_e(0, j), lat_h(0, j)) for j in xrange(W))] = Delta
lead2[((lat_e(0, j), lat_h(0, j)) for j in range(W))] = Delta
#HIDDEN_END_mhiw
#### Attach the leads and return the system. ####
......@@ -113,7 +113,7 @@ def main():
# Finalize the system.
sys = sys.finalized()
plot_conductance(sys, energies=[0.002 * i for i in xrange(100)])
plot_conductance(sys, energies=[0.002 * i for i in range(100)])
# Call the main function if the script gets executed (as opposed to imported).
......
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