MuSTEM Manual
MuSTEM Manual
MuSTEM Manual
v5.3
Les Allen, Adrian D’Alfonso and Scott Findlay originally took the initiative to make
this code publicly available, with Adrian D’Alfonso taking on the considerable task of
setting up the GPU code. Hamish Brown and Ben Forbes have subsequently made sub-
stantial refinements and extensions, with Ben Forbes responsible for several efficiency
improvements. The code was developed mainly at the University of Melbourne. 1
We would like to acknowledge the contributions of Mark Oxley and Chris Rossouw to
the theoretical and numerical aspects of collaborative research that underpins µSTEM.
In particular, the code IONIZER, whose primary author was Mark Oxley, has been used
to set up the parametrized atomic scattering factors for ionization used in µSTEM. In
addition, in alphabetical order, Eireann Cosgriff, Torgny Josefsson, Nathan Lugg, Andrew
Martin, Gary Ruben and Chris Witte have all contributed as members of the group led
by Prof. Les Allen at the University of Melbourne.
c A. J. D’Alfonso, H. G. Brown, S. D. Findlay, B. D. Forbes and L. J. Allen
1
The µ is derived from the generic symbol used to denote inelastic scattering coefficients (related
to Fourier coefficients of inelastic scattering potentials) in the papers on which the code is based. In
addition, the “mu” is short for Melbourne University.
1
Contents
1 Introduction 5
1.1 Release notes . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 5
1.1.1 Version 4.4 improvements . . . . . . . . . . . . . . . . . . . . . . . 5
1.1.2 Version 4.5 bug fix . . . . . . . . . . . . . . . . . . . . . . . . . . . 6
1.1.3 Version 4.6 improvements . . . . . . . . . . . . . . . . . . . . . . . 6
1.1.4 Version 5.0 improvements . . . . . . . . . . . . . . . . . . . . . . . 6
1.1.5 Version 5.1 improvements . . . . . . . . . . . . . . . . . . . . . . . 6
1.1.6 Version 5.2 improvements . . . . . . . . . . . . . . . . . . . . . . . 6
1.1.7 Version 5.3 improvements . . . . . . . . . . . . . . . . . . . . . . . 6
1.2 System requirements . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 6
1.2.1 GPU versions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 6
1.2.2 CPU versions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 7
4 Case studies 18
4.1 Plane wave illumination with the absorptive model . . . . . . . . . . . . . 19
4.2 Plane wave illumination with the QEP model . . . . . . . . . . . . . . . . 22
4.3 Convergent beam illumination with the absorptive model . . . . . . . . . . 24
4.3.1 CBED patterns . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 25
4.3.2 PACBED patterns . . . . . . . . . . . . . . . . . . . . . . . . . . . 26
4.3.3 STEM images . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 26
4.3.4 STEM EELS images . . . . . . . . . . . . . . . . . . . . . . . . . . 27
2
4.3.5 STEM EDX images . . . . . . . . . . . . . . . . . . . . . . . . . . . 28
4.4 Convergent beam illumination with the QEP model . . . . . . . . . . . . . 29
References 29
3
Preamble:
Copyright (C) 2017 L. J. Allen, H. G. Brown, A. J. D’Alfonso, S.D. Findlay, B. D.
Forbes
This program is free software: you can redistribute it and/or modify it under the
terms of the GNU General Public License as published by the Free Software Foundation,
either version 3 of the License, or (at your option) any later version.
This program is distributed in the hope that it will be useful, but WITHOUT ANY
WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.
You should have received a copy of the GNU General Public License along with this
program. If not, see http://www.gnu.org/licenses/.
Please forward your comments and suggestions to:
hamish.brown@monash.edu
Note that this is not a support email address and a response will not necessarily be forth-
coming.
4
1 Introduction
This manual describes a transmission electron microscopy (TEM) simulation suite, in par-
ticular for scanning transmission electron microscopy (STEM) images, that was developed
mainly at the University of Melbourne. The computing suite is based on the multislice
method.
Thermal scattering is accounted for with one of two models:
1. The absorptive scattering potential approach [1, 2, 7].
2. The quantum excitation of phonons (QEP) model [6] which provides overall results
numerically equivalent to the frozen phonon (FPh) method [8] but provides differ-
ent physical insights and allows both elastic and inelastic phonon scattering to be
separately elucidated.
Image simulation of inner shell ionization, i.e. electron energy loss spectroscopy (EELS)
and energy dispersive x-ray spectroscopy (EDX), are based on a parameterization of the
effective ionization potential in the local approximation. For EELS, a correction is made
for the finite detector aperture size. It is assumed that the aperture size is large enough
that the elastic scattering of the outgoing electron can be neglected.
The user is advised to read this manual in full even if they will not be running a
particular calculation. Concepts will be cross referenced between sections.
5
1.1.2 Version 4.5 bug fix
Version 4.5 has fixed a bug in which the third order spherical aberration coefficient CS
was not correctly set.
• Introduces M and N shell ionization for EDX and EELS and allows EDX subshells
to be output seperately
6
1.2.2 CPU versions
The program runs on Windows 64-bit operating systems. The source code has been
succesfully compiled Linux.
4. Atom type label (human readable, i.e. Strontium is also a valid input).
7
5. Number of atoms of this type, atomic number Z, fractional occupancy, mean squared
displacement hu2 i in Å2 (hu2 i = B/(8π 2 ) where B is assumed to be an isotropic tem-
perature factor, so that hu2 i = (hu2x i+hu2y i+hu2z i)/3 with each Cartesian component
assumed to contribute equally). Atoms with the same atomic number but different
temperature factors can be entered as different atom types.
Line 1: Will contain a single directive: Play, record overwrite, record, interactive
Interactive: no recording or playing, all inputs taken from the console
Record : as above, but does not overwrite the listed simulation file if it exists.
Record overwrite: records the simulation based on console inputs. Overwrites the listed
simulation file (if it exists).
Play: plays the listed simulation file with no input via console needed.
Play all : plays the listed simulation file(s) with no input via console needed. Introduced
in version 5.1
Line 2: Filename
The name of the file to store the recorded input file. If a playback file is used which does
not follow the same sequence as the program expects the program will exit. The user is
then required to amend the user input file, or alternatively, record a new file using the
interactive prompts.
Note: playback files may need to be amended if you are upgrading from an earlier
version of µSTEM (due to possible changed or added prompts).
2.3 Output
Two dimensional images are output as single (32-bit) or double (64-bit) precision floating-
point binary files in big-endian format. The precision of the output is determined by the
version of the software that has been executed. These can be viewed easily in the free
software ImageJ as detailed in Sec. 4.1. Line scans along a single dimension are output
as text files.
8
Figure 1: An example of how the GPU selection summary might appear, depending on
your system.
Note: if you are connecting to a remote machine via a Remote Desktop protocol, the
program may become confused about which machine it is running on (it may for example
present you with a list of graphics cards on the local machine, rather than the remote
machine). In this instance it is recommended that the user connect via SSH instead. On
Windows, an SSH server can be set up using Bitvise SSH.
9
3.2 Output filename prefix
The user may specify a prefix which is used for all data files outputted by the program.
This is helpful to keep datasets organised.
Recommendation: µSTEM can be directed to output to a different directory by
adding the relative path to the output filename prefix, use this to better organise µSTEM
outputs.
The specimen thickness is entered in Ångström units. This will be rounded to the near-
est thickness that is an integer number of unit cell repeats in the z-direction. Thicknesses
can be entered as a single value, a list (z1 , z2 , z3 ...zn ) or a sequence (zinitial : zfinal : zstep ).
10
As an example a thickness series in steps of 100 Å entered as a sequence (zinitial = 100Å :
zfinal = 1000Å : zstep = 100Å), is demonstrated in Fig. 3.
Two methods are provided for calculating the potentials: the reciprocal space method
and the hybrid method [3]. The reciprocal space method is accurate, while the hybrid
method is considerably faster but is not as accurate. For rapid computations we recom-
mend the hybrid approach, which can be subsequently checked with the reciprocal space
method.
Note that if the memory on your graphics card is insufficient for storing pre-calculated
potentials for QEP model calculations, then potentials will be calculated “on-the-fly”
using the hybrid approach.
11
Figure 5: A *.xtl crystal input file modified to include the ionic state of the atoms within
the crystal
• The magnitude of all aberrations is in Ångström units for consistency and this can
be inconvenient for aberrations above first order such as spherical aberration C30
(for which mm is a more convenient unit). Here it is best to use the exponent symbol
“E” for input, so 1.2 mm of C30 is inputted as “1.2E7” Å.
• For an uncorrected instrument with significant 3rd order spherical aberration C30 ,
12
Figure 7: Choice of lens parameters.
Figure 8: Example output for the phase of the lens contrast transfer function and the
intensity of the point spread function. The scale bars were added in ImageJ.
Where sgn(C30 ) is the sign of the 3rd order spherical aberration coefficient. As
shown in Fig. 9, if C30 is adjusted, ∆f should be changed again and µSTEM will
automatically suggest the appropriate Sherzer condition.
13
Figure 9: For a given 3rd order spherical aberration C30 µSTEM will suggest the appro-
priate Sherzer defocus condition
14
Figure 11: Tilting the specimen.
15
If one is not interested in the contribution from thermally scattered electrons to EELS
and EDX cross sections, then an absorptive model calculation would suffice. In fact,
the elastic contribution will be very similar to that calculated in the QEP, and will be
significantly faster to calculate within the absorptive model. Nevertheless, the thermally
scattered component is often crucial in understanding the physics [5].
Calculations of the total scattered intensity in the QEP model are numerically equiv-
alent to what would be obtained in a frozen phonon (FPh) model calculation [9]; for the
FPh mode, the separation into elastic and thermal components is not obvious.
Practical considerations Using the QEP model typically requires the unit cell to be tiled
out by at least 4×4. Additionally, the atomic potentials are not thermally smeared out
as in the absorptive model but rather are quite sharp, which corresponds to requiring
a large grid size that permits high-angle scattering. The user should ensure that their
choice of grid size allows scattering out to at least 150 mrad, or at the very least confirm
convergence of their results by using progressively larger grid sizes. The user can also
monitor the intensity at each probe position to ensure that it does not drop significantly
below 1.0.
The algorithm employed by the QEP model relies on displacing the atoms in the
specimen into a number of random configurations based on the thermal motion of the
atoms. The accuracy of the QEP calculation increases as more configurations are cho-
sen; as a loose rule of thumb the authors would recommend at least 40 configurations.
More than 100 passes may be required for the elastic contribution to reach convergence.
Precalculating many transmission functions may require a large amount of memory.
To ameliorate this, the program can randomly translate the transmission functions
by an integer number of unit cells in each direction. Whilst technically this is not a
different configuration, it may effectively be different as seen by the incident electron
wave function. Using this approach increases the number of configurations by a factor
equal to the number of unit cells that have been tiled out. The translation of transmission
functions is computationally fastest when there are an integer number of pixels along each
direction of the unit cell. For example, with a 4×4 tiling and a 512×512 grid size, there
are 128×128 pixels per unit cell. If this is not the case then the code must revert to using
the Fourier Shift theorem and this will cost, in computational terms, an extra FFT per
slice.
It is also possible to generate transmission functions “on-the-fly”, which means that
transmission functions are not precalculated but rather are calculated just before they are
needed, and then are discarded. While slower than the precalculation approach it does
significantly reduce memory requirements and allows the simulation of aperiodic systems
containing of the order of 106 atoms. This option is only used if the GPU does not have
sufficient memory to precalculate and store an adequate number of transmission functions.
The user may also specify the “starting position of the random number sequence”.
Normally this input is not important, and any integer can be entered. If the same number
is entered for the same inputted parameters, then the results of the calculation should
be numerically identical. This is useful for exactly reproducing results, e.g. for checking
purposes.
16
3.9 Tiling and grid size
3.9.1 Unit cell tiling
The user may specify how the unit cell is tiled to form a supercell. This is necessary in
two cases: where the QEP model is being used, or when the illumination is a convergent
beam (e.g. a STEM probe). In the former case, we recommend that the tiling is at least
a factor of 4 in each direction, although if the unit cell (as specified in the xtl file) is
a complicated structure such as a nano-particle or an interface, it may already be large
enough so that tiling is not needed. In the case of convergent-beam illumination, it is
important that the supercell is large enough so that the scattered probe wave function
does not “wrap around” the supercell and interfere with itself. A supercell with side
lengths of 30 Å should be sufficient to contain a atom-sized probe (e.g. probe-forming
convergence semi-angle of 15 mrad for 300 keV electrons, which gives a probe about 1 Å
across).
If the absorptive model is being used and the illumination is a plane wave, then no
tiling is necessary.
For further details on supercell tiling please review Ref. [4].
• Pixel numbers (in each direction) that are products of powers of small primes can
result in significantly faster calculations, since the majority of the time is spent
performing Fast Fourier Transforms. The optimal choice would be a power of 2, e.g.
64, 128, 256, 512, 1024 etc.
• Calculations within the QEP model may be sped up significantly if there is an integer
number of pixels per unit cell, since in that case we can effectively compute new
“frozen lattice” configurations by simply translating an entire transmission function
by a random physical lattice vector, which would correspond to an integer number
of pixels. Otherwise, one would need to compute significantly more transmission
functions (taking up more memory and time) or translate the transmission functions
using a phase ramp in Fourier space (i.e. applying the Fourier Shift Theorem) which
is less efficient.
17
Comments: One can check whether the size of the grid is sufficient by monitoring the
intensity which is output as the calculation runs. If the intensity drops significantly
below 1.0, then the grid size could be increased. To check this for calculations using the
absorptive model, one should initially choose the option “Do not include absorption” and
check that the intensity is sufficiently conserved. Subsequently the calculation should be
run with absorption included.
Saving the transmission functions is depicted in Fig. 12. The transmission functions
are stored in a file prefixed according to the user’s specification at the beginning of the
program. In a subsequent calculation, the user can choose to load these transmission
functions by specifying the filename.
4 Case studies
In this section we present a few case studies with specific details about what typical
choices of parameters might be. For more worked examples of µSTEM calculations and
a simple worksheet see the Tutorials folder on the GitHub.
18
Figure 12: Saving transmission functions to file
19
Figure 13: Slicing choices
2. For specimen thicknesses typically used for atomic resolution HRTEM, the smeared
elastic scattering potential will generally not scatter a significant fraction of the
incident flux to angles greater than 100 mrad.
The user is encouraged to check that the grid size is sufficient by running a calculation in
the absorptive model but with absorption switched off, for more details see Sec. 3.8.1.
The user will now be presented with a series of questions pertaining to the imaging lens
of the microscope (see Fig. 15). In this example we have used a Cs of 1.2 mm, and have
accepted the recommended aperture cutoff and defocus to optimise for phase constrast in
the image. The sign convention for defocus is such that a positive value indicates more
20
Figure 15: A summary of the image forming lens parameters.
‘focusing’ power (overfocus). In other words the wave is brought to a focus before the
detector plane.
The program will now compute the image and diffraction pattern (see Fig. 16) and
output these 2D images as files named in the following format:
<Prefix>_Image_<NX>x<NY>.bin
<Prefix>_DiffractionPattern_<NX>x<NY>.bin
where NX and NY are the dimensions of the 2D image.
To load these files in ImageJ, go to File → Import → Raw, locate the file, and enter
the details shown in Fig. 17 (note that the single precision version has been used for this
example and hence the “Image type” is “32-bit Real”).
A more convenient way to load the files is using the Droplet: Drag and Drop file
processor plugin written by Jerome Mutterer and Wayne Rasband for ImageJ. Follow the
link and download instructions therein for the Droplet Plugin then add the contents of
the Droplet Actions folder from the muSTEM github to the folder of the same name in
21
Figure 17: Loading a binary file in ImageJ. The HRTEM image is displayed.
the plugins directory of your ImageJ directory. A screenshot of the droplet app is shown
in Fig. 18.
Figure 18: The ImageJ droplet with scripts to open µSTEM output: a much more con-
venient way of viewing data
If you use either MatlabTM or Python programming languages for data analysis then
functions to open µSTEM output in these languages are also available in the Auxiliary tools
folder
The diffraction pattern does not usually look very interesting when first displayed. It
is often necessary to adjust contrast or apply a log transformation. We refer the user to
the ImageJ documentation and to the literature for this.
22
Figure 19: Numerical parameters for plane wave illumination and QEP model
The user will now be asked some specific questions relating to the QEP model. In Fig.
20 we show the numbers used in this example; 10 distinct transmission functions have
been calculated, but since quick shifting is possible in this case, there will effectively be
160 configurations. This should be more than sufficient. We have chosen to use 20 passes,
which should usually be sufficient for calculating the total scattered intensity. However, it
may be insufficient for calculation of elastic intensities (and thermal intensities, which are
calculated by subtracting the elastic from the total). The absorptive model can be used
for rapid calculation of elastic intensities. The number chosen as the starting position of
the random number sequence is only important for reproducing a previous result, and can
be any integer.
At this point the user will be asked to specify the parameters of the image forming
lens, for more details Fig. 15 and the surrounding discussion.
The program will now calculate the transmission functions and then proceed with the
multislice solution. At completion the code will output the exit surface elastic intensity
and phase, the inelastic intensity and the total intensity. It will also output the equivalent
far-field diffraction and image plane quantities.
23
The following files are outputted:
<Prefix>_DiffPlaneTotal_<NX>x<NY>.bin
<Prefix>_DiffPlaneElastic_<NX>x<NY>.bin
<Prefix>_DiffPlaneTDS_<NX>x<NY>.bin
<Prefix>_ExitSurface_IntensityElastic_<NX>x<NY>.bin
<Prefix>_ExitSurface_PhaseElastic_<NX>x<NY>.bin
<Prefix>_ExitSurface_IntensityTotal_<NX>x<NY>.bin
<Prefix>_ExitSurface_IntensityTDS_<NX>x<NY>.bin
<Prefix>_Image_Elastic_<NX>x<NY>.bin
<Prefix>_Image_TDS_<NX>x<NY>.bin
<Prefix>_Image_Total_<NX>x<NY>.bin
Figure 21: Typical numerical parameters for a convergent beam calculation using the
absorptive model.
As the convergent probe does not share the same periodicity as the crystal we require
the use of a supercell. The size of the supercell must be such that there is no “aliasing” of
the probe, which occurs when the probe wave function scatters and subsequently extends
to the edges of the supercell. Numerical tests for aliasing are not easily defined and we
are forced to rely on intuition. As a general rule of thumb the more scattering that
occurs the larger the supercell needs to be. Another rule of thumb is that the finer the
probe is the larger the supercell needs to be. Without being prescriptive, keeping the
supercell side lengths larger than 30Å is usually sufficient, the caveat being that larger
is usually better. If in doubt, the user is encouraged to double the tiling of the unit cell
and simultaneously double the grid size, which will increase the size of the supercell while
keeping the resolution of the simulation constant.
In the present case study, we have tiled the STO unit cell 8×8 so that the supercell
measures 31 Å × 31 Å. We use a grid size of 512×512, which should be sufficient for
24
the absorptive model. This should be checked in practice by doubling the grid size to
1024×1024 and checking the results. These parameters are depicted in Fig. 21.
The probe-forming lens is set up in much the same way as for an imaging lens, as
described in Sec. 4.1 and depicted in Fig. 22. In this case we have assumed an aberration-
corrected probe with a convergence semi-angle of 15 mrad.
The user is now presented with a list of possible calculations as depicted in Fig. 23.
These calculation types are explained in the following sections.
25
4.3.2 PACBED patterns
The calculation will proceed using the probe positions determined from the information
transfer limit of the microscope and the unit cell under consideration. A choice is given as
to whether to output the different diffraction patterns contributing toward the PACBED.
If pertinent these will be outputted with the filename in the form
<Prefix>_pp_<n_x>_<n_y>_Diffraction_pattern_<NX>x<NY>.bin .
where the integers <n_x> and <n_y> label the scan positions of the probe across the unit
cell. This option allows one to construct a “4D STEM” data-set, ie one that could be
achieved in experiment with a fast-readout pixelated detector. The PACBED pattern will
be outputted with the filename in the form
<Prefix>_PACBED_Pattern_<NX>x<NY>.bin .
When calculating any type of STEM image, the user can choose the inner and outer
angles for a number of detectors in the diffraction plane, so that for example a STEM
HAADF image can be simultaneously calculated. These angles can be chosen to simulate
a broad range of imaging modes, including bright-field (BF), annular bright field (ABF)
and annular dark field (ADF) simultaneously. Segmented detectors are also a possibility
and can be accessed by inputting the number of detector annular and angular segments
seperated by a comma. Input for a 4 annulus ×4 segment detector system is shown by
way of example in Fig. 25. For all examples in the following sections, we specify a HAADF
detector with inner and outer angles of 60 and 180 mrad respectively.
26
Figure 25: Choosing STEM detectors in µSTEM.
27
Figure 26: Parameters for an EELS calculation
28
Figure 27: Parameters for an EDX calculation
References
[1] L. J. Allen, S. D. Findlay, M. P. Oxley, and C. J. Rossouw. Lattice-resolution contrast
from a focused coherent electron probe. Part I. Ultramicroscopy, 96:47, 2003.
[2] D. M. Bird and Q. A. King. Absorptive form factors for high-energy electron diffrac-
tion. Acta Cryst., A46:202, 1990.
[3] W. Van den Broek, X. Jiang, and C.T. Koch. FDES, a GPU-based multislice algo-
rithm with increased efficiency of the computation of the projected potential. Ultra-
microscopy, 158:89 – 97, 2015.
29
[5] B. D. Forbes, A. J. D’Alfonso, R. E. A. Williams, R. Srinivasan, H. L. Fraser, D. W.
McComb, B. Freitag, D. O. Klenov, and L. J. Allen. Contribution of thermally scat-
tered electrons to atomic resolution elemental maps. Physical Review B, 86:024108,
2012.
[10] L-M Peng. Electron scattering factors of ions and their parameterization. Acta
Crystallographica Section A, 54(4):481–485, 1998.
[11] D. Waasmaier and A. Kirfel. New analytical scattering-factor functions for free atoms
and ions. Acta Crystallographica Section A, 51:416–431, 1995.
30