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

update tutorial discussion of HoppingKind

parent a4aca30b
No related branches found
No related tags found
No related merge requests found
...@@ -307,18 +307,21 @@ feature of kwant: ...@@ -307,18 +307,21 @@ feature of kwant:
:start-after: #HIDDEN_BEGIN_nooi :start-after: #HIDDEN_BEGIN_nooi
:end-before: #HIDDEN_END_nooi :end-before: #HIDDEN_END_nooi
In regular lattices, one has only very few types of different hoppings In regular lattices, hoppings form large groups such that hoppings within a
(by one lattice point in x or y-direction in the case of a square group can be transformed into one another by lattice translations. In order to
lattice considered here). For the square lattice, these types of allow to easily manipulate such hoppings, an object
hoppings are stored as a list in ``lat.nearest``, and the ``for``-loop `~kwant.builder.HoppingKind` is provided. When given a `~kwant.builder.Builder` as
runs over all of them. an argument, `~kwant.builder.HoppingKind` yields all the hoppings of a
`~kwant.builder.Builder.possible_hoppings` takes as an argument certain kind that can be added to this builder without adding new sites. When
one type of hopping (more about that in the notes below; `~kwant.builder.HoppingKind` is given to `~kwant.builder.Builder` as a key, it
details on the hopping definition will be discussed in means that something is done to all the possible hoppings of this kind. A list
:ref:`tutorial_spinorbit`), and generates all of `~kwant.builder.HoppingKind` objects corresponding to nearest neighbors in
hoppings of this type that are possible with all the lattice points pre-defined lattices in kwant (that is `~kwant.lattice.chain`,
that were added before. ``sys[sys.possible_hoppings(*hopping)] = -t`` `~kwant.lattice.square`, and `~kwant.lattice.honeycomb`) is stored in
then sets all of those hopping matrix elements at once. ``lat.nearest``. ``sys[lat.nearest] = -t`` then sets all of those hopping
matrix elements at once. More detailed example of using
`~kwant.builder.HoppingKind` directly will be provided in
:ref:`tutorial_spinorbit`.
The leads can be constructed in an analogous way: The leads can be constructed in an analogous way:
...@@ -390,16 +393,16 @@ The result of the example should be identical to the previous one. ...@@ -390,16 +393,16 @@ The result of the example should be identical to the previous one.
:end-before: #HIDDEN_END_nooi :end-before: #HIDDEN_END_nooi
we write ``*hopping`` instead of ``hopping``. The reason is as follows: we write ``*hopping`` instead of ``hopping``. The reason is as follows:
`~kwant.builder.Builder.possible_hoppings` expects the hopping to `~kwant.builder.HoppingKind` expects the hopping to
be defined using three parameters (in particular, a tuple be defined using three parameters (in particular, a tuple
containing a relative lattice vector, and two (sub)lattice objects that containing a relative lattice vector, and two (sub)lattice objects that
indicate the start and end lattice, more about that in indicate the start and end lattice, more about that in
a :ref:`later tutorial <tutorial_spinorbit>`). ``lat.nearest`` a :ref:`later tutorial <tutorial_spinorbit>`). ``lat.nearest``
is a list of tuples, with every tuple containing the three is a list of tuples, with every tuple containing the three
parameters expected by `~kwant.builder.Builder.possible_hoppings`. parameters expected by `~kwant.builder.HoppingKind`.
Hence, ``hopping`` is a tuple. But passing it to Hence, ``hopping`` is a tuple. But passing it to
`~kwant.builder.Builder.possible_hoppings` would fail, `~kwant.builder.HoppingKind` would fail,
as three parameters are expected (not a single tuple). ``*hopping`` as three parameters are expected (not a single tuple). ``*hopping``
unpacks the tuple into these three separate parameters (see unpacks the tuple into these three separate parameters (see
<http://docs.python.org/tutorial/controlflow.html#unpacking-argument-lists>) <http://docs.python.org/tutorial/controlflow.html#unpacking-argument-lists>)
...@@ -441,7 +444,7 @@ The result of the example should be identical to the previous one. ...@@ -441,7 +444,7 @@ The result of the example should be identical to the previous one.
However, both can be used in ``for``-loops, for example. However, both can be used in ``for``-loops, for example.
- In the example, we have added all the hoppings using - In the example, we have added all the hoppings using
`~kwant.builder.Builder.possible_hoppings`. In fact, `~kwant.builder.HoppingKind`. In fact,
hoppings can be added in the same fashion as sites, namely specifying hoppings can be added in the same fashion as sites, namely specifying
* a single hopping * a single hopping
......
...@@ -59,11 +59,10 @@ we can simply write: ...@@ -59,11 +59,10 @@ we can simply write:
Note that the Zeeman energy adds to the onsite term, whereas the Rashba Note that the Zeeman energy adds to the onsite term, whereas the Rashba
spin-orbit term adds to the hoppings (due to the derivative operator). spin-orbit term adds to the hoppings (due to the derivative operator).
Furthermore, the hoppings in x and y-direction have a different matrix Furthermore, the hoppings in x and y-direction have a different matrix
structure. We still use `~kwant.builder.Builder.possible_hoppings` structure. We now cannot use ``lat.nearest`` to add all the hoppings at once,
to add all the hoppings at once, but we now have to distinguish since we now have to distinguish x and y-direction. Because of that, we have to
x and y-direction. Because of that, we have to explicitly specify explicitly specify the hoppings in the form expected by
the hoppings in the form expected by `~kwant.builder.HoppingKind`:
`~kwant.builder.Builder.possible_hoppings`:
- A tuple with relative lattice indices. For example, `(1, 0)` means - A tuple with relative lattice indices. For example, `(1, 0)` means
hopping from `(i, j)` to `(i+1, j)`, whereas `(1, 1)` would hopping from `(i, j)` to `(i+1, j)`, whereas `(1, 1)` would
...@@ -113,7 +112,7 @@ the following, clearly non-monotonic conductance steps: ...@@ -113,7 +112,7 @@ the following, clearly non-monotonic conductance steps:
for kwant: it allows them to be used directly as dictionary keys. for kwant: it allows them to be used directly as dictionary keys.
- It should be emphasized that the relative hopping used for - It should be emphasized that the relative hopping used for
`~kwant.builder.Builder.possible_hoppings` is given in terms of `~kwant.builder.HoppingKind` is given in terms of
lattice indices, i.e. relative to the Bravais lattice vectors. lattice indices, i.e. relative to the Bravais lattice vectors.
For a square lattice, the Bravais lattice vectors are simply For a square lattice, the Bravais lattice vectors are simply
`(a,0)` and `(0,a)`, and hence the mapping from `(a,0)` and `(0,a)`, and hence the mapping from
...@@ -250,7 +249,7 @@ provided by the lattice: ...@@ -250,7 +249,7 @@ provided by the lattice:
Here, ``lat.shape`` takes as a second parameter a (real-space) point that is Here, ``lat.shape`` takes as a second parameter a (real-space) point that is
inside the desired shape. The hoppings can still be added using inside the desired shape. The hoppings can still be added using
`~kwant.builder.Builder.possible_hoppings` as before. ``lat.nearest`` as before.
Up to now, the system contains constant hoppings and onsite energies, Up to now, the system contains constant hoppings and onsite energies,
and we still need to include the phase shift due to the magnetic flux. and we still need to include the phase shift due to the magnetic flux.
......
...@@ -38,7 +38,7 @@ from the scope of `make_system`, since we keep the potential fixed ...@@ -38,7 +38,7 @@ from the scope of `make_system`, since we keep the potential fixed
in this example. in this example.
As a next step we add the hoppings, making use of As a next step we add the hoppings, making use of
`~kwant.builder.Builder.possible_hoppings`. Since we use our home-made `~kwant.builder.HoppingKind`. Since we use our home-made
lattice (instead of `kwant.lattice.honeycomb`), we have to define lattice (instead of `kwant.lattice.honeycomb`), we have to define
the hoppings ourselves: the hoppings ourselves:
......
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