382 Two-beam theory in defect-free crystals
dz can be computed; for intermediate values we must either use a different value
of dz and recompute the matrix product, or interpolate intensities for thicknesses
bracketing the desired thickness.
The bright field and dark field images for the standard parameter space in Figs 6.3
and 6.4 were computed using the
TBSM.f90 program. This program implements
both the scattering matrix algorithm and the analytical solutions, and compares the
execution time of the algorithms for a BF–DF image pair of 512 × 512 pixels. The
scattering matrix approach is about five times faster than the direct evaluation of
the analytical solutions.
6.5.3 Numerical (two-beam) Bloch wave calculations
Numerical implementation of a general complex eigenvalue problem is a non-trivial
task, and is best left to mathematicians and experts in linear algebra. For all Bloch
wave computations in this book, we will make use of version 3.0 of the public
domain package
LAPACK, which is available from www.netlib.org for a large
number of computer platforms.
LAPACK is a library of Fortran-77 routines for solv-
ing the most commonly occurring problems in numerical linear algebra [ABB
+
99].
LAPACK is also available in Fortran-95, Java, and C++. Pre-compiled libraries for
DEC-ALPHA, Linux (RedHat), IBM RS/6000, Solaris, and Windows NT (Visual
Fortran) are available; alternatively, the package can be installed from scratch us-
ing the extensive installation instructions available from the
www.netlib.org
website.
†
LAPACK replaces the older LINPACK [DBMS79] and EISPACK [GBDM77] li-
braries, and makes extensive use of the
BLAS routines or basic linear algebra
subprograms [DDCHH88]. Documentation for
LAPACK is available on-line, or in
book form [ABB
+
99]. We will assume that the reader has access to the LAPACK
libraries, so that all Fortran source code for Bloch wave computations can be com-
piled and executed.
From a numerical point of view, the Bloch wave formalism requires the solution
of an eigenvalue problem for a complex non-symmetric matrix in the most general
case. Eigenvalues !
( j)
and eigenvectors C
( j)
must be computed, and the eigenvector
matrix C must be inverted to obtain the Bloch wave excitation amplitudes α
( j)
g
for
a given initial condition at the sample entrance surface.
The basic structure of a Bloch wave program is independent of the number of
beams in the calculation. We will, in fact, use only one subroutine for the two-beam
case, the systematic row case and the zone axis case (the latter two will be discussed
in the next chapter). The relevant
LAPACK routine is CGEEV, which computes the
†
The complete LAPACK package consists of about 805 000 lines of Fortran source code.