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
eb32e511
Commit
eb32e511
authored
5 years ago
by
Joseph Weston
Browse files
Options
Downloads
Patches
Plain Diff
add example script to whatsnew file
parent
6d0e0aab
No related branches found
Branches containing commit
No related tags found
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
doc/source/pre/whatsnew/1.3.rst
+72
-9
72 additions, 9 deletions
doc/source/pre/whatsnew/1.3.rst
with
72 additions
and
9 deletions
doc/source/pre/whatsnew/1.3.rst
+
72
−
9
View file @
eb32e511
...
@@ -28,11 +28,40 @@ tight-binding band structures or construct systems with different/lower
...
@@ -28,11 +28,40 @@ tight-binding band structures or construct systems with different/lower
symmetry. For example in just a few lines we can construct a two-band model that exhibits
symmetry. For example in just a few lines we can construct a two-band model that exhibits
a quantum anomalous spin Hall phase:
a quantum anomalous spin Hall phase:
.. literalinclude:: ../../code/include/plot_qahe.py
.. jupyter-kernel::
:start-after: HIDDEN_BEGIN_model
:id: plot_qahe
:end-before: HIDDEN_END_model
.. jupyter-execute::
:hide-code:
# Comprehensive example: quantum anomalous Hall effect
# ====================================================
#
# Physics background
# ------------------
# + Quantum anomalous Hall effect
#
# Features highlighted
# --------------------
# + Use of `kwant.continuum` to discretize a continuum Hamiltonian
# + Use of `kwant.operator` to compute local current
# + Use of `kwant.plotter.current` to plot local current
import math
import matplotlib.pyplot
import kwant
import kwant.continuum
.. jupyter-execute::
def make_model(a):
ham = ("alpha * (k_x * sigma_x - k_y * sigma_y)"
"+ (m + beta * kk) * sigma_z"
"+ (gamma * kk + U) * sigma_0")
subs = {"kk": "k_x**2 + k_y**2"}
return kwant.continuum.discretize(ham, locals=subs, grid=a)
From: :download:
`QAHE example script <../../code/download/
plot_qahe
.py>
`
From: :
jupyter-
download:
script:`
plot_qahe`
See the tutorial: :doc:`../../tutorial/discretize`
See the tutorial: :doc:`../../tutorial/discretize`
...
@@ -71,13 +100,47 @@ The example below shows edge states of a quantum anomalous Hall phase
...
@@ -71,13 +100,47 @@ The example below shows edge states of a quantum anomalous Hall phase
of the two-band model shown in the `above section
of the two-band model shown in the `above section
<#tools-for-continuum-hamiltonians>`_:
<#tools-for-continuum-hamiltonians>`_:
.. literalinclude:: ../../code/include/plot_qahe.py
.. jupyter-execute::
:start-after: HIDDEN_BEGIN_current
:hide-code:
:end-before: HIDDEN_END_current
def make_system(model, L):
def lead_shape(site):
x, y = site.pos / L
return abs(y) < 0.5
# QPC shape: a rectangle with 2 gaussians
# etched out of the top and bottom edge.
def central_shape(site):
x, y = site.pos / L
return abs(x) < 3/5 and abs(y) < 0.5 - 0.4 * math.exp(-40 * x**2)
lead = kwant.Builder(kwant.TranslationalSymmetry(
model.lattice.vec((-1, 0))))
lead.fill(model, lead_shape, (0, 0))
syst = kwant.Builder()
syst.fill(model, central_shape, (0, 0))
syst.attach_lead(lead)
syst.attach_lead(lead.reversed())
return syst.finalized()
# Set up our model and system, and define the model parameters.
params = dict(alpha=0.365, beta=0.686, gamma=0.512, m=-0.01, U=0)
model = make_model(1)
syst = make_system(model, 70)
# Calculate the scattering states at energy 'm' coming from the left
# lead, and the associated particle current.
psi = kwant.wave_function(syst, energy=params['m'], params=params)(0)
.. jupyter-execute::
.. image:: ../../code/figure/plot_qahe_current.*
J = kwant.operator.Current(syst).bind(params=params)
current = sum(J(p) for p in psi)
kwant.plotter.current(syst, current);
From: :download:
`QAHE example script <../../code/download/
plot_qahe
.py>
`
From: :
jupyter-
download:
script:`
plot_qahe`
Scattering states with discrete symmetries and conservation laws
Scattering states with discrete symmetries and conservation laws
----------------------------------------------------------------
----------------------------------------------------------------
...
...
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