Skip to content
GitLab
Explore
Sign in
Register
Primary navigation
Search or go to…
Project
K
kwant
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Model registry
Operate
Environments
Monitor
Incidents
Service Desk
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Joseph Weston
kwant
Commits
9eb71bb3
Commit
9eb71bb3
authored
5 years ago
by
Joseph Weston
Browse files
Options
Downloads
Patches
Plain Diff
add parameter declarations to the start of some tutorials
parent
c2cd6d1a
No related branches found
Branches containing commit
No related tags found
No related merge requests found
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
doc/source/tutorial/spin_potential_shape.rst
+24
-39
24 additions, 39 deletions
doc/source/tutorial/spin_potential_shape.rst
doc/source/tutorial/superconductors.rst
+5
-4
5 additions, 4 deletions
doc/source/tutorial/superconductors.rst
with
29 additions
and
43 deletions
doc/source/tutorial/spin_potential_shape.rst
+
24
−
39
View file @
9eb71bb3
...
...
@@ -84,6 +84,15 @@ unit matrix):
sigma_y = tinyarray.array([[0, -1j], [1j, 0]])
sigma_z = tinyarray.array([[1, 0], [0, -1]])
and we also define some other parameters useful for constructing our system:
.. jupyter-execute::
t = 1.0
alpha = 0.5
e_z = 0.08
W, L = 10, 30
Previously, we used numbers as the values of our matrix elements.
However, `~kwant.builder.Builder` also accepts matrices as values, and
we can simply write:
...
...
@@ -91,18 +100,9 @@ we can simply write:
.. jupyter-execute::
:hide-code:
# Start with an empty tight-binding system and a single square lattice.
# `a` is the lattice constant (by default set to 1 for simplicity).
lat = kwant.lattice.square()
syst = kwant.Builder()
t = 1.0
alpha = 0.5
e_z = 0.08
W, L = 10, 30
.. jupyter-execute::
#### Define the scattering region. ####
...
...
@@ -260,22 +260,9 @@ Instead, we use a python *function* to define the onsite energies. We
define the potential profile of a quantum well as:
.. jupyter-execute::
:hide-code:
a = 1
t = 1.0
W, L, L_well = 10, 30, 10
.. jupyter-execute::
# Start with an empty tight-binding system and a single square lattice.
# `a` is the lattice constant (by default set to 1 for simplicity).
lat = kwant.lattice.square(a)
syst = kwant.Builder()
#### Define the scattering region. ####
# Potential profile
def potential(site, pot):
(x, y) = site.pos
if (L - L_well) / 2 < x < (L + L_well) / 2:
...
...
@@ -293,9 +280,15 @@ Kwant now allows us to pass a function as a value to
.. jupyter-execute::
a = 1
t = 1.0
def onsite(site, pot):
return 4 * t + potential(site, pot)
lat = kwant.lattice.square(a)
syst = kwant.Builder()
syst[(lat(x, y) for x in range(L) for y in range(W))] = onsite
syst[lat.neighbors()] = -t
...
...
@@ -429,24 +422,9 @@ that returns ``True`` whenever a point is inside the shape, and
``False`` otherwise:
.. jupyter-execute::
:hide-code:
a = 1
t = 1.0
W = 10
r1, r2 = 10, 20
.. jupyter-execute::
# Start with an empty tight-binding system and a single square lattice.
# `a` is the lattice constant (by default set to 1 for simplicity).
lat = kwant.lattice.square(a)
syst = kwant.Builder()
#### Define the scattering region. ####
# Now, we aim for a more complex shape, namely a ring (or annulus)
def ring(pos):
(x, y) = pos
rsq = x ** 2 + y ** 2
...
...
@@ -461,7 +439,12 @@ provided by the lattice:
.. jupyter-execute::
# and add the corresponding lattice points using the `shape`-function
a = 1
t = 1.0
lat = kwant.lattice.square(a)
syst = kwant.Builder()
syst[lat.shape(ring, (0, r1 + 1))] = 4 * t
syst[lat.neighbors()] = -t
...
...
@@ -515,10 +498,12 @@ For the leads, we can also use the ``lat.shape``-functionality:
.. jupyter-execute::
#### Define the leads. ####
# left lead
W = 10
sym_lead = kwant.TranslationalSymmetry((-a, 0))
lead = kwant.Builder(sym_lead)
def lead_shape(pos):
(x, y) = pos
return (-W / 2 < y < W / 2)
...
...
This diff is collapsed.
Click to expand it.
doc/source/tutorial/superconductors.rst
+
5
−
4
View file @
9eb71bb3
...
...
@@ -85,11 +85,10 @@ a superconductor on the right, and a tunnel barrier in between:
We implement the BdG Hamiltonian in Kwant using a 2x2 matrix structure
for all Hamiltonian matrix elements, as we did
previously in the :ref:`spin example <tutorial_spinorbit>`.
We declare
th
e s
quare lattice and construct the scattering region with
the following:
previously in the :ref:`spin example <tutorial_spinorbit>`.
W
e s
tart by declaring some parameters that will be used in
the following
code
:
.. jupyter-execute::
:hide-code:
a = 1
W, L = 10, 10
...
...
@@ -97,9 +96,11 @@ the square lattice and construct the scattering region with the following:
barrierpos = (3, 4)
mu = 0.4
Delta = 0.1
Deltapos
=
4
Deltapos
=
4
t = 1.0
and we declare the square lattice and construct the scattering region with the following:
.. jupyter-execute::
# Start with an empty tight-binding system. On each site, there
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment