kwant.kpm
– Kernel Polynomial Method¶kwant.kpm.
SpectralDensity
(hamiltonian, params=None, operator=None, num_vectors=10, num_moments=None, energy_resolution=None, vector_factory=None, bounds=None, eps=0.05, rng=None)[source]¶Bases: object
Calculate the spectral density of an operator.
This class makes use of the kernel polynomial method (KPM), presented in [R12], to obtain the spectral density \(ρ_A(e)\), as a function of the energy \(e\), of some operator \(A\) that acts on a kwant system or a Hamiltonian. In general
where \(ρ(e) = \sum_{k=0}^{D1} δ(EE_k)\) is the density of states, and \(A(e)\) is the expectation value of \(A\) for all the eigenstates with energy \(e\).
Parameters:  hamiltonian :
params : dict, optional
operator : operator, dense matrix, or sparse matrix, optional
num_vectors : positive int, default: 10
num_moments : positive int, default: 100
energy_resolution : positive float, optional
vector_factory : function, optional bounds : pair of floats, optional
eps : positive float, default: 0.05
rng : seed, or random number generator, optional


Notes
When passing an operator
defined in operator
, the
result of operator(bra, ket)
depends on the attribute sum
of such operator. If sum=True
, densities will be scalars, that
is, total densities of the system. If sum=False
the densities
will be arrays of the length of the system, that is, local
densities.
[R12]  (1, 2) Rev. Mod. Phys., Vol. 78, No. 1 (2006). 
[R22]  Phys. Rev. E 69, 057701 (2004) 
Examples
In the following example, we will obtain the density of states of a graphene sheet, defined as a honeycomb lattice with first nearest neighbors coupling.
We start by importing kwant and defining a
FiniteSystem
,
>>> import kwant
...
>>> def circle(pos):
... x, y = pos
... return x**2 + y**2 < 100
...
>>> lat = kwant.lattice.honeycomb()
>>> syst = kwant.Builder()
>>> syst[lat.shape(circle, (0, 0))] = 0
>>> syst[lat.neighbors()] = 1
and after finalizing the system, create an instance of
SpectralDensity
>>> fsyst = syst.finalized()
>>> rho = kwant.kpm.SpectralDensity(fsyst)
The energies
and densities
can be accessed with
>>> energies, densities = rho()
or
>>> energies, densities = rho.energies, rho.densities
Attributes
energies  (array of floats) Array of sampling points with length 2 * num_moments in the range of the spectrum. 
densities  (array of floats) Spectral density of the operator evaluated at the energies. 
__call__
(energy=None)[source]¶Return the spectral density evaluated at energy
.
Parameters:  energy : float or sequence of float, optional 

Returns:  float, if is a sequence, a tuple (energies, densities) if

Notes
If energy
is not provided, then the densities are obtained
by Fast Fourier Transform of the Chebyshev moments.
add_moments
(num_moments=None, *, energy_resolution=None)[source]¶Increase the number of Chebyshev moments.
Parameters:  num_moments: positive int
energy_resolution: positive float, optional

