tkwantoperator.
EnergySource
(syst: kwant.system.FiniteSystem, where: Union[List[int], List[kwant.builder.Site]], unicode baseOperator: str = u'Kinetic+', dt_hamiltonian: Optional[Callable[[Tuple[kwant.builder.Site, kwant.builder.Site], Dict[str, Union[float, complex]]], Union[complex, ta.matrix]]] = None, dt_customOnsite: Optional[Callable[[kwant.builder.Site, Dict[str, Union[float, complex]]], Union[complex, ta.matrix]]] = None, customOnsite: Optional[Callable[[kwant.builder.Site, Dict[str, Union[float, complex]]], Union[complex, ta.matrix]]] = None, sum: bool = False, double dt: float = 1E-3)¶An operator for calculating the local input power on sites.
syst (FiniteSystem
) – The finalized Kwant system on which the input power will be calculated.
where (list
[int
] or list
[Site
]) – The sites on which the input power will be evaluated. It is
saved in a normalized way, with the same order, in the where
attribute of this class.
baseOperator (str
) – Can be Hamiltonian
, Kinetic+
or Custom
(case unsensitive).
It tells the operator which onsite term to use when calculating the
energy current. Saved as an integer in operatorType
customOnsite (None
(default) or (Site
, dict
) \(\rightarrow\) complex matrix-like object) – Overwrites the value of the energy operator \(ε\) on sites:
\(\forall i \, \forall t \; ~ ε_{ii}(t) = \text{customOnsite}(i, t)\),
but only when baseOperator
is set to Custom
. In practice, its signature
should be customOnsite(site, params)
where site
is a Site
instance and params
is a dict
containing the parameters
values (including the current time). The method must return a matrix-like
object (e.g. a tinyarray
instance) of the right dimensions at each site
(the same as the onsite Hamiltonian). It is saved in the customOnsite
attribute of this class.
sum (bool
) – Whether to sum the input powers over the where
list and return a
single float result when called. Saved as an integer in the sum
attribute of
this class.
dt_customOnsite (None
(default) or (Site
, dict
) \(\rightarrow\) complex matrix-like object) – The time derivative of the custom onsite, to be (optionally) given only
when baseOperator
is set to Custom
. Saved in the dt_customOnsite
attribute of this class. If specified, its signature
should be dt_customOnsite(site, params)
where site
is a
Site
instance and params
is a dict
containing the parameters values (including the current time).
The method must return a matrix-like object (e.g. a tinyarray
instance) of the right dimensions at each site (the same as the
onsite Hamiltonian). If not specified (thus
defaulting to None
), finite difference will be used
to estimate the time derivative using the “small” time step dt
.
dt_hamiltonian (None
(default) or (Site
, Site
, dict
) \(\rightarrow\) complex matrix-like object) – The time derivative of the Hamiltonian. Saved in the dt_hamiltonian
attribute of this class. If specified, its signature
should be dt_hamiltonian(site1, site2, params)
where site1
and
site2
are Site
instances ; params
is a dict
containing the parameters values (including the current time). The method
must return a matrix-like object (e.g. a tinyarray
instance) of the right
dimensions for each hopping (site1, site2)
(the same size as the
Hamiltonian). If not specified (thus defaulting to None
),
finite difference will be used to estimate it using the “small” time step dt
.
dt (float
, default value: \(10^{-3}\)) – The time step used to estimate the time derivative of the custom onsite (if dt_customOnsite=None
)
or the Hamiltonian (if dt_hamiltonian=None
). It is saved in
the dt
attribute of this class.
Notes
This class calculates the power source term due to the time
dependent potentials at each site \(i\)
given in the where
list. At a given time \(t\), the power given to particles
at site \(i\) writes:
The above formula has been derived in Reference article for single-orbital Hamiltonians. In practice, the operator EnergySource
has been implemented for generic multi-orbital Hamiltonian matrices but the physical meaning of the multi-orbital formula is not clear in general. It has not yet been investigated.
\(ε\) is the energy operator derived from the system’s Hamiltonian:
Its values on hoppings coincide with the hamiltonian \(\forall i \! \neq \! j \; ε_{ij}(t) = H_{ij}(t)\)
Its value on sites depends on what the user chooses for baseOperator
:
Hamiltonian
: \(\forall i \, \forall t \; ~ ε_{ii}(t) = H_{ii}(t)\)
Kinetic+
: \(\forall i \, \forall t \; ~ ε_{ii}(t) = H_{ii}(t_0 - 1)\) where
\(t_0\) is the instant at which the Hamiltonian starts being time-dependent,
given by time_start
(the \(-1\) has been added to avoid use-case problems
with heaviside-like time-dependence).
Custom
: \(\forall i \, \forall t \; ~ ε_{ii}(t) = W_{i}(t)\) where
\(W\) is given by the user through customOnsite
.
Note that it is necessary to impose \(ε_{ii}(t) = H_{ii}(t_0 - 1)\) for all sites \(i\) (belonging to added_lead_sites)
that were part of the leads and have been added into the central system.
Be cautious that there is currently no implemented check to verify this condition and if it is not satisfied, the output result of Source might be wrong.
\(V\) is defined by \(V_i(t) = H_{ii}(t) - ε_{ii}(t)\). The index \(k\) runs formally over all sites in the whole system, but effectively only the sites connected to \(i\) (including \(i\)) give in general a non zero result.
Attributes
sum
¶Whether to sum the input power over the where
list and return a
single float result.
int
, \(0\) (no) or \(1\) (yes)
operatorType
¶Translation to an integer of the baseOperator
parameter of the class
constructor: “Hamiltonian” \(\leftrightarrow 0\),
“kinetic+” \(\leftrightarrow 1\) and “custom” \(\leftrightarrow 2\).
syst
¶The finalized Kwant system on which energy currents will be calculated.
customOnsite
¶Used as the value of the energy operator \(ε\) on sites:
\(\forall i \, \forall t \; ~ ε_{ii}(t) = \text{customOnsite}(i, t)\), when
operatorType
= 2.
time_name
¶The name the time parameter has in the params
dictionary given to __call__
. It
is initialised with tkwant’s default name, which is time
.
time_start
¶The instant \(t_0\) at which time dependence starts in the Hamiltonian.
Initialized with tKwant’s default value, which is 0
.
dt_customOnsite
¶Used as the value of the time derivative of the energy operator \(ε\)
on sites: \(\forall i \, \forall t \; ~ ∂_t ε_{ii}(t) = \text{dt_customOnsite}(i, t)\), when
operatorType
= 2.
dt_hamiltonian
¶The time derivative of the Hamiltonian. If it is set to None
,
finite difference will be used to estimate the time derivative
of the Hamiltonian, using the “small” time step dt
.
dt
¶The time step used to estimate the time derivative of the custom onsite or the Hamiltonian, if not user specified.
float
, default value: \(10^{-3}\)
where
¶List of sites \(i\) (accessed as i = where[n, 0]
) on which the energy source is calculated at each call.
2D array of gint (a python int
compatible type) of shape \(n \times 2\)
Methods
__call__
()¶Returns the contribution \(S_i^ε(ψ, t)\) of psi
to the expectation value
of the power given to the particles on each site of the where
list.
This method enables calling an instance A of this class like a function, with a wave function and the “params” dictionary as parameters :
>>> A(psi, params)
For each site \(i\) it calculates the following sum, with psi
written as “\(ψ\)” :
psi (array of complex values) – The wave function to use for calculation. Must have the same length as the total number of orbitals in the system.
params (dict
, optional) – Dictionary of parameter names and their values.
List of the values of the contribution of psi
to the input power on each site
\(\left [ S_i^ε(ψ, t) \right ]_{i \in \text{where}}\),
when sum
\(= 0\). Otherwise the sum of these values
\(\sum_{i \in \text{where}} S_i^ε(ψ, t)\).