Kernel polynomial method
Kernel polynomial method
BACHELOR OF SCIENCE
in
Technische Natuurkunde
en
Technische Wiskunde
door
Delft, Nederland
Augustus 2016
Begeleiders
Overige commissieleden
To be able to use the KPM a tight binding Hamiltonian is obtained by using the
python package Kwant. A python implementation of KPM combined with a time propa-
gator then results in time-dependent expectation values of any operator.
This approach benefits from large system sizes, since KPM uses a statistical approxi-
mation that increases in accuracy with larger size. The statistical approximation always
converges, but there is limited guarantee as to how fast it converges.
In further research the KPM could be compared to other available approaches. An-
other possibility is to use the KPM to get a general overview of the system and combine
it with more exact approaches to find specific results.
4
Contents
1 Introduction 1
4 Numerical experiments 19
4.1 General considerations . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 19
4.2 Density of states . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 19
4.3 Expectation values . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 26
4.4 Time-dependent expectation values . . . . . . . . . . . . . . . . . . . . . . 27
6 Apendices 32
6.1 Appendix A: Chebyshev expansion . . . . . . . . . . . . . . . . . . . . . . 32
6.2 Appendix B: Calculation of moments . . . . . . . . . . . . . . . . . . . . . 37
6.3 Appendix C: Python code used for numerical experiments . . . . . . . . . 38
5
1 Introduction
Graphene is a material that has been known for years but could not be produced ef-
fectively. In 2010 the Nobel Prize in physics was won for the study of the properties of
graphene. This work made it possible to produce graphene and since then a lot of research
is being done on the possible applications of graphene.
One of the ways to study solids is to model the solid as a tight binding system. In this
model electrons are isolated around the atom they belong to and have little interaction
with the surrounding atoms. The Python package Kwant will be used to define a tight
binding system, and extract a tight binding Hamiltonian.
When tight binding systems are exposed to light there will be time-dependence en-
tering the system. The expectation values of physical properties like energy or current
will therefore become time-dependent. Calculating these expectation values for larger
systems exactly will in most cases not be possible. For further physical background on
the interaction of tight binding systems like graphene with light, see [1].
The goal of this project is to use the tight binding Hamiltonian from Kwant to ex-
pand physical quantities using KPM. These physical quantities include (time-dependent)
expectation values of operators and the density of states.
1
2 Expectation values and density of states
This section will show the applications of the Kernel Polynomial Method (KPM) used in
this project. The next sections will derive the KPM and show that the physical quantities
can indeed by approximated by this method. In all of the applications a finite system
is required, this means that the Hamiltonian H of the system is of finite dimension D2 .
For more information about tight binding Hamiltonians, see an introduction to solid state
physics [3]. The eigenvectors |ki of H represent the eigenstates of the system and Ek the
eigenvalues. In that case the density of states is given by:
D−1
1 X
ρ(E) = δ(E − Ek ) (1)
D k=0
The expectation value of an operator A in a state |ψi is defined as hAψ i = hψ|A|ψi. For
an introduction to quantum mechanical expectation values see [4]. The total expectation
value of A can be obtained by integrating over all the occupied states of a system.
Z Emax
hAi = a(E)ρ(E)n(E) dE (2)
Emin
Where a(E) is the expectation value of A in a state with energy E, ρ(E) is the density
of states and n(E) is the average number of particles in a state with energy E. The
integration boundaries Emin andEmax are finite for finite systems. In this case ρ(E)n(E)
can be seen as a weight function corresponding to the amount of occupied states with
energy E.
The systems that will be investigated in this project are semiconductors or metals.
Graphene is a semiconductor without band gap, which is also called a semi metal. In those
cases n(E) is given by the Fermi-Dirac distribution, since the particles are electrons.
1
n(E) = (3)
1 + exp( E−µ
kB T
)
Where µ is the chemical potential of the system, T is the temperature and kB T the
Boltzmann constant. Further information about this can be found in an introduction to
statistical physics, like [5].
Note that the function a(E)ρ(E) is always zero except for the values of E corresponding
to the eigenvalues Ek , since ρ(E) is given by delta peaks. The function a(E) is given for
the eigenvalues Ek as:
a(Ek ) = hk|A|ki , (4)
since |ki is the state of the system corresponding to the energy Ek . Combining these
results gives:
D−1
1 X
ρA (E) ≡ a(E)ρ(E) = hk|A|ki δ(E − Ek ) (5)
D k=0
2
Here the notation ρA (E) has been introduced for a(E)ρ(E).
Where a(E, t) is the expectation value of A in a state with energy E at a time t. The
relation between an initial state |ψ(0)i and the state at time t, |ψ(t)i is now derived. In
general for a time-dependent Hamiltonian H(t) the state |ψ(t)i is given by the Schrödinger
equation:
∂
i~ |ψ(t)i = H(t) |ψ(t)i (8)
∂t
In general this equation is hard to solve, especially for large systems. However in the case
that H(t) = H, meaning that there is no time-dependence, the solution simplifies. If for
a state the initial wave function is given by |ψ(0)i, then the wave function at time t is
given by
Here since H is a matrix, this exponential is in fact the matrix exponential defined for a
square matrix A as:
∞
X 1 n
exp(A) ≡ A (10)
n=0
n!
This matrix exponential is hard to calculate for any matrix that is not fully diag-
onalized. When implementing the matrix exponential for numerical results a suitable
approximation must be found. This will be discussed in a later section about the imple-
mentation of the time propagator.
However when the Hamiltonian is time-dependent (9) does not hold. In that case
multiple small time steps dt can be taken to calculate the state at any time. The idea
behind this is that H(t) ≈ H(t + dt) so that H(t) is basically time independent at the
small interval [t, t + dt]. Using (9) this means that:
3
The following notation will be used to refer to the time propagator:
q
Y
U (q · dt, p · dt) ≡ exp(−iH(jdt)dt) (13)
j=p+1
The states |ki are now the eigenstates of the initial Hamiltonian H(0) and Ek are the
corresponding eigenvalues. The function a(Ek , t) is then given by:
The Kernel Polynomial Method can be used to approximate the density of states (1),
the expectation value of an operator (2) and the time-dependent expectation value (7). In
all of the above mentioned formulas the eigenstates |ki of the Hamiltonian are required.
The KPM approximation of these quantities does not need any of the eigenstates but
instead uses a statistical approach; this will be derived in the coming sections.
4
3 The Kernel Polynomial Method
3.1 Chebyshev expansion and rescaling
The Kernel Polynomial Method is based on Chebyshev polynomials. In the appendix
about Chebyshev polynomials and Chebyshev expansion all the needed relations are
proven. The main result of this appendix is that a function f (x) can be written as:
∞
!
1 X
f (x) = √ µ0 + 2 µn Tn (x) (17)
π 1 − x2 n=1
Note that the expanded function is only used on the interval [−1, 1], whereas in the
last section the function was defined on a finite interval [Emin , Emax ] where Emin is the
smallest eigenvalue of the Hamiltonian and Emax the largest eigenvalue. To be able to
use this expansion a rescaling of the eigenvalues is required; the rescaled eigenvalues Ẽ
will have to be in the range −1 < Ẽ < 1. Here strict inequality is used to avoid stability
problems. To achieve this, the following scaling will be done:
E−b
Ẽ = , (19)
a
1
H̃ = (H − bI), (20)
a
with the scaling factors a and b:
Emax − Emin Emax + Emin
a= , b= (21)
2− 2
and > 0 to achieve strict inequality. This rescaling can be proven using that:
Emax − Emin Emax − Emin
< , (22)
2− 2
5
Which can be done as follows:
Emin ≤ E ≤ Emax
−Emax + Emin Emax + Emin Emax − Emin Emax + Emin
+ ≤E≤ +
2 2 2 2
−Emax + Emin Emax + Emin Emax − Emin Emax + Emin
+ <E< +
2− 2 2− 2
−a + b < E < a + b (23)
−a < E − b < a
E−b
−1 < <1
a
−1 < Ẽ < 1
Now the rescaling of H̃ follows from rescaling of the eigenvalues using some linear algebra.
To do this |ki is an eigenvector of H, it then follows from H |ki = Ek |ki that:
Ek − b Ek |ki b 1 b 1
Ẽk |ki = |ki = − |ki = H |ki − |ki = (H − bI) |ki = H̃ |ki (24)
a a a a a a
This also shows that the eigenvectors |ki of H are also the eigenvectors of H̃.
Where |αi and |βi are states of the system described by H̃. The moments can then be
calculated using a recursion relation for Chebyshev polynomials derived in the appendix
about Chebyshev polynomials
In that case |αn i = Tn (H̃) |αi gives the following recursion relation for |αn i:
|α0 i = |αi
(28)
|α1 i = H̃ |α0 i
|αn i = 2H̃ |αn−1 i − |αn−2 i
µn = hβ|αn i (29)
6
When |αi = |βi this can be done more efficiently using another derived relation in the
appendix:
Now it is possible to calculate two moments µn for each |αn i. The following relations
then hold:
This can be shown using |αn i = Tn (H̃) |αi, and also using the fact that the Hamilto-
nian is a Hermitian matrix. This means that:
Xn
†
Tn (H̃) = ( tk H̃ k )†
k=0
n
X
= tk (H̃ † )k
k=0 (33)
Xn
= tk (H̃)k
k=0
= Tn (H̃)
This gives for the even terms:
7
Before looking at the moments for this function, it must first be shown that the eigen-
values of Tn (H̃) are Tn (Ẽ). This actually holds for all polynomials and is not a specific
property of the Chebyshev polynomials, for the proof see the appendix.
Now by applying (18) the moments can be calculated. It will be used that the trace
over a matrix equals the sum of its eigenvalues. Since Tn (Ẽ) is a scalar it follows that
Tn (Ẽk ) = hk|ki Tn (Ẽk ) = hk|Tn (Ẽk )|ki. Now for µn :
Z 1
µn = ρ̃(Ẽ)Tn (Ẽ) dẼ
−1
D−1
XZ 1
1
= δ(Ẽ − Ẽk )Tn (Ẽ) dẼ
D k=0 −1
D−1
1 X
= Tn (Ẽk )
D k=0 (37)
D−1
1 X
= hk|Tn (Ẽk )|ki
D k=0
D−1
1 X
= hk|Tn (H̃)|ki
D k=0
1
= Tr(Tn (H̃))
D
The next section is about a statistical approach to calculate moments of this trace
form efficiently.
The second type of moments are used to calculate the expectation value of an operator
A. This type can also be used in the time-dependent case, as will be shown.
Remember that ρA (E) is the function that will be expanded, the rescaled version of
this function is:
D−1
1 X
ρ˜A (Ẽ) = hk|A|ki δ(Ẽ − Ẽk ) (38)
D k=0
As seen earlier in this section, the trace of Tn (H̃) can be written using its normalized
eigenvectors |ki:
D−1
X
T r(Tn (H̃)) = hk|Tn (H̃)|ki (39)
k=0
However now the trace of ATn (H̃) is wanted and |ki are in general not the eigenvectors
of this matrix. It can be shown however
P that for any orthonomal set of vectors |ui, the
trace of an operator O is given by u hu|O|ui. See the appendix for the proof.
8
Now we can use (18) for the function ρ˜A (Ẽ).
Z 1
µn = ρ˜A (Ẽ)Tn (Ẽ) dẼ
−1
Z D−1
1
1 X
= hk|A|ki δ(Ẽ − Ẽk )Tn (Ẽ) dẼ
−1 D k=0
D−1 Z 1
1 X
= hk|A|ki δ(Ẽ − Ẽk )Tn (Ẽ) dẼ
D k=0 −1
D−1
1 X (40)
= hk|A|ki Tn (Ẽk )
D k=0
D−1
1 X
= hk|ATn (Ẽk )|ki
D k=0
D−1
1 X
= hk|ATn (H̃)|ki
D k=0
1
= T r(ATn (H̃))
D
Again, the next section will be about a statistical approach to calculate this trace.
The last type of moments are in the time-dependent case, for the function ρA (E, t).
For the rest of this section discrete time will be used, since the propagator gives time
steps, meaning tm = m · dt.
D−1
1 X
ρA (E, m · dt) = hkt=m·dt |At=m·dt |kt=m·dt i δ(λ − λk ) (41)
D k=0
Where again |kt=m·dt i = U (m · dt, 0) |ki and At=m·dt is the possibly time-dependent
operator.
Firstly the moments at t = 0 can be calculated recursively as done in the time inde-
pendent case. The only difference is an extra index to the states |αn i representing the
time:
From these states |αn,t=0 i the moments for t = 0 can be calculated. This goes exactly the
same as in the stationary case,
1
µn,t=0 = T r(At=0 Tn (H˜t=0 )) (43)
D
So far everything is the same as in the stationary case. Now a time step dt can be taken,
which means that the states |αn i are propagated one step in time:
9
|αn,t=dt i = U (dt, 0) |αn,t=0 i (44)
Note that |αn,t=(m+1)·dt i can be calculated by just propagating |αn,t=m·dt i once. This
means that for each time step the states at the previous time can be used. Now the
time-dependent moments µn,t=m·dt can be derived to a trace form:
Z 1
µn,t=m·dt = ρ̃A (Ẽ, t = m · dt)Tn (Ẽ) dẼ
−1
Z D−1
1
1 X
= hkt=m·dt |At=m·dt |kt=m·dt i δ(Ẽ − Ẽk )Tn (Ẽ) dẼ
−1 D k=0
D−1 Z 1
1 X
= hk|U (0, m · dt)At=m·dt U (m · dt, 0)|ki δ(Ẽ − Ẽk )Tn (Ẽ) dẼ
D k=0 −1
(46)
D−1
1 X
= hk|U (0, m · dt)At=m·dt U (m · dt, 0)Tn (Ẽk )|ki
D k=0
D−1
1 X
= hk|U (0, m · dt)At=m·dt U (m · dt, 0)Tn (H̃t=0 )|ki
D k=0
1
= T r(U (0, m · dt)At=m·dt U (m · dt, 0)Tn (H̃t=0 ))
D
In this case U (0, m · dt)At=m·dt U (m · dt, 0) can be seen as a time-dependent operator.
After the section about the statistical approximation there will be a section about how
to calculate these time-dependent moments efficiently.
Here |ri is a randomly chosen state, meaning the trace is approximated using only a
random set of states. Also R D resulting in a clear advantage over calculating the
entire trace:
D
1 X
hk|ATn (H̃)|ki (48)
D k=1
10
A random vector can be obtained by taking a set of random variables: ξri ∈ C and a basis
{|ii} of dimension D. From which |ri can be constructed:
D−1
X
|ri = ξri |ii (49)
i=0
The double index i, r of ξri simply means that a different ξ is picked for all vectors |ii of
the basis and all random vectors |ri. The ξri can be picked from a distribution which has
the following statistical properties, when ξri ∈ C
N
1 X
1) lim ξri ≡ ξri = 0
N →∞ N
i=1 (50)
2) ξri ξr0 j = 0
∗
3) ξri ξr0 j = δrr0 δij
ξri = 0
(51)
ξri ξr0 j = 0
In the rest of this section the references 1), 2) and 3) will be used to refer to the gen-
eral properties. There are many distributions that satisfy these conditions, for example
Gaussian or uniform distributions. At the end of this section the choice of distribution
will be discussed in some detail. As a first result it can be proven that on average (47)
gives the correct result. For an arbitrary Hermitian operator B with matrix elements
Bij = hi|B|jithe following holds:
R
1X
Θ ≡ hr|B|ri
R r=1
R D−1 D−1
1 XX ∗ X
= ξri hi|B[ ξrj |ji]
R r=1 i=0 j=0
R D−1 D−1
1 XXX ∗
= ξ ξrj hi|B|ji
R r=1 i=0 j=0 ri
R D−1 (52)
1 XX ∗
= ξri ξrj Bij
R r=1 i,j=0
R D−1
1 XX
= Bii
R r=1 i=0
D−1
X
= Bii
i=0
= T r(B)
11
This is a nice result but since |ri is random, the variance of Θ could still be very high.
However this is not the case, as will be proven next. The variance of Θ is given by:
(δΘ)2 = Θ2 − Θ 2 . Since the second term was already derived in (52) only the
first term has to be calculated. Before moving on it should be noted that since ξri are
independent variables:
∗
ξri ξrj ξr∗0 i0 ξr0 j 0 = ξri
∗
ξrj ξr∗0 i0 ξr0 j 0 = δij δi0 j 0 r 6= r0 (53)
When r = r0 there is the case that i = j = i0 = j 0 and then the ξri are no longer
independent variables. In that case:
∗ 2 2
(ξri ) ξri = |ξri |4 (54)
Which follows immediately from the definition of the matrix product. This is used in the
last step of the proof, now for Θ2 :
12
R R
2 1X 1X
Θ := hr|B|ri hr|B|ri
R r=1 R r=1
R D−1 D−1 D−1 D−1
1 X X
∗
X X
∗ 0
X
= 2 ξri hi|B[ ξrj |ji] ξr0 i0 hi |B[ ξr0 j 0 |j 0 i]
R r,r0 =1 i=0 j=0 i0 =0 j 0 =0
R D−1 D−1
1 X X
∗
X
= 2 ξri ξrj hi|B|ji ξr∗0 i ξr0 j hi|B|ji
R r,r0 =1 i,j=0 i,j=0
R D−1
1 X X ∗
= 2 ξri ξrj ξr∗0 i0 ξr0 j 0 Bij Bi0 j 0
R r,r0 =1 i,j,i0 ,j 0 =0
So far it is just substituting and rearranging,
now the split it made between r = r0 and r 6= r0
R D−1
1 X X
∗
= 2( ξri ξrj ξr∗0 i0 ξr0 j 0 Bij Bi0 j 0
R 0 r,r =1 i,j,i0 ,j 0 =0
r6=r0
R
X D−1
X
∗ ∗
+ ξri ξrj ξri0 ξrj 0 Bij Bi0 j 0 )
r=1 i,j,i0 ,j 0 =0
R D−1 R D−1
1 X X X X
∗ ∗
= ( δij δi0 j 0 Bij Bi0 j 0 + ξri ξrj ξri 0 ξrj 0 Bij Bi0 j 0 )
R2 0 r,r =1 i,j,i0 ,j 0 =0 r=1 i,j,i0 ,j 0 =0
r6=r0
D−1 R D−1
1 X 1 XX
= 2 R(R − 1) Bii Bi0 i0 + 2 ( Bii Bjj
R 0
i,i =0
R r=1 i,j=0
i6=j
D−1
X D−1
X
+ Bij Bji + |ξri |4 Bii2 )
i,j=0 i=0
i6=j
The trace of a matrix is usually O(D), as it is proportional to the dimension of the matrix.
Therefore the relative error δΘ
Θ
1
will usually be O( √RD ). As a result for a larger matrix
the amount of random states that need to be evaluated decreases.
Also it can be noted that since the fluctuations depend on |ξri |4 , the ξri should
ideally be chosen such that this term is as close as possible to 1. It can never be less than
one, since property 3) still has to be satisfied. When ξri = eiφ with φ ∈ [0, 2π] a random
phase, it follows that |ξri |4 = 1. The choice of basis vectors |ii also largely influences
the trace terms, making the choice of ξri not trivial. In an eigenbasis of B and using
the random phase as a choice for ξri , δΘ would be 0. In practice the matrix B depends
on an operator applied to a Chebyshev polynomial, making it unlikely to work in the
eigenbasis.
PGaussian distributed ξri are also a logical choice since then |ξri |4 = 2 and
D−1 2
the term j=0 Bjj cancels out in δΘ. Now the influence of the basisvectors has dropped
out, which is a useful choice too.
Where |rn i = Tn (H̃) |ri can be calculated iteratively from |ri using the relation (28).
Note that in this case there is symmetry in (25), which can be used to calculate the
moments more efficiently than (58). This means that the moments can be calculated by
(31) as follows:
R R
1 X 1 X
µ0 = hr|ri µ1 = hr|r1 i (59)
RD r=1 RD r=1
R
1 X
µ2n = 2 hrn |rn i − µ0 (60)
RD r=1
R
1 X
µ2n+1 = 2 hrn+1 |rn i − µ1 (61)
RD r=1
The second case was for the expectation values of an operator A, the moments were
derived to a trace form in (40):
14
R R
1 1 X 1 X
µn = T r(ATn (H̃)) ≈ hr|ATn (H̃)|ri = hr|A|rn i (62)
D RD r=1 RD r=1
Note that the operator A breaks the symmetry, so the symmetric relations can no
longer be used.
The last case was for the time-dependent moments, for which the trace form was
derived in (46).
1 h i
µn,t=m·dt = T r U (0, m · dt)At=m·dt U (m · dt, 0)Tn (H̃t=0 )
D
R
1 X
≈ hr|U (0, m · dt)At=m·dt U (m · dt, 0)Tn (H̃)|ri
RD r=1
R (63)
1 X
= hr|U (0, m · dt)At=m·dt U (m · dt, 0)|rn i
RD r=1
R
1 X
= hrt=m·dt |At=m·dt |rn,t=m·dt i
RD r=1
A way to implement this is to first calculate the states |rn,t=0 i iteratively as in (62)
and calculate the moments µn,t=0 using (63). Then all the states can be propagated in
time one step to get |rn,t=dt i and used to compute µn,t=dt . This process can be repeated
to get all the moments µn,t=m·dt .
The error near the points where f (x) is not differentiable is not bounded and can
fluctuate a lot. This phenomenon is known as Gibbs oscillations. It turns out however
that this expansion can be improved by modifying the moments µn . This can be done by
multiplying the moments by a kernel gn , after which the modified moments will be gn µn .
−1
N
!
1 X
fKP M (x) = √ g0 µ0 + 2 gn µn Tn (x) (65)
π 1 − x2 n=1
The problem of finding an optimal kernel gn has been studied for many years. In the
review of KPM [1] it is shown that the most optimal Kernel is almost always the Jackson
15
Kernel. In the paper this Kernel has been derived and is given by:
(N − n + 1) cos( Nπn
+1
) + sin( Nπn
+1
) cot( Nπn
+1
)
gnJ = (66)
N +1
In the paper it is also shown that the error ||f (x) − fKP M (x)||∞ using this kernel
is of the order of O(1/N ). This means that for N → ∞ this approximation converges
uniformly.
In the future the kernel improved moments will be noted with as µ̄n = gnJ µn .
−1
N
!
1 X
f˜(xk ) = p µ̄0 + 2 µ̄n Tn (xk ) (67)
π 1 − x2k n=1
The µ̄n are the modified moments discussed in the last section. The data points xk will
be chosen as the Chebyshev nodes, which are often useful in numerical analysis. Later on
it will be shown that with these data points (67) can be calculated with a discrete cosine
transform. This choice also improves stability, especially near the bounds of [−1, 1]. The
Chebyshev nodes xk are defined as:
π(k + 1/2)
xk = cos( ) for k = 0, 1, ..., K − 1 (68)
K
Where K is the number of data points. Using the definition of the Chebyshev polynomials
(67) can be written as:
q N
X
2 ˜
γk = π 1 − xk f (xk ) = µ̄0 + 2 µ̄n Tn (xk )
n=1
XN
= µ̄0 + 2 µ̄ cos(n arccos(xk ))
n=1
N
(69)
X π(k + 1/2)
= µ̄0 + 2 µ̄n cos(n arccos(cos( )))
n=1
K
N
X nπ(k + 1/2)
= µ̄0 + 2 µ̄n cos( )
n=1
K
16
Now γk is the definition of a discrete cosine transform of the moments µ̄n , which can be
calculated efficiently and is a clear improvement over summing everything up.
For the time-dependent case numerical integration can also be used as in (70) to get
the time-dependent expectation value of A:
Z b
hAm·dt i = ρA (E, m · dt)n(E) dE
a
K (72)
1X
= (yk+1 − yk )(ρA,t=m·dt (yk−1 )n(yk−1 ) − ρA,t=m·dt (yk )n(yk ))
2 k=1
17
In practice calculating an entire matrix exponential is not possible as in (9), so an approx-
imation can be made. It is important that this approximated operator remains unitary,
since unitary operators preserve the norm of a vector. For a unitary operator U and
a vector v: ||v|| = ||U v||. Therefore if the approximated operator is not unitary the
wave function will grow exponentially when applying the operator. The following unitary
approximation can be made using the identity matrix I:
idt idt
exp(−iH(t)dt) ≈ (I − H(t))(I + H(t))−1 (74)
2 2
This corresponds to a first order Pade approximation. In general this operator is still
expensive to calculate, since it requires matrix inversion. However this simplifies when
applying this operator to a vector. The first part of the operator is trivial, whereas for
the second part of the operator a property of the inverse can be used. Then the outcome
x of applying the second part of the operator to a vector v is x = (1 + idt
2
H(t))−1 v and can
idt
be found by solving v = (1 + 2 H(t))x. This is a linear system and for sparse matrices
there are fast solvers available for such systems of equations.
18
4 Numerical experiments
4.1 General considerations
In the following sections numerical results of the Kernel Polynomial Method will be shown.
One very important Python package for this project is the Kwant package. For this project
the main use of Kwant is to get the Hamiltonian corresponding to a tight binding system.
For small system sizes it is possible to calculate all the eigenstates |ki of the Hamil-
tonian and obtain the exact result. This can be used as a comparison between the KPM
approximation and the exact calculation of the trace.
The two important parameters to chose when using KPM are the amount of moments
N and the amount of random vectors R. The amount of moments directly defines the
amount of points in energy K that can be taken. This will be the main subject of the
next section. How many random vectors are needed depends on the situation, which will
also be shown in the next sections.
To demonstrate this, a tight binding Hamiltonian is obtained using Kwant for a one
dimensional chain of atoms. The tight binding Hamiltonian is given by:
X †
Vi ci ci − t(c†i+1 ci + c†i ci+1 )
H= (76)
i
19
Figure 1: Density of states of a one dimensional chain, for N = 100, N = 400 and
N = 1000
The length of the chain L is taken small, so that the individual delta peaks are visible.
Now for L = 15 and R = 10 random vectors the density of states can be expanded for
different amounts of moments N .
20
For a larger system there are more delta peaks, which overlap even when using a large
amount of moments. This means that as in the case of an infinite system, this function
tells us about the distribution of eigenvalues. When increasing the amount of moments
even more, the individual delta peaks become visible for any finite system.
Here a, b are annihilation operators for the two sublattices of graphene, a† , b† are
creation operators for the sublattices. The sum over hi|ji means summation over the sites
i, j such that i and j are nearest neighbors.
This Hamiltonian can also be obtained from Kwant. In this case a circular flake of
graphene is used with a radius of 200, which gives 290134 by 290134 as the dimension of
H. For R = 10 and N = 400 this results in the following density of states:
Graphene is a zero band gap semiconductor, which can be seen in the plot at E = 0.
The density of states is 0 at E = 0 (but not in an interval around it). It can also be
seen that for this finite system the energy bounds are around Emin = −3 and Emax = 3.
Note that the amount of random states is only 10 whereas if we wanted the trace exactly
we would need 290134 states. This system is too large to calculate the exact eigenstates
of the Hamiltonian, so that comparison cannot be made here. One test is to see what
happens when increasing the amount of random vectors from 10 to 100 and 1000. The
21
amount of moments can also be increased to check if there are any fluctuations in the
density of states on a smaller energy scale.
Figure 3: Density of states of circular graphene when increasing the number of random
vectors, R = 100 and R = 1000
22
In the step from R = 10 to R = 100 a difference in the plots can be seen, indicating
increased convergence. However this change is so small that the case R = 10 already
gives very good convergence. The plot for R = 1000 does not seem any different than the
plot for R = 100, meaning that further increasing the amount of random vectors changes
nothing.
Now the amount of random vectors is kept constant, but the amount of moments is
varied.
Figure 4: Density of states of circular graphene for different amounts of moments, N = 100
and N = 1000
23
As can be seen in the plots the different amount of moments give different results.
There will not be any convergence as in the case of increased amount of random vectors.
This means that the fluctuations in the denstiy of states of a certain system can only be
seen up to the resolution defined by the amount of moments.
Now a magnetic field can be added to the system, perpendicular to the plane of
the graphene. This magnetic field enters the Hamiltonian as a phase in the hoppings.
Compared to the Hamiltonian without magnetic field (77) the hopping t is no longer
constant. This is known as a Peierls substitution, which was introduced in [7].
e (yi + yj )
tij = t exp i B (xi − xj ) (78)
~ 2
In this case xi and yi are the spatial coordinates (x, y) of site i and B is the magnitude
of the magnetic field. Now the Hamiltonian is given by:
X
H=− (tij a†i bj + t†ij b†j ai ) (79)
hi|ji
24
Compared to the density of states without the magnetic field there are two regions
that differ. Around E = 0 and E = 3 fast oscillations can be seen in the density of states,
which is known as Landau quantisation. Now the amount of moments can be varied to
see how this effects the density of states.
Figure 6: Density of states of circular graphene with magnetic field for different amounts
of moments, N = 100 and N = 1000, R = 10
In the case of 100 moments the energy resolution is not small enough to detect the
discrete energy levels. For this reason the density of states looks fairly similar to the
case without magnetic field. In the case of 1000 moments more oscillations are visible,
especially on the energy intervals [−2, 1] and [1, 2].
25
4.3 Expectation values
The Hamiltonian can be used as operator, A = H. In that case the expanded function
becomes:
D−1 D−1
1 X 1 X
ρA (E) = hk|H|ki δ(E − Ek ) = Ek δ(E − Ek ) (80)
D k=0 D k=0
This function is just Eρ(E) with ρ(E) the density of states shown in the last section.
The KPM result of using H as operator and multiplying the density of states with energy
can now be compared. The system is again circular graphene, now with a radius of 100,
N = 100, R = 30.
Figure 7: Comparision between the density of states multiplied by energy and the expec-
tation value as a function of energy of the Hamiltonian
As can be seen in the plot the two results are identical, this shows that both methods
are valid to calculate the expectation value of the Hamiltonian.
26
4.4 Time-dependent expectation values
For a time-dependent Hamiltonian again a one dimensional chain is examined. To add
time dependence to this system an electric field is added,
Combining this with the previously mentioned tight binding Hamiltonian for a 1D
chain (76) gives:
X
Vi,t c†i ci − t(c†i+1 ci + c†i ci+1 )
H(t) = (82)
i
In this case the total energy of the system is of interest, which is just hH(t)i as defined
in (7). If the chain is of length 100 the resulting Hamiltonian is small enough to calculate
all the eigenstates. Now the total energy can be plotted as a function of time using both
KPM and the exact diagonalization.
27
Figure 8: Comparison between exact diagonalization and KPM using 100 random vectors
and 100 moments for a one dimensional chain of length 100.The electric field has amplitude
1 and frequency 1.
Note that in this example the KPM approximation is not quite the same as the exact
diagonalization. The system is small, which is not in favour of KPM. If a better con-
vergence is needed, more random vectors can be taken. This shows that the amount of
random vectors needed depends on the circumstances, as only 10 random vectors were
needed for good convergence for the density of states.
The physical interpretation of this plot is of less importance, but the energy of the
system starts to oscillate with the frequency of the electric field.
Now the length of the chain can be increased from 100 to 1000, when keeping the
other parameters the same.
28
Figure 9: Comparison between exact diagonalization and KPM using 100 random vec-
tors and 100 moments for a one dimensional chain of length 1000.The electric field has
amplitude 1 and frequency 1.
This result may not seem better than for L = 100 but note that the scale on the
vertical axis is a lot smaller in this case. This means that the relative error has decreased
by a lot with the increased length of the chain.
29
5 Conclusion, discussion and future developments
The main goal of the project was to use the Kernel Polynomial Method to calculate ex-
pectation values of physical operators and add time-dependence. In order to do that, a
mathematical derivation of the KPM was needed, which is the first part of this research.
Implementing these mathematical results in Python and running simulations on tight
binding systems was the other part. The first part was definitely not groundbreaking
because it has been done before, but still essential to understand the KPM and be able
to implement it. The added time-dependence has not been seen before in the previous
paper on the KPM.
This section will therefore focus on the numerical part of this paper, since the main
new results and future developments are there.
The results for the density of states were good and even surprisingly accurate since
in most cases only 10-50 random vectors were needed to get a very accurate plot. To be
able to plot the density of states for a finite system the delta peaks must be somewhat
smoothed, which is automatically done since the KPM approximates it as a finite poly-
nomial. Adding the magnetic field to the system showed Landau quantization, making
the energy levels discrete.
For the expectation values the Hamiltonian has been considered as an operator. In
this case the density of states times energy is the same as the expectation value of the
Hamiltonian, this has also been shown using the KPM. When an electric field was added
to the system the total energy of the system started to oscillate in time.
In this case comparing the expectations values calculated by the exact diagonalization
of the Hamiltonian to the KPM approximation did not exactly converge. This indicates
that to calculate expectation values often a lot more random vectors are needed than to
calculate the density of states. This made getting good results especially for large systems
hard. For large systems the comparison between exact diagonalization and KPM is not
possible anymore, since finding all the eigenstates becomes impossible.
Some tests have also been done to implement the current density operator, of which
the expectation values indicate the current going through the different links in the tight
binding system. For both the Hamiltonian and the current density operator often thou-
sands of random vectors are needed, which is still good compared to the system size.
In future research the expectation values of other operators could be calculated using
the KPM. Since the KPM relies on statistical convergence, experiments with large sys-
tems and many random vectors can be done. In this case the question is how the KPM
performs compared to other available methods to calculate expectation values.
The implementation of the time propagator is logical, but still the most intensive part
of the algorithm; other implementations could be tried. For this part a linear system has
to be solved, a standard iterative solver has been used in this project. Since the time
30
propagator is close to identity for small time steps this seems to be a good choice, but
there are other possibilities.
31
6 Apendices
6.1 Appendix A: Chebyshev expansion
Two types of Chebyshev polynomials will be used in this project. Chebyshev polynomials
of the first kind are the unique polynomials Tn satisfying
Tn (cos θ) = cos(nθ).
The second kind Un satisfy the condition:
Un (cos(θ)) = sin((n+1)θ)
sin θ
.
Later it will be shown that these Tn and Un are indeed polynomials. The next step is to
show that Tn and Un are orthogonal under the following internal product:
Z 1
hf |gi = w(x)f (x)g(x) dx (83)
−1
Z 1 √
hf |gi2 = π 1 − x2 f (x)g(x) dx (85)
−1
(1 + δn,0 )
hTn |Tm i1 = δn,m (86)
2
π2
hUn |Um i2 = δn,m (87)
2
32
Where δn,m is the Kronecker delta, which has the value 1 if n = m and 0 when n 6= m.
First (86) will be proven:
Z 1
Tn (x)Tm (x)
hTn |Tm i1 = √ dx
2
−1 (π 1 − x )
Z 0
Tn (cos(θ))Tm (cos(θ))
= √ (−sin(θ) dθ)
π (π 1 − cos2 θ)
1 π
Z
= cos(nθ) cos(mθ) dθ
π 0
Z π
1
= cos(nθ) cos(mθ) dθ
2π −π
(88)
0
if n 6= m
= 1 if n = m = 0
R π (1+cos(2nθ))
dθ if n = m 6= 0
−π 2
0
if n 6= m
= 1 if n = m = 0
1
2
if n = m 6= 0
δn,0 + 1
= δn,m
2
Orthogonality of cos(nθ) on the interval [−π, π] was used and also that cosine is an even
function. Now for equation (87):
Z 1 p
hUn |Um i2 = Un (x)Um (x)(π 1 − x2 ) dx
−1
Z 0 √
= Un (cos(θ))Um (cos(θ))(π 1 − cos2 θ)(− sin(θ) dθ)
π
Z π
sin((n + 1)θ) sin((m + 1)θ)
=π (sin2 (θ) dθ
0 sin(θ) sin(θ)
Z π
=π sin((n + 1)θ) sin((m + 1)θ) dθ
Z0 π
π (89)
= sin((n + 1)θ) sin((m + 1)θ) dθ
2
( −π
0 if n 6= m
= R π 1−cos(2(n+1)θ))
−π 2
dθ if n = m
(
0 if n 6= m
= π2
2
if n = m
π2
= δn,m
2
It was used that sines are odd functions and that the product of two odd functions is
even. And also orthogonality of sin((n + 1)θ) on the interval [−π, π].
33
These Chebyshev polynomials can also be written in explicit form, using the identities
given at the start of this section:
Tn (x) = cos(n arccos(x)) (90)
sin((n + 1) arccos(x))
Un (x) = (91)
sin(arccos(x))
From this definition it follows that both types of Chebyshev polynomials are only defined
for x ∈ [−1, 1]. From these equations the following can be obtained:
T0 (x) = 1 T−1 (x) = T1 (x) = x (92)
U0 (x) = 1 U−1 (x) = 0 (93)
And those can be used to prove the following recursion relations:
Tm+1 (x) = 2xTm (x) − Tm−1 (x) (94)
Um+1 (x) = 2xUm (x) − Um−1 (x) (95)
Using the substitution x = cos(θ) :
Tm+1 (x) = cos((m + 1) arccos(cos(θ)))
= cos((m + 1)θ)
= cos(mθ) cos(θ) − sin(mθ) sin(θ)
= 2 cos(θ) cos(mθ) − (cos(mθ) cos(θ) + sin(mθ) sin(θ)) (96)
= 2 cos(θ) cos(mθ) − cos((m − 1)θ)
= 2x cos(m arccos(x)) − cos((m − 1) arccos(x))
= 2xTm (x) − Tm−1 (x)
And for Um (x) again using x = cos(θ) :
sin((m + 2) arccos(x))
Um+1 (x) =
sin(arccos(x))
sin((m + 2)θ)
=
sin(θ)
sin(mθ) cos(2θ) + cos(mθ) sin(2θ)
=
sin(θ)
2
sin(mθ)(cos (θ) − 1) + cos(mθ)(2 sin(θ) cos(θ))
=
sin(θ)
2
− sin(mθ) + 2 cos (θ) sin(mθ) + 2 sin(θ) cos(θ) cos(mθ) (97)
=
sin(θ)
2 cos(θ)(sin(mθ) cos(θ) + cos(mθ) sin(θ)) sin(mθ)
= −
sin(θ) sin(θ)
2 cos(θ)(sin((m + 1)θ) sin(mθ)
= −
sin(θ) sin(θ)
2x sin((m + 1) arccos(x) sin(m arccos(x))
= −
sin(arccos(x)) sin(arccos(x))
= 2xUm (x) − Um−1 (x)
34
This also shows that both Un and Tn are polynomials. These polynomials are very
useful in numeric analysis in general and will be used a lot in this project. Two other
useful relations for these Chebyshev polynomials are:
2Tm (x)Tn (x) = Tm+n (x) + Tm−n (x) (98)
2
2(x − 1)Um−1 (x)Un−1 (x) = Tm+n (x) − Tm−n (x) (99)
Using the substitution x = cos(θ).
Tm+n (x) + Tm−n (x) = cos((m + n)θ) + cos((m − n)θ)
= cos(mθ) cos(nθ) − sin(mθ) sin(nθ) + cos(mθ) cos(−nθ) − sin(mθ) sin(−mθ)
= cos(mθ) cos(nθ) + cos(mθ) cos(nθ) − sin(mθ) sin(nθ) + sin(mθ) sin(mθ)
= 2 cos(mθ) cos(nθ)
= 2Tm (cos θ)Tn (cos θ)
= 2Tm (x)Tn (x)
(100)
And the second one:
Tm+n (x) − Tm−n (x) = cos((m + n)θ) − cos((m − n)θ)
= cos(mθ) cos(nθ) − sin(mθ) sin(nθ) − cos(mθ) cos(−nθ) + sin(mθ) sin(−mθ)
= cos(mθ) cos(nθ) − cos(mθ) cos(nθ) − sin(mθ) sin(nθ) − sin(mθ) sin(mθ)
= −2 sin(mθ) sin(nθ)
= −2 sin2 θ Um−1 (cos θ) Un−1 (cos θ)
= 2(cos2 θ − 1) Um−1 (cos θ) Un−1 (cos θ)
= 2(x2 − 1)Um−1 (x)Un−1 (x)
(101)
.
Now a Chebyshev expansion can be made. This means that a function f (x) can be
expressed as a series of weighed Chebyshev polynomials:
∞
X
f (x) = αn Tn (x) (102)
n=0
Here αn is the projection of the funtion f on Tn : α = hTn |f i1 / hTn |Tn i1 .This expansion
can also be done with the polynomial Un and works exactly the same way. It is now
time to take a closer look at the Chebyshev expansion (102). To make an expansion
the coefficients αn will have to be calculated. This requires integration over the weight
function, which can be avoided by modifying (102).
∞
X hTn |f i1
f (x) = Tn (x) (103)
n=0
hT n |Tn i1
Now the following orthogonal functions can also be used to expand f (x):
Tn (x)
φn (x) = √ (104)
π 1 − x2
35
The orthogonality of these function φn can easily be shown using the proven orthogonality
of Tn (x):
Tn (x)Tm (x) √
Z 1
hφn |φm i2 = √ (π 1 − x2 ) dx
(π 1 − x 2 )2
−1
Z 1
Tn (x)Tm (x)
= √ dx
−1 π 1 − x
2 (105)
= hTn |Tm i1
δn,0 + 1
= δn,m
2
This means that these φn span the entire space and so a function f (x) can also be written
as:
∞
X hφn |f i2
f (x) = φn (x)
n=0
hφn |φn i2
∞
X
= hφ0 |f i2 φ0 (x) + 2 hφn |f i2 φn (x)
n=1
∞
Tn (x) X Tn (x)
= hφ0 |f i2 √ +2 hφn |f i2 √ (106)
π 1−x 2 π 1 − x2
n=1
∞
!
1 X
= √ hφ0 |f i2 Tn (x) + 2 hφn |f i2 Tn (x)
π 1 − x2 n=1
∞
!
1 X
= √ µ0 + 2 µn Tn (x)
π 1 − x2 n=1
This result is very useful since now the αn are modified to µn , so to calculate these µn
the weight function does no longer have to be integrated. With this result it is possible
to start looking for applications of this expansion, for which the moments µn will have to
be calculated. For this there are different techniques since µn depends on f (x); this will
be looked at in the next section.
36
6.2 Appendix B: Calculation of moments
In this appendix a few proofs that are not specific to the KPM are included.
Eigenvectors of a polynomial
To prove this, we substitute H̃ |ki = Ẽk |ki n times, using that Ẽk is a constant:
n
X
Pn (H̃) |ki = ai H̃ i |ki
i=0
= Pn (Ẽk ) |ki
Let O ∈ Cn×n be an operator and V = {|u1 i , |u2 i , ..., |un i} be an orthonomal basis
of Cn . Define U = |u1 i , |u2 i , ..., |un i , it follows that U † U = U U † = I so U is unitary.
Now use the property of the trace that T r(AB) =
PT r(BA) for any
P square matrices of the
same dimension A, B. Define Õ = U † OU , then i hui |O|ui i = i hui |Õ|ui i = T r(Õ) =
T r(U † OU ) = T r(U U † O) = T r(O).
37
6.3 Appendix C: Python code used for numerical experiments
% matplotlib notebook
import numpy as np
import math
import cmath
import numpy. linalg as nla
import matplotlib . pyplot as plt
import matplotlib . animation as animation
import random
import scipy. sparse
import scipy. sparse . linalg as splin
import scipy. fftpack as fftp
from scipy. sparse import coo matrix
import matplotlib .mlab as mlab
from math import sqrt , pi
import kwant
from cmath import exp
from types import SimpleNamespace
#The J a c k s o n K e r n e l improvement
def Jackson kernel (N):
n = np. arange (N)
return ((N−n+1) ∗ np.cos(np.pi ∗n/(N+1))+np.sin(np.pi∗n/(N+1))
/np.tan(np.pi/(N+1)))/(N+1)
38
sys = sys. finalized ()
return sys. hamiltonian submatrix ( sparse =True)
# Adding m a g n e t i c f i e l d t o t h e s y s t e m when r e q u i r e d , i f no
m a g n e t i c f i e l d , h o p p i n g = −1 f o r example .
def hopping ( site i , site j ):
xi , yi = site i .pos
xj , yj = site j .pos
return −exp(−0.5j ∗ magn field const ∗ (xi − xj) ∗ (yi + yj
))
#R e s c a l i n g t h e H a m i l t o n i a n t o t h e i n t e r v a l [ − 1 , 1 ]
def rescale (H):
dim=H.shape [0]
lmax = float(splin.eigsh(H, k=1, which=’LA’,
return eigenvectors =False , ncv =25));
lmin = float(splin.eigsh(H, k=1, which=’SA’,
return eigenvectors =False , ncv =25));
a = (lmax − lmin) / 1.99;
b = (lmax + lmin) / 2;
H rescaled = (1/a) ∗ (H − b ∗ scipy. sparse .eye(dim));
return H rescaled , a, b
Parameters :
−−−−−−−−−−−
H : sparse matrix
Hamiltonian of the system
N : integer
Number o f C h e b y s h e v moments
num vec : i n t e g e r
Number o f random v e c t o r s u s e d f o r s a m p l i n g
K : integer
Number o f p o i n t s a t which t h e d e n s i t y o f s t a t e s i s
computed
Must be l a r g e r t h a n N
Returns :
−−−−−−−−
39
rho : 1D a r r a y
Density of s t a t e s at K points
x k : 1D a r r a y
P o i n t s a t which t h e d e n s i t y o f s t a t e s i s e v a l u a t e d
”””
#R e s c a l e H a m i l t o n i a n
H rescaled , scale fact a , scale fact b = rescale (H)
dim =H.shape [0]
#Empty v e c t o r mu f o r c o n s t r u c t i n g t h e moments
mu = np.zeros(N)
for r in range( num vec ):
#Make a random v e c t o r
rand vect = np.exp (1j ∗ 2 ∗ np.pi ∗ np. random .rand(dim)
)
#Use i t e r a t i v e scheme t o c a l c u l a t e t h e moments
alpha = []
alpha. append ( rand vect )
alpha. append ( H rescaled .dot( rand vect ))
#m u s i n g l e s t a t e i s t h e moment u s i n g o n l y one random
v e c t o r , add up a l l t h e s t a t e s t o g e t t h e moments mu
mu single state = np.zeros(N, dtype= complex )
mu single state [0] = (alpha [0].T.conj ()).dot(alpha [0])
mu single state [1] = (alpha [0].T.conj ()).dot(alpha [1])
for n in range (1,N//2):
alpha. append (2∗ H rescaled .dot(alpha[n])−alpha[n−1])
#Use t h e s y m m e t r i c a l r e l a t i o n d i s c u s s e d i n t h e
s e c t i o n c a l c u l a t i o n o f moments o f t h e d e n s i t y o f
states
mu single state [2∗n] = 2∗( alpha[n].T.conj ()).dot(
alpha[n]) − mu single state [0]
mu single state [2∗n+1] = 2∗( alpha[n+1].T.conj ()).
dot(alpha[n])−mu single state [1]
mu = mu + mu single state .real
mu = mu/ num vec /dim
mu ext = np.zeros(K)
#Apply t h e J a c k s o n K e r n e l improvement
mu ext [0:N] = mu∗ Jackson kernel (N)
#Use t h e d i s c r e t e c o s i n e t r a n s f o r m t o g e t b a c k t o t h e
original density of states
mu T = fftp.dct( mu ext ,type =3)
k = np. arange (0, K)
#D e f i n e t h e C h e b y s h e v nodes xk
xk rescaled = np.cos(np.pi ∗(k+0.5)/K)
#F i n a l m u l t i p l i c a t i o n and r e s c a l i n g t o g e t t h e d e n s i t y o f
states
40
gk = np.pi ∗np.sqrt(1.−xk rescaled ∗∗2)
xk = xk rescaled ∗ scale fact a + scale fact b
rho = np. divide ( mu T ,gk)/( scale fact a )
return rho , xk
def calc exp values operator (H, A, N, num vec , K, T=0, dt=1,
temp =0, integrate = True , E fermi =0):
””” C a l c u l a t e time−d e p e n d e n t e x p e c t a t i o n v a l u e s
Parameters :
−−−−−−−−−−−
H : f u n c t i o n or s p a r s e m a t r i x
When H i s a f u n c t i o n H( t ) r e t u r n s t h e H a m i l t o n i a n a t
time t
A : f u n c t i o n or s p a r s e m a t r i x
O p e r a t o r o f whic h t h e t i m e d e p e n d e n t e x p e c t a t i o n v a l u e s
a r e computed
When A i s a f u n c t i o n A( t , p s i 1 , p s i 2 ) must r e t u r n <
p s i 1 | A( t ) | p s i 2 >,
N : integer
Number o f C h e b y s h e v moments .
num vec : i n t e g e r
Number o f random v e c t o r s u s e d f o r s a m p l i n g .
K : integer
Number o f p o i n t s f o r which t h e e x p e c t a t i o n v a l u e o f A
is calculated
Must be l a r g e r t h a n N
T : float
Time i n t e r v a l , o p t i o n a l , d e f a u l t = 0
dt : f l o a t
Time s t e p , o p t i o n a l , d e f a u l t = 1
i n t e g r a t e : boolean
I f i n t e g r a t e = True r e t u r n s t h e i n t e g r a t e d v e r s i o n o f
t h e expanded f u n c t i o n u s i n g Fermi−Dirac w e i g h t
temp : f l o a t
I n i t i a l t e m p e r a t u r e o f t h e system , o p t i o n a l , d e f a u l t =
0
Returns :
−−−−−−−−
E x p e c t a t i o n v a l u e s : dense matrix
Time−d e p e n d e n t e x p e c t a t i o n v a l u e s , i f i n t e g r a t e = f a l s e
r e t u r n s e x p e c t a t i o n v a l u e s as a f u n c t i o n o f e n e r g y
”””
41
#F i r s t c h e c k t i m e d e p e n d e n c e and t i m e s t e p s
if T == 0:
steps = 1
else:
steps = int(round(T / dt))
#R e s c a l e t h e ( i n i t i a l ) H a m i l t o n i a n
if callable (H):
H 0 , scale fact a , scale fact b = rescale (H(0))
else:
H 0 , scale fact a , scale fact b = rescale (H)
dim = H 0 .shape [0]
eye = scipy. sparse .eye(dim)
#Check w h e t h e r t h e o p e r a t o r i s l o c a l , i n which c a s e moments
a r e r e t u r n e d f o r e v e r y s i t e ( t o t a l amount o f s i t e s L)
if callable (A):
L = len(A(0,np.zeros(dim)∗1j,np.zeros(dim)∗1j))
else:
L = 1
#D e f i n e empty v e c t o r s mu, m u s i n g l e s t a t e t o c o n s t r u c t t h e
moments
mu = np.zeros ((N, steps ,L))
mu single state = np.zeros ((N,L), dtype= complex )
for r in range( num vec ):
#D e f i n e a random v e c t o r
rand vect = np.exp (1j ∗2 ∗ np.pi ∗ np. random .rand(dim))
#Use t h e i t e r a t i v e scheme t o c a l c u l a t e t h e moments a t
the i n i t i a l time
alpha = []
alpha. append ( rand vect )
alpha. append ( H 0 .dot( rand vect ))
for n in range (1, N−1):
alpha. append (2 ∗ H 0 .dot(alpha[n]) − alpha[n−1])
for n in range(N):
if callable (A):
mu single state [n ,:] = A(0, alpha [0], alpha[n])
else:
mu single state [n ,:] = alpha [0].T.conj () @ A @
alpha[n]
mu [: ,0 ,:] = mu [: ,0 ,:] + mu single state .real
#I f t i m e d e p e n d e n c e : s t a r t t a k i n g t i m e s t e p s t o
c a l c u l a t e moments a t e v e r y t i m e .
for k in range (1, steps):
U1 = eye − 0.5j ∗ H(k ∗ dt) ∗ dt # t i m e p r o p a g a t o r s
U2 = eye + 0.5j ∗ H(k ∗ dt) ∗ dt
mu single state = np.zeros ((N,L), dtype= complex )
42
for n in range(N):
alpha[n]= U1.dot(splin.cgs(U2 , alpha[n]) [0])
if callable (A):
mu single state [n ,:] = A(k∗dt ,alpha [0],
alpha[n])
else:
mu single state [n ,:] = alpha [0].T.conj () @
A @ alpha[n]
mu[:,k ,:] = mu[:,k ,:] + mu single state .real
mu = mu/ num vec /dim
mu ext = np.zeros ((K,steps ,L))
#Apply t h e J a c k s o n K e r n e l t o g e t t h e improved moments
J = Jackson kernel (N). reshape ((N ,1 ,1))
mu ext [:N ,: ,:] = mu∗J
ks = np. arange (0, K)
xk rescaled = np.cos(np.pi ∗( ks +0.5)/K)
xk = xk rescaled ∗ scale fact a + scale fact b
gk = np.pi ∗np.sqrt(1.−xk rescaled ∗∗2) . reshape ((K ,1 ,1))
#Use t h e d i s c r e t e c o s i n e t r a n s f o r m t o go from moments t o
original function
expectation values = fftp.dct( mu ext ,type =3, axis =0)/gk
#Return t h e f i n a l e x p e c t a t i o n v a l u e s
E fermi = ( E fermi−scale fact b )/ scale fact a
if not integrate :
return np. squeeze ( expectation values )/ scale fact a , xk
else:
return 1/K∗np.sum( expectation values ∗
fermi distribution ( xk rescaled ,temp , E fermi ). reshape
((K ,1 ,1)),axis =0)
43
References
[1] J. P. Dahlhaus, B. M. Fregoso, and J. E. Moore. Magnetization Signatures of Light-
Induced Quantum Hall Edge States. Physical Review Letters, 114(24):246802, June
2015.
[2] A. Weiße, G. Wellein, A. Alvermann, and H. Fehske. The kernel polynomial method.
Reviews of Modern Physics, 78:275–306, January 2006.
[3] J.R. Hook and H.E. Hall. Solid state physics. The Manchester physics series. Wiley,
1991.
[4] D.J. Griffiths. Introduction to Quantum Mechanics. Pearson Prentice Hall, 2005.
44