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, kernel=None, mean=True, accumulate_vectors=True)[source]¶Bases: object
Calculate the spectral density of an operator.
This class makes use of the kernel polynomial method (KPM), presented in [1], 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: 


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.
[1]  (1, 2) Rev. Mod. Phys., Vol. 78, No. 1 (2006). 
[2]  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: 


__call__
(energy=None)[source]¶Return the spectral density evaluated at energy
.
Parameters: 


Returns: 

Notes
If energy
is not provided, then the densities are obtained
by Fast Fourier Transform of the Chebyshev moments.
__init__
(hamiltonian, params=None, operator=None, num_vectors=10, num_moments=None, energy_resolution=None, vector_factory=None, bounds=None, eps=0.05, rng=None, kernel=None, mean=True, accumulate_vectors=True)[source]¶Initialize self. See help(type(self)) for accurate signature.
add_moments
(num_moments=None, *, energy_resolution=None)[source]¶Increase the number of Chebyshev moments.
Parameters: 


kwant.kpm.
Correlator
(hamiltonian, operator1=None, operator2=None, **kwargs)[source]¶Bases: object
Calculates the response of the correlation between two operators.
The response tensor \(χ_{α β}\) of an operator \(O_α\) to a perturbation in an operator \(O_β\), is defined here based on [3], and [4], and takes the form
[3]  Phys. Rev. Lett. 114, 116602 (2015). 
[4]  Phys. Rev. B 92, 184415 (2015) 
Internally, the correlation is approximated with a two dimensional KPM expansion,
with coefficients
and moments matrix \(µ_{n m}^{α β} = \mathrm{Tr}(O_α T_m(H) O_β T_n(H))\).
The trace is calculated creating two instances of
SpectralDensity
, and saving the vectors
\(Ψ_{n r} = O_β T_n(H)\rvert r\rangle\),
and \(Ω_{m r} = T_m(H) O_α\rvert r\rangle\) , where
\(\rvert r\rangle\) is a vector provided by the
vector_factory
.
The moments matrix is formed with the product
\(µ_{m n} = \langle Ω_{m r} \rvert Ψ_{n r}\rangle\) for
every \(\rvert r\rangle\).
Parameters: 


Notes
The operator1
must act to the right as \(O_α\rvert r\rangle\).
__call__
(mu=0, temp=0)[source]¶Returns the linear response χ_{α β}(µ, T)
Parameters: 


__init__
(hamiltonian, operator1=None, operator2=None, **kwargs)[source]¶Initialize self. See help(type(self)) for accurate signature.
add_moments
(num_moments=None, *, energy_resolution=None)[source]¶Increase the number of Chebyshev moments
Parameters: 


kwant.kpm.
conductivity
(hamiltonian, alpha='x', beta='x', positions=None, **kwargs)[source]¶Returns a callable object to obtain the elements of the conductivity tensor using the KuboBastin approach.
A Correlator
instance is created to obtain the
correlation between two components of the current operator
where \(V\) is the volume where the conductivity is sampled. In this implementation it is assumed that the vectors are normalized and \(V=1\), otherwise the result of this calculation must be normalized with the corresponding volume.
The equations used here are based on [3] and [4]
[3]  Phys. Rev. Lett. 114, 116602 (2015). 
[4]  Phys. Rev. B 92, 184415 (2015) 
Parameters: 


Examples
We will obtain the conductivity of the Haldane model, defined as a honeycomb lattice with first nearest neighbors coupling, and imaginary second 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
>>> syst[lat.a.neighbors()] = 0.5j
>>> syst[lat.b.neighbors()] = 0.5j
>>> fsyst = syst.finalized()
Now we can call conductivity
to calculate the transverse
conductivity at chemical potential 0 and temperature 0.01.
>>> cond = kwant.kpm.conductivity(fsyst, alpha='x', beta='y')
>>> cond(mu=0, temp=0.01)
kwant.kpm.
RandomVectors
(syst, where=None, rng=None)[source]¶Returns a random phase vector iterator for the sites in ‘where’.
Parameters: 


kwant.kpm.
LocalVectors
(syst, where, *args)[source]¶Bases: object
Generates a local vector iterator for the sites in ‘where’.
Parameters: 


kwant.kpm.
jackson_kernel
(moments)[source]¶Convolutes moments
with the Jackson kernel.
Taken from Eq. (71) of Rev. Mod. Phys., Vol. 78, No. 1 (2006).
kwant.kpm.
lorentz_kernel
(moments, l=4)[source]¶Convolutes moments
with the Lorentz kernel.
Taken from Eq. (71) of Rev. Mod. Phys., Vol. 78, No. 1 (2006).
The additional parameter l
controls the decay of the kernel.
kwant.kpm.
fermi_distribution
(e, mu, temp)[source]¶Returns the Fermi distribution f(e, µ, T) evaluated at ‘e’.
Parameters: 

