Verified Commit b55213f2 authored by Adel Kara Slimane's avatar Adel Kara Slimane
Browse files

Improve tutorial

parent 8036c265
Pipeline #36256 passed with stages
in 5 minutes and 26 seconds
......@@ -12,7 +12,7 @@ In the following, we take :math:`e=\hbar=1`.
In the presence of time-dependent electromagnetic fields (described by an electromagnetic scalar potential :math:`V(\vec r, t)` and an electromagnetic vector potential :math:`\vec A(\vec r, t)`), the Hamiltonian's expectation value is (in general) gauge dependent i.e. an electromagnetic gauge transformation does not leave its expectation value invariant.
The gauge invariant energy operator :math:`\hat ε` is defined as being the kinetic energy operator plus any stationary physical scalar potential that is present from the remote past. The local energy density operator :math:`\hat ε_i` on site :math:`i` reads:
The gauge invariant energy operator :math:`\hat ε` is defined as being the kinetic energy operator plus any stationary scalar potential, that has a physical origin and is present from the remote past to the remote future. The local energy density operator :math:`\hat ε_i` on site :math:`i` reads:
.. math::
......@@ -64,13 +64,15 @@ The heat current leaving a lead :math:`α` to the central system :math:`C` is de
where :math:`I^ε_α=\sum_{i \in α}\sum_{j \in C}I^ε_{ji}`, :math:`I^N_α=\sum_{i \in α}\sum_{j \in C}I^N_{ji}`, :math:`S^ε_α=\sum_{i \in α}S^ε_i`, and :math:`μ_α` is chemical potential of lead :math:`α`.
Each one of the previously defined energy quantities have been implemented as classes in tKwant under the `~tkwantoperator` module. Namely `~tkwantoperator.EnergyDensity`, `~tkwantoperator.EnergyCurrent`, `~tkwantoperator.EnergySource` and `~tkwantoperator.LeadHeatCurrent`. An additional class `~tkwantoperator.EnergyCurrentDivergence` exists to calculate easily the outgoing energy flux off a set of sites. These classes enable using :math:`\hat ε`, :math:`\hat H` or a user defined operator (with specified values on sites) as energy operators, more information is available in the class' documentation.
Each one of the previously defined energy quantities have been implemented `~tkwantoperator` module and are to be used with `tkwant <https://kwant-project.org/extensions/tkwant/>`_. The classes are: `~tkwantoperator.EnergyDensity`, `~tkwantoperator.EnergyCurrent`, `~tkwantoperator.EnergySource` and `~tkwantoperator.LeadHeatCurrent`. An additional class `~tkwantoperator.EnergyCurrentDivergence` exists to calculate easily the outgoing energy flux off a set of sites. These classes enable using :math:`\hat ε`, :math:`\hat H` or a user defined operator (with specified values on sites) as energy operators, more information is available in the class' documentation.
Example : 1D Quantum dot
------------------------
A central site 0 with on-site energy :math:`ε_0(t)=ε_0+Δε\Theta(t-t_0)` is connected through nearest-neighbor hopping term :math:`γ_c` to two left and right semi-infinite 1D chains. We start by defining the central part of the system as follows
A 1D chain, whose sites have zero on-site energy and are connected with each other through nearest neighbor hoppings :math:`γ`, has a central site :math:`0` with an on-site energy :math:`ε_0(t)=ε_0+Δε\Theta(t-t_0)`. The central site is connected to its two nearest neighbors through a different hopping term :math:`γ_c`. We want to calculate the time dependent energy density on the central site, the energy and heat currents flowing to its right and left side.
In kwant, such a system can be created as follows:
.. jupyter-execute::
......@@ -105,7 +107,7 @@ A central site 0 with on-site energy :math:`ε_0(t)=ε_0+Δε\Theta(t-t_0)
builder[(lat(1))] = 0
builder[lat.neighbors()] = - γc
We want to calculate the time dependent energy density on the site ``lat(0)`` (the site on which the time dependent potential has been applied), the left heat and energy currents flowing through the hopping ``(lat(-1), lat(0))`` (from ``lat(-1)`` to ``lat(0)``) and the right heat and energy currents flowing through ``(lat(1), lat(0))`` (from ``lat(1)`` to ``lat(0)``). For that matter, two (left and right) leads need to be added to the system: they are taken with a zero onsite potential and with a hopping constant :math:`γ`. One site from each lead is added to the system to be able to calculate properly the energy and heat currents since e.g. all four sites ``lat(-2)``, ``lat(-1)``, ``lat(0)``, and ``lat(1)`` are needed to calculate the energy current :math:`I^ε_{0,-1}(t)`.
The left currents will be computed on the hopping ``(lat(0), lat(-1))`` (from ``lat(-1)`` to ``lat(0)``) and the right currents on ``(lat(0), lat(1))`` (from ``lat(1)`` to ``lat(0)``). We will create and attach each lead to the system while adding its edge site to the system, by using the ``add_cells`` parameter in the `~kwant.builder.Builder.attach_lead` method. Given that wave functions are not accessible in the leads in kwant and tkwant, adding one site from each lead to the system needs to be done to be able to calculate properly the energy and heat currents, since the wave functions also need to be accessed on ``lat(-2)`` (respectively ``lat(-2)``) to compute :math:`I^ε_{0,-1}(t)` (respectively :math:`I^ε_{0,1}(t)`).
.. jupyter-execute::
......@@ -154,7 +156,7 @@ The system is thus the following
kwant.plot(builder);
The lists of sites ``added_sites_left`` and ``added_sites_right`` are used when declaring `~tkwantoperator.LeadHeatCurrent` operator instances by giving them to the ``added_lead_sites`` parameter:
The added sites from each lead are stored in the ``added_sites_left`` and ``added_sites_right`` variables. These variables are then used to instance `~tkwantoperator.LeadHeatCurrent` by giving them to the ``added_lead_sites`` parameter:
.. jupyter-execute::
......@@ -168,14 +170,16 @@ The lists of sites ``added_sites_left`` and ``added_sites_right`` are used when
lead_heat_current_left_op = tkwantoperator.LeadHeatCurrent(syst, chemical_potential=μL, added_lead_sites=added_sites_left)
The ``added_lead_sites`` parameter is used by the `~tkwantoperator.LeadHeatCurrent` class to find the hopping(s) on which it will calculate the heat current: they are the outgoing hoppings from the set of sites ``added_lead_sites``, excluding hoppings that connect to lead sites. The calculated hoppings are stored in its `~tkwantoperator.LeadHeatCurrent.hoppings` member. We can check that these correspond to ``(lat(0), lat(-1))`` for the left lead and ``(lat(0), lat(1))`` for the right lead:
The ``added_lead_sites`` parameter is used by the `~tkwantoperator.LeadHeatCurrent` class to find the hopping(s) on which it will calculate the heat current: they are the outgoing hoppings from the set of sites ``added_lead_sites`` to the system, excluding the hoppings that connect to lead sites. The calculated hoppings are stored in its `~tkwantoperator.LeadHeatCurrent.hoppings` member. This approach (``attach_lead`` with ``add_cells=1`` then giving the added cells to `~tkwantoperator.LeadHeatCurrent`) has the benefit to make it easier for the user to calculate lead currents when there are many hoppings connecting the central system to the leads.
We can check, in our specific case, that each `~tkwantoperator.LeadHeatCurrent` instance computed the right hoppings: they should be ``(lat(0), lat(-1))`` for the left lead and ``(lat(0), lat(1))`` for the right lead
.. jupyter-execute::
print(lead_heat_current_left_op.hoppings == [(lat(0), lat(-1))])
print(lead_heat_current_right_op.hoppings == [(lat(0), lat(1))])
Now let's declare the other operators. Just like the particle `~kwant.operator.Current` and `~kwant.operator.Density`, energy operators receive a ``where`` argument upon initialization (but can't be left blank or set to ``None`` because of lead interface issues). For more information on any energy operators, feel free to visit its respective documentation.
Now let's declare the other operators. Just like the particle `~kwant.operator.Current` and `~kwant.operator.Density`, energy operators receive a ``where`` argument upon initialization (but can't be left blank or set to ``None`` because of lead interface issues). For more information on any energy operator, feel free to visit its respective documentation.
.. jupyter-execute::
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment