------------------------------------------------------------------------------- Example STEM image simulations of perovskite SrTiO3 in [001] zone axis orientation using the command-line tools of the Dr. Probe package. Dr. Juri Barthel Ernst Ruska-Centre (ER-C 2) Forschungszentrum Juelich GmbH, 52425 Juelich, Germany December 2017 - small mistake fixed Aug 2021 ------------------------------------------------------------------------------- Applied tools BuildCell (v1.1) : Create atomic structure file input for simulations CellMuncher (v2.4) : Modify the atomic structure data CELSLC (v0.63b): Generate phase gratings for the multislice calculation MSA (v0.80b): Perform multislice calculation ------------------------------------------------------------------------------- 1) Preparatory steps 1.1) Install the Dr. Probe package! With the installer, you may use the Dr. Probe command-line link to work with. With a manual installation, make sure to register the installation path in the path variable. 1.2) Decide for a working folder on your hard drive. Open a command-line shell by running the "Dr. Probe command-line" or cmd.exe and navigate to this folder. Try whether the programs are found by the system by running the command "msa" from this folder. The program MSA should start and exit with an error. All commands given below after "> " should be entered from this working directory. 2) Generation of an input structure file 2.1) Create a folder "cel" where we store the input atomic structure data. > md cel 2.2) Create a structure file with the SrTiO3 unit cell using BuildCell: > BuildCell --spacegroup=221 --lattice=3.905,3.905,3.905,90.0,90.0,90.0 --atom=Sr,0.0,0.0,0.0,1.0,0.66 --atom=Ti,0.5,0.5,0.5,1.0,0.51 --atom=O,0.0,0.5,0.5,1.0,1.08 --output=cel\STO_001.cel You may translate this file to a CIF file for inspecting the result by Vesta or another structure display software: > cel2cif cel\sto_001 2.3) Modify the unit cell by shifting all atoms 1/4 of the cell size along all 3 directions, > CellMuncher -f cel\STO_001.cel -o cel\STO_001a.cel -T x,0.25 -T y,0.25 -T z,0.25 --cif and force the resulting atomic positions back to the default unit cell range: > CellMuncher -f cel\STO_001a.cel -o cel\STO_001b.cel --periodic=x --periodic=y --periodic=z --cif 2.4) Modify the structure generating a supercell of 4x4 unit cells repeated in the x-y plane. > CellMuncher -f cel\STO_001b.cel -o cel\STO_001_4x4.cel --repeat=x,4 --repeat=y,4 --cif In the resulting structure, a Sr atom is closest to the origin of the supercell. The total size of the supercell is now a=1.562 nm x b=1.562 nm x c=0.3905 nm. 3) Generation of phase gratings 3.1) Create a folder "slc" where we store the phase gratings. > md slc 3.2) Decide for experimental conditions relevant for this step: incidient electron energy: 200 keV -> lambda = 2.058 pm max. collection angle of detectors: 250 mrad -> q_det,max = 100 1/nm max. sample thickness: 40 nm The maximum detected q should be at 2/3 of the wave function sampling Nyquist frequency q_max -> q_max = 150 1/nm. This determines the horizontal and vertical sampling, since 2*q_max = nx/a = ny/b, thus with a = b we need nx = ny = 2*a*q_max = 468.6 pixel --> 480 pixel We choose the next larger integer with low prime factors {2,3,5} to achieve a fast Fourier transform in the later calculations. The number of slices is chosen equal to the number of atomic planes in the super-cell, which is nz = 2. The slice thickness is thus c/nz = 0.19525 nm. The number of frozen lattice variants per slice is chosen to provide at least as much variants as slices needed to represent the target maximum sample thickness nslnum = 40nm / c * nz ~ 200, thus nv = 100 (100 variants per slice). With this setup we call > celslc -cel cel\sto_001_4x4.cel -slc slc\sto_001_200kV_fl -nx 480 -ny 480 -nz 2 -nv 100 -ht 200.0 -fl The calculation will take about 1 minute on a normal PC. In the sub-folder slc you will find 2 "sli" files of about 180 MB size containing the phase gratings, and a "prm" file with sampling information. The calculation of phase-gratings cann be speed up by distributing the calculations for each slice on separate processes > celslc -cel cel\sto_001_4x4.cel -slc slc\sto_001_200kV_fl -nx 480 -ny 480 -nz 2 -nv 100 -ht 200.0 -fl -ssc 1 > celslc -cel cel\sto_001_4x4.cel -slc slc\sto_001_200kV_fl -nx 480 -ny 480 -nz 2 -nv 100 -ht 200.0 -fl -ssc 2 Here are the commands you need to run for the present example creating two processes: > start "slice 1" celslc -cel cel\sto_001_4x4.cel -slc slc\sto_001_200kV_fl -nx 480 -ny 480 -nz 2 -nv 100 -ht 200.0 -fl -ssc 1 > start "slice 2" celslc -cel cel\sto_001_4x4.cel -slc slc\sto_001_200kV_fl -nx 480 -ny 480 -nz 2 -nv 100 -ht 200.0 -fl -ssc 2 You can put these command calls as a sequence into a batch file, which will launch them almost at the same time. Here is a link explaining further the usage of the "start" command: https://ss64.com/nt/start.html 4) Multislice calculation 4.1) Create a folder "prm" where we store the MSA parameter file. > md prm Also create a folder "img" where we store the result of the calculation. > md img 4.2) Creating a parameter file for MSA: For controlling the calculations done by the program MSA we need to write the parameters of the calculation in a fixed sequence into a text file. These are the parameters relevant to the STEM simulation: - illumination semi convergence angle: 25 mrad - detector parameter file: 'prm\detectors.prm' - incident electron energy: 200 keV - geometrical effective source size (HWHM): 0.05 nm - scan frame offset in supercell: 0.0 nm, 0.0 nm - scan frame size: 0.781 nm, 0.781 nm (2x2 projected unit cells) - scan frame sampling: 78 x 78 pixels (10 pm / pixel) - slice file name: 'slc\sto_001_200kV_fl' - number of slice files: 2 - number of frozen-lattice variants to load: 100 (per slice) - minimum number of FL variations averaged: 1 (per scan pixel) - max. number of slices in the object: 200 (approx. 40 nm thickness) - detector readout period: 4 (creates a thickness series of images) - slice sequence in object: 0,1,0,1,.... Below this line is the text that you need to save as file "prm\msa.prm": '[Microscope Parameters]' 25.0 ! [mrad] illumination cone half-angle ! STEM only 0.0 ! [mrad] inner detection angle ! STEM only 20.0 ! [mrad] outer detection angle ! STEM only 1, 'prm\detectors.prm' ! flag and name of STEM detector file ! STEM only 200.0 ! [keV] electron energy 0.05 ! [nm] geometrical source size (HWHM) ! STEM only 3.00 ! [nm] focus spread ! STEM only 2.0 ! relative focus spread kernel width ! STEM only 7 ! focus spread kernel samples ! STEM only 0 ! number of probe aberrations ! STEM only '[Multislice Parameters]' 0.000000 ! [deg] object tilt X, stay below 5 deg! 0.000000 ! [deg] object tilt Y, stay below 5 deg! 0.0 ! [nm] horizontal scan frame offset ! STEM only 0.0 ! [nm] vertical scan frame offset ! STEM only 0.781 ! [nm] horizontal scan frame size ! STEM only 0.781 ! [nm] vertical scan frame size ! STEM only 0.0 ! [deg] scan frame rotation ! STEM only 78 ! horizontal scan frame samples ! STEM only 78 ! vertical scan frame samples ! STEM only 0 ! switch for partial temporal coherence ! STEM only 1 ! switch for partial spatial coherence ! STEM only 1 ! super-cell X repeat 1 ! super-cell Y repeat 1 ! super-cell Z repeat factor ! Ignored 'slc\STO_001_200kV_fl' ! phase grating files (without indices and extension) 2 ! number of slice files to load 100 ! number of frozen lattice variants per slice 1 ! minimum number of FL variations averaged 4 ! detector readout period in slices 200 ! max. number of slices in the object 0 ! slice ID 1 ! slice ID 0 ! slice ID 1 ! slice ID 0 ! slice ID 1 ! slice ID 0 ! slice ID 1 ! slice ID 0 ! slice ID 1 ! slice ID 0 ! slice ID 1 ! slice ID 0 ! slice ID 1 ! slice ID 0 ! slice ID 1 ! slice ID 0 ! slice ID 1 ! slice ID 0 ! slice ID 1 ! slice ID 0 ! slice ID 1 ! slice ID 0 ! slice ID 1 ! slice ID 0 ! slice ID 1 ! slice ID 0 ! slice ID 1 ! slice ID 0 ! slice ID 1 ! slice ID 0 ! slice ID 1 ! slice ID 0 ! slice ID 1 ! slice ID 0 ! slice ID 1 ! slice ID 0 ! slice ID 1 ! slice ID 0 ! slice ID 1 ! slice ID 0 ! slice ID 1 ! slice ID 0 ! slice ID 1 ! slice ID 0 ! slice ID 1 ! slice ID 0 ! slice ID 1 ! slice ID 0 ! slice ID 1 ! slice ID 0 ! slice ID 1 ! slice ID 0 ! slice ID 1 ! slice ID 0 ! slice ID 1 ! slice ID 0 ! slice ID 1 ! slice ID 0 ! slice ID 1 ! slice ID 0 ! slice ID 1 ! slice ID 0 ! slice ID 1 ! slice ID 0 ! slice ID 1 ! slice ID 0 ! slice ID 1 ! slice ID 0 ! slice ID 1 ! slice ID 0 ! slice ID 1 ! slice ID 0 ! slice ID 1 ! slice ID 0 ! slice ID 1 ! slice ID 0 ! slice ID 1 ! slice ID 0 ! slice ID 1 ! slice ID 0 ! slice ID 1 ! slice ID 0 ! slice ID 1 ! slice ID 0 ! slice ID 1 ! slice ID 0 ! slice ID 1 ! slice ID 0 ! slice ID 1 ! slice ID 0 ! slice ID 1 ! slice ID 0 ! slice ID 1 ! slice ID 0 ! slice ID 1 ! slice ID 0 ! slice ID 1 ! slice ID 0 ! slice ID 1 ! slice ID 0 ! slice ID 1 ! slice ID 0 ! slice ID 1 ! slice ID 0 ! slice ID 1 ! slice ID 0 ! slice ID 1 ! slice ID 0 ! slice ID 1 ! slice ID 0 ! slice ID 1 ! slice ID 0 ! slice ID 1 ! slice ID 0 ! slice ID 1 ! slice ID 0 ! slice ID 1 ! slice ID 0 ! slice ID 1 ! slice ID 0 ! slice ID 1 ! slice ID 0 ! slice ID 1 ! slice ID 0 ! slice ID 1 ! slice ID 0 ! slice ID 1 ! slice ID 0 ! slice ID 1 ! slice ID 0 ! slice ID 1 ! slice ID 0 ! slice ID 1 ! slice ID 0 ! slice ID 1 ! slice ID 0 ! slice ID 1 ! slice ID 0 ! slice ID 1 ! slice ID 0 ! slice ID 1 ! slice ID 0 ! slice ID 1 ! slice ID 0 ! slice ID 1 ! slice ID 0 ! slice ID 1 ! slice ID 0 ! slice ID 1 ! slice ID 0 ! slice ID 1 ! slice ID 0 ! slice ID 1 ! slice ID 0 ! slice ID 1 ! slice ID 0 ! slice ID 1 ! slice ID 0 ! slice ID 1 ! slice ID 0 ! slice ID 1 ! slice ID 0 ! slice ID 1 ! slice ID 0 ! slice ID 1 ! slice ID 0 ! slice ID 1 ! slice ID 0 ! slice ID 1 ! slice ID 0 ! slice ID 1 ! slice ID 0 ! slice ID 1 ! slice ID 0 ! slice ID 1 ! slice ID 0 ! slice ID 1 ! slice ID 0 ! slice ID 1 ! slice ID 0 ! slice ID 1 ! slice ID 0 ! slice ID 1 ! slice ID 0 ! slice ID 1 ! slice ID 0 ! slice ID 1 ! slice ID 0 ! slice ID 1 ! slice ID 0 ! slice ID 1 ! slice ID 0 ! slice ID 1 ! slice ID 0 ! slice ID 1 ! slice ID 0 ! slice ID 1 ! slice ID 0 ! slice ID 1 ! slice ID 0 ! slice ID 1 ! slice ID 0 ! slice ID 1 ! slice ID 0 ! slice ID 1 ! slice ID 0 ! slice ID 1 ! slice ID 0 ! slice ID 1 ! slice ID 0 ! slice ID 1 ! slice ID 0 ! slice ID 1 ! slice ID 0 ! slice ID 1 ! slice ID 0 ! slice ID 1 ! slice ID 0 ! slice ID 1 ! slice ID 0 ! slice ID 1 ! slice ID 0 ! slice ID 1 ! slice ID 0 ! slice ID 1 ! slice ID 0 ! slice ID 1 ! slice ID 0 ! slice ID 1 ! slice ID 0 ! slice ID 1 ! slice ID 0 ! slice ID 1 ! slice ID 0 ! slice ID 1 ! slice ID 0 ! slice ID 1 ! slice ID 0 ! slice ID 1 ! slice ID 0 ! slice ID 1 ! slice ID 0 ! slice ID 1 ! slice ID 0 ! slice ID 1 ! slice ID 0 ! slice ID 1 ! slice ID 0 ! slice ID 1 ! slice ID 0 ! slice ID 1 ! slice ID 0 ! slice ID 1 ! slice ID 0 ! slice ID 1 ! slice ID (End of parameter file example). 4.3) Creating a detector parameter file for MSA: The MSA main parameter file "prm\msa.prm" created above links to a detector parameter file named "prm\detectors.prm". The text following this line is an example for a detector file: '[Detector Parameters]' ! block ID string for detector definitions 2016021801 ! detector file format version (keep this) 3 ! number of detector definitions following, only this number of lines will be read in the following, additional lines are ignored. 90.0, 250.0, 0.0, 0.0, 0.0, 0.0, 'HAADF', 'prm/FiscioneHAADF-profile.dat' ! 1st detector definition: inner radius [mrad], outer radius [mrad], start azimuth [deg], stop azimuth [deg], decenter-x [mrad], decenter-y [mrad], detector name string, detector sensitivity profile file 30.0, 90.0, 0.0, 0.0, 0.0, 0.0, 'ADF', '' ! 2nd detector definition 10.0, 23.0, 0.0, 0.0, 0.0, 0.0, 'ABF', '' ! 3rd detector definition (End of detector parameter file example) The sensitivity profile specified with the first detector definition is not used unless this file exists. 4.4) Run the multislice simulation with MSA: > msa -prm prm\msa.prm -out img\sto_001_200kV_stem.dat This calculation may take about 4 hours on a normal PC. You can spread the calculation load on multiple CPUs, but be aware, that each process will load the 360 MB phase gratings and each process will therefore require about 400 MB RAM. You should run not more than NCPU - 2 threads at the same time if NCPU is the number of CPU's available. Here is a list of calls, which spread the calculation over 4 threads, where each thread calculates about 20 of the 78 scan lines. > start "scan 1" msa -prm prm\msa.prm -out img\sto_001_200kV_stem.dat -py 0 -ly 19 > start "scan 2" msa -prm prm\msa.prm -out img\sto_001_200kV_stem.dat -py 20 -ly 39 > start "scan 3" msa -prm prm\msa.prm -out img\sto_001_200kV_stem.dat -py 40 -ly 59 > start "scan 4" msa -prm prm\msa.prm -out img\sto_001_200kV_stem.dat -py 60 -ly 77 You should insert a delay between successive starts to avoid conflicts between processes in trying to access the slice files at the same time. Here is a command which can be used in a batch script to insert a delay of a few seconds: > ping -n 4 localhost >nul In total this may still take 1 hour to finish the calculation. 4.5) Applying partial spatial coherence: Partial spatial coherence due to a finite geometrical (not optical) size of the electron source is applied by convoluting the raw images calculated above with a respective source distribution. This convolution is not done on the first run of MSA to allow a later convolution by different source sizes. The following call of MSA load the calculated raw STEM images and apply for a 1 Angstrom wide Gaussian source for a few examples: - at 15 nm thickness > msa -prm prm\msa.prm -in img\sto_001_200kV_stem_ABF_sl076.dat -out img\sto_001_200kV_stem_ABF_sl076_g010.dat -sr 0.05 > msa -prm prm\msa.prm -in img\sto_001_200kV_stem_HAADF_sl076.dat -out img\sto_001_200kV_stem_HAADF_sl076_g010.dat -sr 0.05 - at 31 nm thickness > msa -prm prm\msa.prm -in img\sto_001_200kV_stem_ABF_sl160.dat -out img\sto_001_200kV_stem_ABF_sl160_g010.dat -sr 0.05 > msa -prm prm\msa.prm -in img\sto_001_200kV_stem_HAADF_sl160.dat -out img\sto_001_200kV_stem_HAADF_sl160_g010.dat -sr 0.05 These images of data type 4-byte real with 78x78 pixels can be viewed by importing to DigitalMicrograph, ImageJ, or other data manipulation tools. -------------------------------------------------------------------------------