QSTEM

Quantitative TEM/STEM Simulations

QSTEM data formats (.cfg, .img, .qsc)

The .cfg format

I will use the example of SrTiO3 to explain the .cfg format:

Number of particles = 5 # Number of atoms per unit cell
A = 1.0 Angstrom # Length unit of unit cell basis vectors
H0(1,1) = 3.905 A # X-component of first lattice vector (e.g. ‘a’)
H0(1,2) = 0 A # Y-component of first lattice vector
H0(1,3) = 0 A # Z-component of first lattice vector
H0(2,1) = 0 A # X-component of second lattice vector
H0(2,2) = 3.905 A # Y-component of second lattice vector
H0(2,3) = 0 A # Z-component of second lattice vector
H0(3,1) = 0 A # X-component of third lattice vector
H0(3,2) = 0 A # Y-component of third lattice vector
H0(3,3) = 3.905 A # Z-component of third lattice vector
.NO_VELOCITY. # Keep this line if you do not want to do MD with this config.
entry_count = 6 # Set this to 3 if you only define coordinates, 4, if you include the Debye-Waller factor, 5, if you include occupancy, or 6 if you also include the ionic charge.
76 # atomic weight of first atom species
Sr # Chemical symbol of first atom species
0 0 0 0.6214 1.0 2.0 # x y z (fract. coordinates) DW-factor occupancy charge
44 # atomic weight of second atom species
Ti # Chemical symbol of second atom species
0.5 0.5 0.5 0.4390 1.0 4.0 # x y z DW-factor occupancy charge
16  —————————-
O  ——————————–
0 0.5 0.5 0.7323 1.0 -2.0  ———————————-
0.5 0 0.5 0.7323 1.0 -2.0  —————————————
0.5 0.5 0 0.7323 1.0 -2.0 # x y z DW-factor occupancy charge of the 5th atom (oxygen)

Debye-Waller factor: Even if you omit the Debye-Waller factor, a default value proportional to the inverse of the atomic mass will be used, using a DW-factor of 0.45 at the atomic mass of silicon, so that B_element = B_Si * m_Si/m_element, where m_Si = 28 and B_Si = 0.45. In that case only the 3 fractional coordinates per atom are sufficient. However, it is important that entry_count matches the number of parameters specified for each atom.

Occupancy: Occupancies < 1 are interpreted as random vacancies. The code lets a random number generator decide whether this site is occupied or not, with the given probability of occupancy. If an occupancy > 1 is defined, it will simply be considered as 1. If multiple atoms are defined for the same lattice site then their occupancies define the probability with which these atoms will occupy that site. There will never be 2 atoms in the same site. In this case occupancies > 1 may be used to define occupancy rations with whole numbers (e.g. 2 and 1 instead of 0.6666666666666… and 0.333333333…).
Examples:

occ1 = 0.5, occ2 = 0.5 The site will be occupied by atom 1 with 50% chance, or atom 2 otherwise
occ1 = 1.0, occ2 = 1.0 The site will be occupied by atom 1 with 50% chance, or atom 2 otherwise
occ1 = 0.2, occ2 = 0.2 The site will be occupied by atom 1 with 20% chance. If atom 1 does not occupy this site then there is a 20% chance for atom 2 to be there. There is a 60% chance for this site to be vacant.

Ionic charge: For most simulations it is not necessary to define the ionic charge or the occupancy. Specifying the ionic charge only makes some sense for TEM simulations and should have no effect on HAADF-STEM images. If charges are specified the code uses ionic scattering factors provided by D. Rez, P. Rez, and I. Grant, “Dirac-Fock Calculations of X-ray Scattering Factors and Contributions to the Mean Inner Potential for Electron Scattering”, Acta Cryst. (1994). A50, 481-497. For charges different than the ones provided in this paper the code will interpolate. Neutral atom scattering factors will be used for atoms where no ionic scattering factor is defined. Note that also the neutral atom scattering factors stem from this paper.

Alloys: If multiple atoms sit on the same position within the unit cell the code will decide randomly which one to actually put on this site in the super cell (works for gbmaker as well as stem3.exe, not in the qstem GUI). Total occupancies larger than 1 will be normalized to one (see note on occupancy above). Total occupancies < 1 will also leave some chance that this site will be vacant.

Please, also take a look at some of the example .cfg files in the Examples folder.

The .img format

If you are using Matlab you can use these 2 functions to read and write files in .img format: binread2D.m (zipped) and binwrite2D.m (zipped).

The FRWRtools plugin for Gatan DigitalMicrograph also contains a menu item for reading (and writing) these files.

Byte type description
0.. 3 int header size (min. 8 4-byte integers and 3 8-byte doubles)
4.. 7 int paramSize: number of additional (double, i.e. 8-byte) parameters after the header
8..11 int commentSize: number of bytes in the comment string
12..15 int Nx: number of pixels in x-direction
16..19 int Ny: number of pixels in y-direction
20..23 int complexFlag: flag indicating whether data is complex (1) or real (0)
24..27 int dataSize: size of each data item in bytes (e.g. 16 for double-complex, 4 for float)
28..31 int version: will help to track the version of qstem used in the simulation (not used)
32..39 double t: e.g. sample thickness or defocus (for defocused images)
40..47 double dx: pixel size along x-direction (in A)
48..56 double dy: pixel size along y-direction (in A)
57..57+8*paramSize double auxilliary data
after that: char comment string of total length commentSize
after that: any actual data (block of size = Nx*Ny*dataSize)

The .qsc format

Just run qstem to generate a QSTEM Config (*.qsc) file and you will see what it looks like. Each line starts with the description of the value it defines and may also contain comments (start with ‘%’). If you don’t like the GUI you may also define the input file yourself and run stem3.exe with this file as input file.