kwant.operator.
Source
(syst, onsite=1, where=None, check_hermiticity=True, *, sum=False)[source]¶Bases: kwant.operator._LocalOperator
An operator for calculating general sources.
An instance of this class can be called like a function to evaluate the
expectation value with a wavefunction. See
__call__
for details.
Parameters: | syst : onsite : scalar or square matrix or dict or callable
where : sequence of int or
check_hermiticity : bool
sum : bool, default: False
|
---|
Notes
An example of a “source” is a spin torque. In general, if there is a certain “density” (e.g. charge or spin) that is represented by a square matrix \(M_i\) associated with each site \(i\), and \(H_{i}\) is the onsite Hamiltonian on site site i, then an instance of this class represents the tensor \(Q_{iαβ}\) which is equal to \((H_{i})^† M_i - M_i H_{i}\) when α and β are orbitals on site \(i\), and zero otherwise.
Methods
act
(self, ket, args=(), *, params=None)[source]¶Act with the operator on a wavefunction.
For an operator \(Q_{iαβ}\) and ket
\(ψ_β\)
this computes \(∑_{iβ} Q_{iαβ} ψ_β\).
Parameters: | ket : sequence of complex
args : tuple
params : dict, optional
|
---|---|
Returns: | Array of complex. |
bind
(self, args=(), *, params=None)[source]¶Bind the given arguments to this operator.
Returns a copy of this operator that does not need to be passed extra
arguments when subsequently called or when using the act
method.
__call__
()[source]¶Return the matrix elements of the operator.
An operator A
can be called like
>>> A(psi)
to compute the expectation value \(\bra{ψ} A \ket{ψ}\), or like
>>> A(phi, psi)
to compute the matrix element \(\bra{φ} A \ket{ψ}\).
If sum=True
was provided when constructing the operator, then
a scalar is returned. If sum=False
, then a vector is returned.
The vector is defined over the sites of the system if the operator
is a Density
, or over the hoppings if it is a
Current
or Source
. By default,
the returned vector is ordered in the same way as the sites
(for Density
) or hoppings in the graph of the
system (for Current
or Density
).
If the keyword parameter where
was provided when constructing
the operator, then the returned vector is instead defined only over
the sites or hoppings specified, and is ordered in the same way
as where
.
Alternatively stated, for an operator \(Q_{iαβ}\), bra
\(φ_α\) and ket
\(ψ_β\) this computes
\(q_i = ∑_{αβ} φ^*_α Q_{iαβ} ψ_β\) if self.sum
is False,
otherwise computes \(q = ∑_{iαβ} φ^*_α Q_{iαβ} ψ_β\). where
\(i\) runs over all sites or hoppings, and
\(α\) and \(β\) run over all the degrees of freedom.
Parameters: | bra, ket : sequence of complex
args : tuple, optional
params : dict, optional
|
---|---|
Returns: | float if otherwise complex. If this operator was created with then a single value is returned, otherwise an array is returned. |
Attributes