Download as pdf or txt
Download as pdf or txt
You are on page 1of 26

PY 502, Computational Physics, Fall 2018

Numerical Solutions of the Schrödinger Equation


Anders W. Sandvik, Department of Physics, Boston University

1 Introduction

The most basic problem in quantum mechanics is to solve the stationary Schrödinger equation,

h̄2 2
− ∇ Ψn (~x) + V (~x)Ψn (~x) = En Ψn (~x), (1)
2m
for the energy eigenvalues En and the associated energy eigenfunctions (stationary states) Ψn .
There are a number of important cases for which the stationary Schrödinger equation can be solved
analytically, e.g., the harmonic oscillator (in any number of dimensions) and the hydrogen atom.
However, in most cases of practical interest (in, e.g., atomic, molecular, and solid-state physics)
exact or approximate numerical methods must be employed.

Here we will first discuss solutions of the Schrödinger equation (1) in one dimension, which is a
problem almost identical to solving the radial wave function for spherically symmetric potentials
in two or three dimensions. We will derive and use Numerov’s method, which is a very elegant
fifth-order scheme (i.e., with single-step error scaling as the sixth power of the space step ∆x ) for
equations of the Schrödinger form.

In dimensions higher than one, if the potential cannot be separated, i.e., it cannot be written as a
product of potentials of the different coordinates, solving the Schrödinger equation numerically is
in general quite a complex problem. This stems from the large number of points needed on a grid
and the requirement to satisfy boundary conditions on a whole curve or surface, instead of just at
two points in one dimension. In practice, variational methods are therefore often used, where the
wave function is expanded in an incomplete set of conveniently chosen basis states (i.e., one not
spanning the full Hilbert space and hence leading to energies higher than the true eigenvalues En ).
This reduces the calculation to an eigenvalue problem (or generalized eigenvalue problem in the
case of a non-orthogonal basis) in a discrete finite-dimensional space. We will show some examples
of variational calculations and discuss the matrix diagonalizations that have to be performed to
solve the resulting eigenvalue problems. We will also discuss a grid method, based on a set of basis
functions describing particles localized inside a small finite volume, in which case a sparse-matrix
diagonalization technique—the Lanczos method—can be used to obtain the low-lying states.

In addition to stationary solutions of the Schrödinger equation, we will discuss the time dependence
of wave functions. The time-dependence of a stationary state only involves a phase factor;

Ψn (t) = e−itEn /h̄ Ψn (0), (2)

where Ψn (0) = Ψn . Thus, if an arbitrary state Ψ at t = 0 is expanded in the stationary states,


X Z
Ψ= Cn Ψn , Cn = dxd Ψn (~x)Ψ(~x), (3)
n

1
where d is the number of dimensions, its time dependence is given by
X
Ψ(t) = Cn e−itEn /h̄ Ψn . (4)
n

However, it is not always practical to solve for all the energy eigenstates, and one can alternatively
directly solve the time dependent Schrödinger equation,
∂Ψ(~x)
ih̄ = HΨ(~x, t), (5)
∂t
where the Hamiltonian is
h̄2 2
H=− ∇ + V (~x). (6)
2m
The time dependent equation has the formal solution

Ψ(t) = e−itH/h̄ Ψ(0), (7)

which can be easier to work with than the underlying partial differential equation (5). Here we will
briefly discuss numerical solutions of the time dependent Schrödinger equation using the formal
solution (7) with the time evolution operator for a short time ∆t approximated using the so-called
Trotter decomposition;
2
e−∆t H/h̄ = e−δt h̄∇ /2m e−∆t V (~x)/h̄ + O(∆t )2 , (8)
and higher-order versions of it. By alternating between the wave function Ψ(~x) in the position basis
and its Fourier transform Ψ(~k), the time evolution can be carried out by simple multiplications. We
will discuss the Fast-Fourier-Transform method, which should be used to efficiently carry out the
long series of Fourier and inverse Fourier transformations needed to propagate the wave function
this way for a large number of time steps.

2 One-dimensional stationary Schrödinger equations

In one dimension, the time independent Schrödinger equation (1) reduces to

h̄2 d2 Ψ(x)
− + V (x)Ψ(x) = EΨ(x). (9)
2m dx2
For a spherically symmetric potential in three dimensions, the Schrödinger equation factorizes into
a radial and angular part,
ΨL,Lz ,n (~x) = RL,n (r)YL,Lz (φ, Θ), (10)
where YL,Lz (φ, Θ) are the spherical harmonics and the radial function satisfies the equation

h̄2 1 d2 L(L + 1)h̄2


 
− r+ + V (r) RL,n (r) = EL,n RL,n (r). (11)
2m r dr2 2mr2
For a two-body system with a central potential, the mass m should be replaced by the reduced
mass, but otherwise the equations are the same. Defining the function

UL,n (r) = rRL,n (r), (12)

2
a simpler radial equation is obtained;

h̄2 d2 L(L + 1)h2


 
− + + V (r) UL,n (r) = EL,n UL,n (r). (13)
2m dr2 2mr2

This is of the same form as the one-dimensional Schrödinger equation (9), apart from the fact that
−∞ < x < ∞ but r ≥ 0, and the presence of the repulsive ”centrifugal barrier” which effectively
contributes to the potential energy.

2.1 Numerov’s algorithm

The one-dimensional Schrödinger equation (9) and the reduced radial equation (13) can both be
written in the form
Ψ00 (x) = f (x)Ψ(x). (14)
To solve this type of equation numerically, we discretize the coordinate x using a uniform grid;
xk = k∆x . We could now in principle proceed to rewrite the second-order differential equation as
two coupled first-order equations, as we did in the case of the classical equations of motion, and
then use, e.g., the Runge-Kutta method to integrate these. However, for the particular type of
second order equation (14), a much simpler and very elegant scheme can be constructed which is
of one higher order, i.e., with step error O(∆6x ). It is known as Numerov’s method, and is derived
by adding the Taylor expansion for Ψ(xk+1 ) = Ψ(xk + ∆x ),

X (−1)n
Ψ(xk+1 ) = Ψ(xk ) + ∆nx Ψ(n) (xk ), (15)
n!
n=1

and the corresponding expansion for Ψ(xk−1 ), resulting in


1 4 (4)
Ψ(xk+1 ) + Ψ(xk−1 ) = 2Ψ(xk ) + ∆2x Ψ00 (xk ) + ∆ Ψ (xk ) + O(∆6x ). (16)
12 x
Defining the central difference operator, acting on an arbitrary function g(x),

δg(x) = g(x + ∆x /2) − g(x − ∆x /2)


δ 2 g(x) = δ[δg(x)] = g(x + ∆x ) − 2g(x) + g(x − ∆x ), (17)

Eq. (16) can be written as


1 4 (4)
δ 2 Ψ(xk ) = ∆2x Ψ00 (xk ) + ∆ Ψ (xk ) + O(∆6x ). (18)
12 x
Here we do not know the fourth derivative, but we can write it as a central difference of the second
derivative, using the above equation itself with the fourt-order term neglected:

∆2x Ψ(4) (xk ) = ∆2x [Ψ00 (xk )]00 = δ 2 Ψ00 (xk ) + O(∆4x ). (19)

Hence, Eq. (18) can be written as


1 2 2 00
δ 2 Ψ(xk ) = ∆2x Ψ00 (xk ) + ∆ δ Ψ (xk ) + O(∆6x ). (20)
12 x

3
This is a general result. Now, for the equation type (14) that we are intrested in, we can replace
Ψ00 (xk ) by f (xk )Ψ(xk ) and obtain
1 2 2
δ 2 Ψ(xk ) = ∆2x f (xk )Ψ(xk ) + ∆ δ [f (xk )Ψ(xk )] + O(∆6x ), (21)
12 x
or, with the abbreviated notation gn = g(xn ),
1 2
Ψk+1 − 2Ψk + Ψk−1 = ∆2x fk Ψk + ∆ [fk+1 Ψk+1 − 2fk Ψk + fk−1 Ψk−1 ] + O(∆6x ), (22)
12 x
where there should be no confusion with the nth eigenfunction, denoted Ψn (x). Introducing a new
function,
φk = Ψk (1 − ∆2x fk /12), (23)
a simpler form corresponding to (22) is obtained;

φk+1 = 2φk − φk−1 + ∆2x fk Ψk + O(∆6x ). (24)

Comparing this with the rather complex fourth-order Runge-Kutta formula, this is clearly a very
elegant fifth-order scheme.

2.2 Boundary conditions and energy finding strategy

In general the eigenfunctions Ψn (x) and UL,n (r) are defined for all −∞ < x < ∞ and r ≥ 0,
respectively. Numerically we have to restrict the integration to within a finite range, however.
Appropriate boundary conditions have to be imposed at the two end points. In the case of the
reduced radial wave function, normalizability requires UL,n (0) = 0 because the full radial wave
function is obtained by multiplying it with 1/r, according to (12). For r → ∞ one can often
obtain an asymptotic form, and this can be used to construct starting values UL,n (rmax ) and
UL,n (rmax − ∆r ) for integrating toward the center (one should then check the convergence of the
result as rmax is increased). Asymptotic forms Ψn (x → ±∞) can similarily be found for one-
dimensional problems, and they can be used for boundary conditions at x = ±xmax , or there may be
”hard walls” beyond which the potential is considered infinite and the wave function vanishes. Note
that the starting values do not have to correspond to a normalized wave function; normalization
can be carried out after the integration. As an example, with a hard wall at x = x0 one can thus
start with Ψ(x0 ) = 0 and Ψ(x0 + ∆x ) = 1.

For the Schrödinger equation (9), setting h̄ = m = 1, we have f (x) = 2[V (x) − E]. If we have used
boundary conditions to generate Ψ0 and Ψ1 (at one end of the integration range starting at x0 )
and then calculate φ0 and φn according to Eq. (23), a Fortran code segment for integrating a total
of nx steps (to the other end of the integration range) can look like this:

do ix=2,nx
q2=dx2*f1*psi(ix-1)+2.d0*q1-q0
q0=q1; q1=q2
f1=2.d0*(potential(x0+dx*dble(ix))-energy)
psi(ix)=q1/(1.d0-dx2*f1)
end do

4
1

0.5

ψ(x)

-1 -0.5 0 0.5 1
x

Figure 1: Wave functions generated in the shooting method for a potential well with infinitely
repulsive walls. The dashed curves show the wave functions obtained with the bracketing energies
E 1 = 1.0 and E 2 = 1.5. The other curves were obtained using bisection to gradually approach the
boundary condition Ψ(1) = 0. With the two bracketing energies used, the ground state, for which
the exact wave function Ψ(x) = cos (πx/2), is obtained.

where dx2=∆2x , variables q0,q1,q2 have been used for φk−1 , φk , φk+1 , and psi(k) is the actual
wave function Ψ(xk ). The potential energy is here given by a function potential(x), and the
energy, which typically will be a current guess for the actual energy sought, is stored in energy.
If the resulting psi(nx) satisfies the appropriate boundary condition a solution has been found; if
not the energy has to be adjusted and another run through the loop has to be perfomed.

An efficient way to systematically adjust the energy toward a solution is to use bisection (recall
Homework assignment 1). Denote by δ(E) the deviation of the wave function ΨNx (now assumed
normalized) at the end of the integration range from the boundary condition ΨNx = ΨbNx to be
satisfied there when the energy used in the integration is E. We first search for two energies
E 1 and E 2 leading to different signs of δ, i.e, δ(E 1 )δ(E 2 ) ≤ 0. These energies must bracket an
eigenvalue En (or an odd number oif eigenvalues). Such a bracketing pair can simply be searched
for by carrying out the integration using energies E = E 0 + k∆E , k = 0, 1, . . ., until the sign of
δ changes (assuming that there is an eigenvalue with energy > E0 , and that the increment ∆E is
small enough for there not to be two eigenvalues within one step). When such a pair E 1 , E 2 and
has been found, an integration is carried out using E = (E 1 + E 2 )/2, and depending on whether
δ(E 3 )δ(E 1 ) is positive or negative the pair E 1 , E 3 or E 2 , E 3 is used as the bracketing pair in a
repetition of the above procedure. This bisection is continued until either the difference between
the bracketing energies or the deviation |δ| is smaller than some  corresponding to a sufficiently
accurate solution. This technique for gradually refining the solution is often called the “shooting
method”.

Fig. 1 illustrates the shooting method applied to the square well potential with infinite repulsion
for |x| > 1 and V (x) = 0 for |x| ≤ 1. The integration was started at x = −1, with the boundary
condition Ψ(−1) = 0 and Ψ(−1 + ∆x ) = 1, with the step size ∆x = 0.002. The wave functions were

5
0.7

0.6 xmax=2
xmax=3
0.5 xmax=4
xmax=5
0.4
ψ(x)
0.3

0.2

0.1

0
-4 -2 0 2 4
x
p
Figure 2: Wave function for the potential V (x) = − exp (− |x|) integrated between
p −xmax and
xmax with xmax = 2, 3, 4, 5, using the asymptotic form Ψ(x → ±∞) ∼ exp [−|x| 2(V (±∞) − E)]
applied at x = −xmax and x = −xmax + ∆x , and requiring Ψ(xmax ) = Ψ(−xmax ).

normalized after each integration, and the deviation of the boundary value Ψ(1) from 0 was used
for bisection. Using initial energies E 1 , E 2 bracketing the exact ground state energy E0 = π 2 /8 of
this system, the energy after a large number of bisections converged to E = 1.233700550136, which
agrees with the true ground state energy to 9 decimal places.

For “soft” potentials, asymptotic forms for x → ±∞ can typically be derived, which can then
be applied at the ends of a finite integration range [−xmax , xmax ] if xmax is large. If the potential
p a constant at long distances the asymptotic solution for a bound state is Ψ(x → ±∞) ∼
approaches
exp [−|x| 2(V (±∞) − E)]. Depending on exactly how the constant potential is approached, there
can be corrections to this form, which typically can be neglected as long as xmax is sufficiently large.
The asymptotic form can be applied at x = −xmax and x = −xmax + ∆x to start the integration,
and at the other end point one can use Ψ(xmax ) = −Ψ(xmax ) (strictly only under the assumption
that the potential has the same long-distance form form x → ±∞, but if xmax is sufficiently large
for the wave function to be very small at both boundaries this condition should always work well).
In order to make sure that xmax is chosen sufficiently large, one should compare solutions obtained
with different choises. An illustration of the dependence of the solution on xmax is shown in Fig. 2
for an exponentially decaying attractive potential. Here the wave functions have been normalized
using only the integral of the Ψ2 in the range [−xmax , xmax ], and hence the magnitude of the
resulting wave function within this range larger than the true wave function.

It should be pointed out that even if the boundary condition used at long distances is not completely
correct, the induced errors will typically only affect the wave function close to ±xmax , as long as
xmax is sufficiently large. Fig. 3 shows an example of this, for the same potential as the one
considered in Fig. 2.

The program with which the above examples were studied is available on the course web site in the
file ’schrod1d.f90’.

6
0.7

0.6

0.5

ψ(x)
0.4

0.3

0.2

0.1

0
-4 -2 0 2 4
x

Figure 3: Wave function for the potential V (x) = −e−|x| integratedpbetween x = −5 and 5,
with the asymptotically correct boundary condition Ψ(x) ∼ exp [−|x| 2(V (±∞) − E)] (dashed
curve) applied at −xmax and −xmax + ∆x , and an incorrect boundary condition Ψ(−xmax ) = 0,
Ψ(−xmax + ∆x ) = 1 (solid curve).

3 Variational methods

In order to numerically solve a two- or three-dimensional Schrödinger equation for a non-separable


potential, one can in principle use some generally applicable grid-based technique for boundary-
value partial differential equations, such as the finite-element method. However, the large number
of grid points needed often makes such approaches too time-consuming in practice (but they are
used in some applications). Approximate but systematically controllable variational methods are
therefore predominant in large-scale calculations in atomic, molecular, and solid-state physics.

In general a variational calculation amounts to assuming a form Ψ{pi } (~x) of the wave function,
with a number of adjustable parameters pi , and finding the parameters that minimize the energy
expectation value (the energy functional)

hΨ{pi } |H|Ψ{pi } i
E[Ψ{pi } ] = . (25)
hΨ{pi } |Ψ{pi } i

The minimation is achieved by finding parameters such that the variation of the the energy func-
tional, i.e., the first-order change in the energy due to infinitesimal changes in any of the parameters
pi , vanishes, i.e., dE[Ψ{pi } ]/dpi = 0 for all pi . Since the states Ψ{pi } span only a subspace of the
full Hilbert space, energies calculated this way are always higher than the true eigenvalues.

In general, if the wave function Ψ{pi } is a nonlinear function of the parameters, the variational
calculation amounts to a very complex optimization problem. On the other hand, if Ψ{pi } is linear
in all the parameters, i.e., it is a linear combination of conveniently chosen basis states (which can

7
be specifically adapted to the potential under study),
N
X
Ψ{pi } (~x) = pi φi (~x), (26)
i=1

the minimization procedure is straight-forward, amounting to solving the Schrödinger equation in


matrix form in a subspace of the full Hilbert space. As the size of the basis is increased, or the basis
states are improved, the true energies are approached from above. Here we will discuss and show
examples of variational calculations with orthogonal as well as non-orthogonal basis vectors. We
will first discuss the general form of the Schrödinger equation written as a matrix diagonalization
problem.

3.1 The Schrödinger equation in matrix form

The Schrödinger equation (1) for the stationary wave functions can be cast in a matrix form if a
discrete basis is used instead of the continuous real-space position basis spanned by the states |~xi.
To see this, we begin by recalling some quantum mechanics formalism.

A state |Ψi is related to its real-space wave function Ψ(~x) through


Z
|Ψi = dxd Ψ(~x)|~xi, (27)

where |~xi is a basis vector in the position basis (i.e., describing a particle localized at the point ~x).
Using the fact that h~x|~y i = δ(~x − ~y ), the wave function is formally obtained from the overlap with
the position states;
Z Z
h~x|Ψi = dy Ψ(~y )h~x|~y i = dy d Ψ(~y )δ(~x − ~y i = Ψ(~x).
d
(28)

For a complete discrete set of orthonormal basis states {|ki}, any state |Ψi can be expanded as
X
|Ψi = Ck |ki, (29)
k

where normalization of |Ψi implies that


X
|Ck |2 = 1. (30)
k

The real-space wave function corresponding to the state |ki is denoted φk (~x), i.e.,
Z
|ki = dxd φk (~x)|~xi. (31)

Because of orthonormality hp|ki = δpk , and hence in Eq. (29) the individual expansion coefficients
Ck = hk|Ψi. In terms of the wave functions, the overlaps (scalar products) are given by
Z Z Z
hk|Ψi = dxd dy d φ∗k (~x)Ψ(~y )h~x|~y i = dxd φ∗k (~x)Ψ(~x). (32)

8
The most familiar example of a discrete basis is the the momentum basis defined in a finite box
with periodic boundary conditions. In that case the basis functions are
1
φ~k (~x) = √ exp(−i~k · ~x). (33)
V
and the expansion coefficients C~k are thus given by the Fourier transform of the wave function
Z
1 ~
C~k = √ dxd e−ik·~x Ψ(~x), (34)
V
where V = Ld is the volume of the box. The allowed wave vectors satisfying the periodic boundary
conditions are, in three dimensions,
 
~k = (kx , ky , kz ) = nx 2π , ny 2π , nz 2π , (35)
L L L
where nx , ny , nz are integers.

To construct the Schrödinger equation

H|Ψi = E|Ψi, (36)

in any orthonormal basis {|ki} we simply use the expansion (29), giving
X X
Ck H|ki = E Ck |ki, (37)
k k

where the problem now is to find sets of coefficients Ck (the wave function in the k basis) that
satisfy the equation along with corresponding eigen energies. We can write
X
H|ki = Hpk |pi, Hpk = hp|H|ki, (38)
p

and hence XX X
Ck Hpk |pi = E Ck |ki. (39)
p k k

Since the basis vectors are orthogonal, the terms corresponding to each state have to be satisfied
individually, i.e., X
Ck Hpk = ECp , (40)
k
for all p. All these equations can be written collectively as a matrix equation;
    
H11 H12 · · · C1 C1
 H21 H22   C2   C2
=E (41)

  
.. .. .. ..
. . . .

This is the Schrödinger equation in the k-basis, written more compactly as

HC = EC. (42)

Solving it corresponds to diagonalizing the Hamiltonian matrix H.

9
3.2 Variational calculation with orthogonal basis states

We now consider a truncated orthonormal basis, and so the wave function resulting from a linear
variational calculation in this basis belongs to the subset of wave functions that can be written as
linear combinations of a finite number N of orhogonal normalized basis states |ki;
N
X
|Ψi = Ck |ki, hk|pi = δkp . (43)
k=1

It appears intuitively clear that the variational energy eigenstates in this case should be simply
obtained by solving the matrix Schrrödinger equation (41) in the N -dimensional Hilbert space, i.e,
    
H11 H12 · · · H1N C1 C1
 H21 H22 · · · H2N   C2   C2 
= E  ..  . (44)
    
 .. . . .
.   .
. 
 . . .  .   . 
HN 1 HN 2 · · · HN N CN CN

This is indeed the case, but since we will later consider non-orthonormal basis states, for which the
variational calculation is slightly different, we will discuss the formal proof, which can be modified
to find the correct way to proceed also for non-orthonormal states. The energy can be written as

P
hΨ|H|Ψi kp Ck Cp Hkp
E= = P ∗ . (45)
hΨ|Ψi k Ck Ck

We want to find expansion coefficients such that the leading-order variation of the energy under
small changes in the expansion coefficients vanishes. Consider a change δq in one of the coefficients
Cq , which also implies a change δq∗ in its complex conjugate. Neglecting the terms quadratic in δq ,
the energy is
∗ ∗ ∗
P P
kp Ck Cp Hpk + k (Ck δq Hqk + δq Ck Hkq )
E(δq ) = P ∗ ∗ ∗
, (46)
k Ck Ck + Cq δq + δq Cq

which to leading order can be written as

(Ck δq∗ Hqk + δq Ck∗ Hkq ) Cq δq∗ + δq Cq∗


 P  
E(δq ) = E + k P ∗ 1 − P ∗ . (47)
k Ck Ck k Ck Ck

The leading-order energy shift is hence

(Ck δq∗ Hqk + δq Ck∗ Hkq ) Cq δq∗ + δq Cq∗


P
E(δq ) − E = k P ∗ − E P ∗ , (48)
k Ck Ck k Ck Ck

and for this to vanish we must have


X
(δq∗ Ck Hqk + δq Ck∗ Hkq ) = E(Cq δq∗ + δq Cq∗ ). (49)
k

Since Hkq = Hqk∗ this condition can be reduced exactly to Eq. (40), and we have thus shown that

the condition for energy minimization is that the matrix Schrödinger equation (44) is satisfied.

10
3.3 Matrix diagonalization

In principle, the eigenvalues λn , n = 1, . . . , N , of an N × N matrix A can be obtained by solving


the secular equation,
det[A − λI] = 0, (50)
where I is the unit matrix. The eigenvector vn corresponding to an eigenvalue λn can subsequently
be obtained by solving the matrix equation (set of linear coupled equations)
Avn = λn vn . (51)
However, since the secular equation is very complex for a large matrix, this method is not used
in practice. Most matrix diagonalization methods are based on an iterative search for a unitary
transformation D for which
D−1 AD = E, (52)
where E is the diagonal eigenvalue matrix and the inverse D−1 of the unitary matrix D is the
transpose of its complex conjugate matrix;
D−1 = (D∗ )T = D† , (53)
where D† is a commonly used alternative notation. The columns of the transformation matrix
contain the eigenvectors of A. This can be seen by multiplying Eq. (52) with D from the left,
giving
AD = DE. (54)
Since E is diagonal, the nth column of D on the right side is multiplied by the nth eigenvalue (i.e.,
the matrix element Enn ). On the left multiplication by A, the nth column of D gives the nth
column of AD, i.e.,
ADn = Enn Dn , (55)
and thus vn = Dn .

The number of operations needed to diagonalize an N × N matrix generally scales as N 3 , which,


along with memory requirements for storing the matrix, limits the size of matrices that can be
diagonalized in practices. Currently, N of the order of 1000 − 2000 can be handled without too
much effort on a desktop computer.

Many linear algebra books discuss matrix diagonalization in detail (Numerical Recipes does as
well), and we shall not go into this subject of numerical analysis here. In practice, it is advisable to
use “canned” subroutines for diagonalization. A useful on-line resource is gams.nist.gov, which
contains a large number of diagonalization routines for different types of matrices (general real
or complex, symmetric, hermitean, sparse, etc.). On the course web site, some useful Fortran
77 routines from the LAPACK library are available, along with simplified Fortran 90 interface
subroutines.

3.4 One-dimensional example

Although the utility of variational methods is primarily in higher-dimensional problems, we will


here consider an illustrative example in one dimension. The generalizations to two- and three-
dimensional problems are obvious.

11
Figure 4: Square-well potential with an internal barrier of height Vc

For the square well potential with infinite barriers at x = ±1, the eigenfunctions are (with h̄ =
m = 1) 
cos (kπx/2), for odd k,
φk (x) = (56)
sin (kπx/2), even odd k,
and the corresponding energy eigenvalues are
1
Kk = k 2 π 2 , (57)
8
where we use K to indicate that this energy is purely kinetic. Any wave function Ψ(x) in the range
[−1, 1] with boundary conditions Ψ(±1) = 0 can be expanded using these states as basis states.
A variational calculation can hence be carried out in this basis, truncated at k = N , for any form
of the potential between x = −1 and 1. Here we consider a square potential barrier of height Vc
between x = −a and a, as illustrated in Fig. 4. The Hamiltonian matrix elements are
Z a
1 d2
Hpk = hp|(− + V )|ki = Kk + V c dxφp (x)φk (x). (58)
2 dx2 −a

In this case the potential-energy matrix elements can be easily calculated analytically, whereas in
general they would have to be evaluated using numerical integration.

A program carrying out this variational calculation is available on the course web site, in the file
’sqvar.f90’ (which should be compiled with the supplied LAPACK diagonalization routine DSYEV
in the file ’dsyev.f’). In order for this program to be easily adapted also for other types of potentials
inside the square well, the integrals in (58) are calculated numerically, using a Romberg algorithm.

We here discuss results for Vc = 10, for which the ground state energy calculated using Numerov’s
integration scheme is E0 = 7.76056. Using the variational method with increasing number of basis
states gives E0 = 9.41680 (N = 1), 7.798175 (N = 3), 7.79671 (N = 5), 7.78016 (N = 7),...,7.76062
(N = 50). For this symmetric potential, only odd-numbered states contribute to the ground state.
Some of the resulting ground state wave functions are shown along with the numerically exact
solution in Fig. 5. Note that for N = 1 the wave function is the same as for the pure square-
well potential, and the energy corresponds to that of first-order perturbation theory. Clearly the
variational calculation performs very well in this case, with already N = 9 giving the ground state
energy to one part in 1000 and a wave function almost indistinguishable from the exact solution.
If we make the barrier Vc larger, the convergence of the variational calculation becomes worse, as
more states are needed to form a wave function which is very small in the range [−a, a].

12
1

0.8

ψ(x) 0.6

0.4 N=1 (same as unperturbed)


N=3
N=5
0.2 N=7
N=9
Exact
0
-1 -0.5 0 0.5 1
x

Figure 5: Variational wave functions for the square-well potential with an internal barrier of height
Vc = 10 for different basis sizes N .

3.5 Variational calculations with non-orthogonal states

If we use a set of non-orthogonal wave functions in a variational calculation, it is not immidiately


clear how we should proceed. We therefore have to generalize the calculation of the leading-order
energy shift carried out in Sec. 3.2, in order to see what conditions arise when this shift is set to
zero. The only difference is that the scalar product of orthonormal states, hp|ki = δpk , has to be
replaced by a non-diagonal overlap matrix;
Z
hp|ki = dxd φ∗p (~x)φk (~x) ≡ Wpk . (59)

The energy functional is then



P
hΨ|H|Ψi kp Ck Cp Hkp
E= =P ∗
. (60)
hΨ|Ψi kp Ck Cp Wkp

Proceding as in Eq. (46), by making a small change δq in the coefficient Cq , the energy to leading
order in δq is found to be
! !
∗ ∗ ∗ ∗
P P
k (Ck δq Hqk + δq Ck Hkq ) k (Ck δq Wqk + δq Ck Wkq )
E(δq ) = E + P ∗
1− P ∗
. (61)
kp Ck Cp Wkp kp Ck Cp Wkp

From this we get the shift


∗ + δq Ck∗ Hkq ) ∗ + δq Ck∗ Wkq )
P P
k (Ck δq Hqk k (Ck δq Wqk
E(δq ) − E = P ∗
−E P ∗
, (62)
kp Ck Cp Wkp kp Ck Cp Wkp

and for this to vanish we must have


X X
(δq∗ Ck Hqk + δq Ck∗ Hkq ) = E (δq∗ Ck Wqk + δq Ck∗ Wkq ). (63)
k k

13
As before, the terms containing δq and δq∗ correspond to exactly the same condition on the coeffi-
cients Ck , giving, for each q = 1, . . . , N ,
X X
Ck Hqk = E Ck Wqk , (64)
k k

which is equivalent to the matrix equation


     
H11 H12 · · · H1N C1 W11 W12 · · · W1N C1
 H21 H22 · · · H2N   C2 
  
 W21 W22 · · ·
 W2N  C2 
..   ..  = E  .. , (65)
  
 .. .. .. ..  ..
 . . .  .   . . .  . 
HN 1 HN 2 · · · HN N CN WN 1 WN 2 · · · WN N CN

or, in more compact notation,


HC = EWC. (66)
This is called a generalized eigenvalue problem. It can be solved using matrix diagonalization if
the overlap matrix W can first be transformed into a unit matrix;

B̄−1 WB̄ = I. (67)

This can be done by first diagonalizing W. We denote by B the unitary transformation that
diagonalizes W, leading to an eigenvalue matrix Wd ;

B−1 WB = Wd . (68)

If all the eigenvalues are positive, a transformation to the unit operator can now be easily con-
structed using the inverse square root of the eigenvalue matrix:
−1/2
Wd −1/2 B−1 WBWd = I. (69)

The desired tranformation matrix is thus

B̄ = BWd −1/2 . (70)

It can be proven that in fact the overlap matrix has only positive eigenvalues, and this procedure
can hence be carried out. We can then rewrite the generalized eigenvalue problem (66) as follows;
−1 −1
B̄−1 HB̄B̄ C = E B̄−1 WB̄B̄ C. (71)

Using the definitions,

HB = B̄−1 HB̄, (72)


−1
CB = B̄ C, (73)

we have thus constructed a standard eigenvalue problem;

HB CB = ECB . (74)

When this has been solved we can obtain the eigenvectors of the original equation (66) from Eq. (73);
C = B̄−1 CB .

14
Figure 6: A basis function φi (~x) localized inside a square element of a two-dimensional space. The
height of the normalized function is ∆−1/2 .

4 The Schrödinger equation in discretized space

As an example of a grid-based method for solving the Schrödinger equation in any number of
dimensions, we will here develop the simplest way to discretize the equation in real space. The
method can technically be considered a linear variational method, in a space of basis functions
describing particles localized in a finite region of space. Typically the number N of such basis
functions must be very large in d = 2 and 3, and hence it may not be possible in practice to
completely diagonalize the resulting Hamiltonian matrix. We will therefore introduce the so-called
Lanczos diagonalization method, with which one can easily obtain the ground state and a number
of excited states also for very large basis sets (millions, or even tens of millions of states).

4.1 Discrete real-space Hamiltonian

For a d-dimensional space, we subdivide the volume in which the Schrödinger equation is to be
solved into cubic elements of linear size ∆, i.e., with volume ∆d . We can label the elements by
d-component vectorz corresponding to their actual coordinates, or just use single integers assigned
to the elements in some suitable manner. To simplify the notation, we will here use integers
j = 0, 1, . . . for the labels and denote the coordinate of the center of the jth element ~rj . The basis
states are denoted |ji and the corresponding wave functions φj (~x).

The basis functions are taken to be constant within their respective elements i and zero elsewhere.
Normalization then requires that the constant value is ∆−d/2 , i.e.,
 −d/2
∆ , if − ∆ x − ~rj )α < ∆
2 ≤ (~ 2 , α = 1, ..., d,
φj (~x) = (75)
0, else,

where ()α denotes a component of the vector inside the parentheses. Such a basis function in two
dimensions is illustrated in Fig. 6. Clearly different states do not overlap, hj|li = δjl , and the basis
is orthonormal. One might worry that, strictly speaking, the basis functions are not valid wave
functions, since they are discontinuous. However, what matters is that we obtain a scheme that
reproduces the correct physics as the discretization ∆ → 0, which we will prove is indeed the case.

In a cubic box with volyme L3 , the size of the basis is N = (L/∆)d ; we assume that L is a multiple
of ∆. We now proceed to calculate the matrix elements of the Hamiltonian, H = K + V , in this

15
discrete basis. The potential energy V is diagonal;
Z
Vjl = hj|V |li = δjl dxd |φj (~x)|2 V (~x), (76)

which we can also approximate by


Vjl ≈ δjl V (~rj ). (77)
Looking at the matrix element of the kinetic energy (with h̄ = m = 1),
Z
1
Kjl = hj|K|li = dxd φj (~x)∇2 φl (~x), (78)
2
we are directly faced with the fact that the basis functions are not differentiable. How can we
proceed then? We will use the central difference operator definition of the second derivative, e.g.,
in one dimension we will replace the second derivative by
1 2 1
2
δ φj (x) = 2 [φj (x − ∆) − 2φj (x) + φj (x + ∆)]. (79)
∆ ∆
This approach can clearly also be criticized based on the fact that the function φj (x) is not slowly
varying, but, again, we will show that in fact correct results are obtained as ∆ → 0. Acting
on φl (x), the central difference operator above gives 12 ∆−5/2 for x ∈ [rl − 3∆/2, rl − ∆/2] and
x ∈ [rl + ∆/2, rl + 3∆/2] and ∆−5/2 for x ∈ [rl − ∆/2, rl + ∆/2], as illustrated in Fig. 7. In the
integral in Eq. (78), φj gives a factor ∆−1/2 and the integral over the individual x ranges above
gives a factor ∆. Thus

−∆−2 /2, for j = l ± 1,


Z 
1 d 1 2
Kjl = dx φj (~x) 2 δ φl (~x) = . (80)
2 ∆ ∆−2 , for j = l.

The action of the kinetic energy on a basis state hence leads to


 
1 1 1
K|ji = − 2 |j − 1i − |ji + |j + 1i , (81)
∆ 2 2
and the non-zero matrix elements of the full Hamiltonian are, using Eq. (77),
1
Hj,j = V (rj ) + , (82)
∆2
1 1
Hj±1,j = − . (83)
2 ∆2
This result generalizes to two and thre dimensions. Denoting by δ[j] an element neighboring j, of
which there are four in 2D and six in 3D, the action of the Hamiltonian on a basis state results in
 
d 1 1 X
H|ji = V (rj ) + 2 |ji − |δ[j]i, (84)
∆ 2 ∆2
δ[j]

and hence the matrix elements are


d
Hj,j = V (~rj ) + , (85)
∆2
1 1
Hδ[j],j = − . (86)
2 ∆2

16
Figure 7: A one-dimensional basis function (left) and its discrete second derivative (right).

To prove that the discretized Hamiltonian reproduces the correct physics as ∆ → 0, we consider a
free particle, i.e., V = 0 (only the kinetic energy was subjecy to suspect manipulations above, and
hence we only need to investigate it). We will first diagonalize the Hamiltonian in one dimension.
In continuum space, for a finite periodic system of length L, the energy eigen functions are φk (x) =
exp (−ikx), with k = n2π/L, n = 0, 1. . . .. In the discretized box with N = L/∆ elements, we will
show that the eigenstates are
N −1
1 X −ikrj
|ki = √ e |ji, k = n2π/L, 0, 1, . . . , N − 1, (87)
N j=0

where k only takes N different values because for the discrete coordinates rj = j∆ = jL/N we have
exp [−i(n + N )2(π/L)rj ] = exp [−in2(π/L)rj ], i.e., |k + N 2π/Li = |ki. Acting with the kinetic
energy operator on the proposed state (87) gives, using Eq. (81),
N  
1 1 X −ikrj 1 1
K|ki = − 2 √ e |j − 1i − |ji + |j + 1i . (88)
∆ N 2 2
j=0

By shifting the indexes in the j ± 1 terms by ±1 and using the periodic boundary conditions,
|j = N + 1i = |j = 1i and |j = −1i = |j = N i, we can rewrite this as
N  
1 1 X −ikrj 1 ik∆ −ik∆ 1
K|ki = − 2 √ e (e +e ) − 1 |ji = − 2 [cos (k∆) − 1]|ki, (89)
∆ N 2 ∆
j=0

and hence the energy eigenvalues are


1
Ek = [1 − cos (k∆)]. (90)
∆2
For small k∆, we can Taylor expand the cosine;
1 1
Ek = k 2 − ∆2 k 4 + . . . , (91)
2 24
which agrees with the energy of the free particle in the continuum, Ek = k 2 /2, to leading order.
This proves that the discretized scheme is valid. Note that the correction to the energy is negative,
and hence although the way the discrete basis was introduced corresponds to a variational method,
the errors introduced in discretizing the kinetic energy operator has resulted in a correction with

17
a sign different from purely variational schemes. In three dimensions the above energy calculation
easily generalizes to
1
Ek = 2 [3 − cos (kx ∆) − cos (ky ∆) − cos (kz ∆)], (92)

which again agrees with the continuum result up to a negative fourth-order correction.

It can here be noted that in solid-state physics a discrete space arises naturally in a crystal structure.
The coordinates ~rj above then reprecent the locations of the atoms on a lattice (which of course
can be any type of crystal lattice). In weakly overlapping valence-electron orbitals, the electrns
are almost localized at the individual atoms. Orthogonal states, so-called Wannier states, can be
constructed and are also highly localized if the original atomic orbitals are weakly overlapping.
With these basis states the kinetic energy takes exactly the form derived above, with the factor
1/∆2 replaced by a hopping matrix element tij between orbitals i and j, which depends on the
details of the Wannier orbitals. In the tight binding approximation, only short-range hopping
matrix elements are taken into account (not necessarily only between nearest neighbors, however).
This is often a good approximation for materials with partially filled d and f orbitals, in particular.
The tight-binding approach forms the basis of many calculations that include also electron-electron
interactions.

4.2 The Lanczos diagonalization method

Although the size of the N × N Hamiltonian matrix in discretized space is very large in two and
three dimensions, the number of non-zero matrix elements is much smaller; on the order of the
number of states N . There are sveral efficient methods available for treating such sparse matrices.
Here we shall discuss the perhaps most well known of them—the Lanczos method. This approach
gives systematically controllable approximations for low and high eigenvalues eigenvalues (of which
we are typically only interested in the low ones) and the corresponding eigenstates. The Lanczos
method is based on a particular transformation which brings the Hamiltonian into a tridiagonal
form (i.e., with non-zero matrix elements only on the diagonal and the two “subdiagonals” on either
side of the diagonal).

The basic idea of the Lanczos method, or, more generally, Krylov space methods, is the following:
Consider an arbitrary state |Ψi and its expansion in terms the eigenstates Ψk i of the Hamiltonian.
We operate with a power of the Hamiltonian on the state;
X
H m |Ψi = Ck Ekm |Ψk i. (93)
k

If the power m is large, the state k with the largest absolut value |Ek | of the energy will dominate
the sum, provided that the corresponding expansion coefficient Ck 6= 0. Hence, the process of acting
many times with the Hamiltonian on a state will project out either the state with the smallest or
the largest eigenvalue. If we want to make sure that the ground state is obtained (for m → ∞, or
an approximation to the ground state for finite m), we can instead act with (H − σ)m , where σ is
a positive number large enough to make |E0 − σ| larger than |Emax − σ|, where Emax is the highest
eigenvalue of H.

The state (H − σ)m |Ψi is a certain linear combination of states H m |Ψi m = 0, 1., . . . , n. A more
efficient way to construct a state approaching the ground state as m → ∞ is to diagonalize the

18
Hamiltonian in a basis spanned by all these states H m |Ψi constructed one by one by successive
operations with H. In this space a better linear combination for minimizing the energy typically
exists, and, as we showed in Sec. 3.2, the way to find it is to diagonalize H in the finite basis. In
addition to the ground state, this approach also can give low-lying excited states.

The subspace of states obtained by acting multiple times with the Hamiltobian on a state is called
the Krylov space. We are here discussing Hamiltonians in quantum mechanics, but Krylov space
methods of course apply to eigenvalue problems more generally as well, and are very widely used
in many areas of science and engineering.

The Lanczos method amounts to constructing orthogonal basis states that are linear combinations
of the Krylov space states in such a way that the Hamiltonian written in this basis is tridiagonal.
A basis {|fn i} is first constructed that is orhogonal but not normalized, and subsequently from
these states an orthonormal set {|φn i} is obtained. The basis construction starts from an arbitrary
normalized state |f0 i, of which is required only that it is not orthogonal to the ground state of H
(if the goal of the calculation is to find the ground state). The next state is given by

|f1 i = H|f0 i − a0 |f0 i, (94)

where the constant a0 is to be chosen such that |f1 i is orthogonal to |f0 i. The overlap between the
two states is
hf1 |f0 i = hf0 |H|f0 i − a0 hf0 |f0 i = H00 − a0 N0 , (95)
where N0 = 1 is the normalization of |f0 i. Hence, for the overlap to vanish we must have

a0 = H00 /N0 . (96)

The next state is written as


|f2 i = H|f1 i − a1 |f1 i − b0 |f0 i, (97)
where a1 and b0 are to be chosen in such a way that |f2 i is orthogonal to both the previous states.
Calculating the overlaps, using the expression for H|f0 i and H|f1 i obtained from Eqs. (94) and
(97),

hf2 |f1 i = hf1 |H|f1 i − a1 hf1 |f1 i − b0 hf0 |f1 i


= H11 − a1 N1 , (98)
hf2 |f0 i = hf1 |H|f0 i − a1 hf1 |f0 i − b0 hf0 |f0 i
= hf1 |f1 i + a0 hf1 |f0 i − b0 N0
= N1 − b0 N0 , (99)

shows that the coefficients are given by

a1 = H11 /N1 , (100)


b0 = N1 /N0 . (101)

For general n, Eq. (97) generalizes to

|fn+1 i = H|fn i − an |fn i − bn−1 |fn−1 i, (102)

19
and the coefficients making this state orthogonal to |fn i and |fn−1 i are

an = Hnn /Nn , (103)


bn−1 = Nn /Nn−1 . (104)

It remains to show that with these coefficients the state |fn+1 i is orthogonal also to all states |fk i
with k < n − 1. We begin with n + 1 = 3, for which the overlap with f0 i is

hf3 |f0 i = hf2 |H|f0 i − a2 hf2 |f0 i − b1 hf1 |f0 i = hf2 |f1 i + a0 hf2 |f0 i = 0. (105)

For successively higher n + 1, we can now use the fact that all previously generated states are
orthogonal to obtain, using also H|fn i given by Eq. (102),

hfn+1 |fn−k i = hfn |H|fn−k i − an hfn |fn−k i − bn−1 hfn−1 |fn−k i


= hfn |fn−k+1 i + an−k hfn |fn−k i + bn−k−1 hfn |fn−k−1 i (106)
= 0.

This basis is thus indeed orhogonal.

To write the Hamiltonian in the basis {|fn i} we use the expression for the Hamiltonian acting on
one of the basis states, obtained from Eq. (102);

H|fn i = |fn+1 i + an |fn i + bn−1 |fn−1 i, (107)

and thus the non-zero matrix elements are

hfn−1 |H|fn i = bn−1 Nn−1 = Nn ,


hfn |H|fn i = an Nn , (108)
hfn+1 |H|fn i = Nn+1 .

The normalized basis states are


1
|φn i = √ |fn i. (109)
Nn
Recalling that bn = Nn+1 /Nn , the non-zero matrix elements in the orthonormal basis are
p
hφn−1 |H|φn i = bn−1 ,
hφn |H|φn i = an , (110)
p
hφn+1 |H|φn i = bn .

This is a tri-diagonal matrix, which can be diagonalized using special methods that are faster than
a generic exact diagonalization. The main advantage of a tri-diagonal matrix is not, however, that
it can be diagonalized more easily, but that it can be constructed quickly. The Lanczos method is
advantageous in practice only if the ground state can be reproduced using a basis size M that is
significantly smaller than the size of the full Hilbert space. This is often the case, and one can then
obtain the ground state (and some times excited states) in cases where a complete diagonalization
of the Hamiltonian in the original basis would be impossible.

One thing to be noted is that the Lanczos method cannot produce several degenerate states; out
of a degenerate set of states, only a particular linear combination of them will be obtained (which

20
Figure 8: Example of labeling of the volume elements of an L × L lattice, here with L = 4.

depends on the initial state f0 i). To see the reason for this, we again look at the expansion (93)
of a state H m |Ψi, in which we assume that there are two degenerate states |Ψi i and |Ψj i that we
have isolated from the rest of the sum;
X
H m |Ψi = Ck Ekm |Ψk i + Ejm (Ci |Ψi i + Cj |Ψj i). (111)
k=6=i,j

Here it is evident that for any m, the expansion will contain the same linear combination of the
states |Ψj i and |Ψj i. Hence, in a subspace spanned by the set of states H n |Ψi, n = 0, . . . , M − 1,
there is no freedom in obtaining different linear combinations of the two degenerate states. This of
course generalizes to degenerate multiplets with more than two states.

4.3 Programming the Lanczos algorithm

The most critical aspect of generating the Lanczos basis is the operation with the Hamiltonian on a
basis state |fn i, which is done component-wise according to (84), to obtain the following state |fn+1 i
as prescribed in Eq. (102). For the kinetic part, we need to be able to rapidly find all the neighbors
δ[j] of a given volume element j. The neighbors can be stored in a pre-generated table, but for
simple geometries it is also very easy to find the neighbors on the fly (this is often faster in practice,
since less memory access is required). With the labeling scheme j = x + (y − 1)Lx , illustrated for
L × L elements with L = 4 in Fig. 8, the neighbors of internal elements can be obtained by adding
or subtracing 1 or L for neigbors in the x and y direction, respectively. Elements on the boundaries
need special, but simple, considerations which depend on the type of boundary conditions used
(open or periodic).

Considering a two-dimensional case, a rectangular open-boundary system with Lx × Ly elements,


this is the main part of a Fortran 90 subroutine taking a state stored in a vector f1(lx*ly) as
input and giving the state when the Hamiltonian has acted on it in the vector f2(lx*ly):

subroutine hoperation(lx,ly,f1,f2)
f2=potential*f1
do j=1,lx*ly
x=1+mod(j-1,lx)
y=1+(j-1)/lx
if (x /= 1) f2(j)=f2(j)-thop*f1(j-1)
if (x /= lx) f2(j)=f2(j)-thop*f1(j+1)
if (y /= 1) f2(j)=f2(j)-thop*f1(j-lx)
if (y /= ly) f2(j)=f2(j)-thop*f1(j+lx)
end do

21
Here the potential energy is stored in the vector potential(lx*ly) and thop is the kinetic prefactor
1/2∆2 . For the open-boundary system, the hopping processes corresponding to going outside the
system boundaries are suppressed; this is equivalent to having infinitely repulsive walls.

Using the subroutine hoperation, the construction of the Hamiltonian, i.e., the coefficients ai and
bi , in a Lanczos basis of size M can be done with the following code:

f0=psi0
nn(0)=1.d0
call hoperation(lx,ly,f0,f1)
aa(0)=dot_product(f0,f1)
f1=f1-aa(0)*f0
nn(1)=dot_product(f1,f1)
do i=2,m
call hoperation(lx,ly,f1,f2)
aa(iter-1)=dot_product(f1,f2)/nn(iter-1)
bb(iter-2)=nn(iter-1)/nn(iter-2)
f2=f2-aa(iter-1)*f1-bb(iter-2)*f0
nn(iter)=dot_product(f2,f2)
f0=f1; f1=f2
end do

Here an initial state has been prepared in the vector psi0, and the coefficients ai ,bi and the
normalizations Ni are stored in vectors aa(0:m), bb(0:m), and nn(0:m), respectively. Scalar
products are calculated using the Fortran 90 intrinsic function dot product.

The diagonalization of the tridiagonal matrix, the diagonal elements of which are in the vector aa
and the two subdiagonals of which are given by sqrt(bb), can be done using special techniques
for tridiagonal matrices. The LAPACK Fortran 77 tridiagonal diagonalization routine DSTEV is
available on the course web-site, along with a simplified Fortran 90 interface subroutine. Based
on the transformation matrix obtained as output in such a diagonalization, we can construct the
eigenstates. However, in the procedures above we have not stored all the states |fn i, since this
would typically demand too much memory, and hence we need to reconstruct these states in order
to be able to find the eigenstates. The Lanczos procedure typically gives good results only for a few
low-lying states, and hence one would typically only want to construct one or a few states. If we
have stored the kth column of the transformation matrix, corresponding to the kth eigenstate, in a
vector vec(0:m-1), we can carry out the transformation of the states |fn i to the desired eigenstate
as follows:

f0=psi
psi=vec(0)*psi
call hoperation(lx,ly,f0,f1)
f1=f1-aa(0)*f0
psi=psi+vec(1)*f1/sqrt(nn(1))
do i=2,m-1
call hoperation(lx,ly,f1,f2)
f2=f2-aa(i-1)*f1-bb(i-2)*f0

22
M E0 E1 E2
10 165.47488 1116.18787 3077.75501
20 36.464497 268.910471 744.48445
30 15.339143 155.724962 332.96633
50 9.172055 47.562526 146.64266
100 1.696802 12.229263 27.56645
150 1.262146 10.191426 14.60174
160 1.234164 6.045649 11.09876
170 1.224724 5.160069 11.01756
180 1.222428 4.974962 11.00148
190 1.221635 4.905657 10.99395
200 1.221430 4.885423 10.99108
Exact 1.233701 4.934802 11.10330

Table 1: The three lowest energy eigenvalues for different basis sizes M in Lanczos calculations for
a one-dimensional hard-wall box of length 2, using discretization ∆ = 0.01.

psi=psi+vec(i)*f2/sqrt(nn(i))
f0=f1; f1=f2
end do

Here psi(lx*ly) initially contains the original state that was previously used to start the con-
struction of the Lanczos Hamiltonian. It is now used also to hold the eigen vector.

4.4 Examples

We first consider a one-dimensional example; a particle-in-a-box potential with hard walls at x =


±1. Table 1 shows the three lowest energy eigenvalues for different Lanczos basis sizes M in a
calculation with ∆ = 0.01, i.e., discretization of the system into 200 volume elements. For small
M , the energies are much too large, reflecting the high energy of the initial random state. The
energies come close to the exact values only when M approaches the number of volume elements.
Due to the discretization, we do not obtain the exact energy; in accordance with Eq. (91) the energy
of the discretized system is lower than the exact value. The wave functions corresponding to the
lowest eigenvalue in the calculations with M = 50, 100, and 200 are shown in Fig. 9. At M = 150
the wave function is still far from the exact particle-in-a-box ground state, Ψ0 (x) = cos (πx/2), but
at M = 200 this function is well approximated.

The above example illustrates the fact that the Lanczos method does not work well for solving the
discretized Schrödinger equation in one dimension, since a basis set reduction relative to the full
Hilbert space is not achieved. In one dimension there are in any case more accurate and practical
methods available, e.g., the Numerov differential equation solver discussed in Sec. 2.1.

The reason why the Lanczos method fails for the one-dimensional discretized Schrödinger equation
is that a state H m |ψi is a linear combination of states that differ from |Ψi in at most m real-
space basis expansion coefficients, corresponding to a contiguous segment of m system elements.

23
0.015
M=50
M=100
M=200

0.010

2
|ψ(x)| 0.005

0.000
-1 -0.5 0 0.5 1
x

Figure 9: Wave function squared obtained in Lanczos calculations with different basis sizes M for
a one-dimensional hard-wall potential discretized using 200 elements (∆ = 0.01). The initial state
was the same randomly generated state in all cases.

Figure 10: Basis states that can have non-zero weight in a Lanczos basis after n = 0, 1, 2 steps
(first, second, and third generation of states) when the initial state consists of a single basis vector,
indicated by a black square, in one dimension (left) and two dimensions (right).

Starting from an arbitrary state, we would expect to be able to construct a good approximation
to an eigenstate only if we can mix states that have different weights for basis states all through
the system, which would require m to be equal to the number of discretization elements L/∆, in
accord with what we observed in the example above. In two and three dimensions the method can
be expected to work better, because although H m |ψi still only can mix states that differ by m
expansion coefficients, these coefficients can form paths that span across the whole system if m is
of the order of the linear number of elements L/∆, i.e., the square or cubic root of the total number
of elements, not the total number of elements (L/∆)d .

The above arguments are illustrated in Fig. 10, which shows a 1D and a 2D system in which the
starting state is a single basis vector; |ψi = |ji. The basis vectors that can have non-zero weight
in H n |Ψi after two and three “generations” (n = 1, 2) are shown. Clearly, an eigenstate of the
system would in general have non-zero weight for all basis vectors, and this would require n ∼ L/∆
in both cases. We would hence expect convergence with a Lanczos basis of size M ∼ L/∆ in any
number of dimensions, and hence a larger comparative advantage of the Lanczos method in higher
dimensions.

24
20
∆=0.02
∆=0.01
15

E0
10

0
0 50 100 150 200 250 300
M

Figure 11: Ground state energy as a function of the Lanczos basis size for a two-dimensional
hard-wall box of size 2 × 2. Results for two different discretizations ∆ are shown.

Figure 12: Intensity plots of squared wave functions obtained in Lanczos calculations with different
basis sizes M for a two-dimensional hard-wall potential discretized using 200 elements (∆ = 0.01).
The M = 1 graph shows the randomly generated state that was used as the initial state in all cases.
Black and white correspond to |Ψ|2 = 0, and the highest |Ψ|2 , respectively.

25
Fig. 11 shows the convergence of the ground state energy in a two-dimensional calculation, with
two different discretizations ∆. In accord with the above discussion, the energy converges when
M ∼ L/∆ in both cases. The convergence of the ground state wave function is shown in Fig. 12.

4.5 Numerical instabilities in the Lanczos method

If the Lanczos basis M is large, the procedure typically suffers from numerical instabilities. Round-
off errors accumulated in the construction of the orthonormal basis states introduce some degree of
non-orthogonality, which eventually leads to a complete break-down of the method. Such instabil-
ities are often signaled by the appearance of several identical eigenvalues (recall that the Lanczos
scheme should never produce degenerate states). Using double-precision arithmetic, these instabil-
ities typically enter severely when M ≈ 500. Stabilization methods ensuring that the basis remains
orthogonal have been developed and enable much larger basis sizes, but we will not discuss these
more advanced Lanczos methods here.

One can accelarate the convergence of a Lanczos calculation, thus reducing the M required and
avoiding non-orthogonality problems, by starting from a state which is already close to the ground
state. Such a state could be obtained using, e.g., perturbation theory, or be constructed from a
Lanczos calculation with a larger ∆. Note, however, that if the initial state is a good approximation
to the ground state, it may have very small overlaps with the first few excited states, and hence
only the ground state is likely to be well reproduced in such a calculation.

One can target an excited states specifically by starting from a state that is orthogonal to the
ground state (constructed in a prior calculation). All the Lanczos basis vectors will then have zero
overlap with the ground state, and the lowest state produced will be the state with the lowest
energy that does overlap with the initial state. One can in principle reproduce a large number
of excited states this way, by carrying out a series of calculations in which each initial state is
chosen othogonal to all the lowest states states obtained in the prior steps. In this case round-off
errors can again cause problems, as they will induce some overlaps of the basis functions with the
previous states. This problem can also be solved by supplementing the basis construction with a
re-orthogonalization procedure.

26

You might also like