Skip to content

TKD Example

Marc DeGraef edited this page Nov 5, 2018 · 2 revisions

Example 4: TKD Pattern Simulation

The simulation of a TKD pattern is very similar to that of a conventional EBSDE pattern; we start with a Monte Carlo run using EMMCfoil, then we compute the master pattern using EMTKDmaster, and we end with the EMTKD program to compute individual patterns. In this example, we will compute TKD patterns for SrTiO3 for a microscope accelerating voltage of 30 kV, and a sample tilt of 20° towards the detector screen, which itself is tilted 10° from vertical. We will also assume that the sample foil thickness is 100 nm.

Monte Carlo Simulation

To set up the simulation parameters, go to the folder where you wish to keep the data and type

EMMCfoil -t

Rename the file to EMMCfoil.nml and edit the parameters as follows:

 &MCCLfoildata
! name of the crystal structure file
 xtalname = 'SrTiO3.xtal',
! for full mode: sample tilt angle from horizontal [degrees]
 sig = 20.0,
! sample tilt angle around RD axis [degrees]
 omega = 0.0,
! number of pixels along x-direction of square projection [odd number!]
 numsx = 501,
! number of incident electrons per thread
 num_el = 10,
! GPU platform ID selector
 platid = 2,
! GPU device ID selector
 devid = 2,
! number of work items (depends on GPU card; leave unchanged)
 globalworkgrpsz = 150,
! total number of incident electrons and multiplier (to get more than 2^(31)-1 electrons)
 totnum_el = 2000000000,
 multiplier = 1,
! incident beam energy [keV]
 EkeV = 30.D0,
! minimum energy to consider [keV]
 Ehistmin = 15.D0,
! energy binsize [keV]
 Ebinsize = 1.0D0,
! max depth [nm] (this is the maximum distance from the bottom foil surface to be considered)
 depthmax = 100.0D0,
! depth step size [nm]
 depthstep = 1.0D0,
! total foil thickness (must be larger than depth)
 thickness = 100.0,
! output data file name; pathname is relative to the EMdatapathname path !!!
 dataname = 'datapath/SrTiO3-master-30kV.h5'
 /

You will likely need to use different values for the GPU platform and device IDs. During the program run, you will see output like this:

...
Program Build Successful... Creating kernel
 creating kernelname : MC
Monte Carlo mode set to full. Performing full calculation...

 Total number of electrons incident         =       11250000
 Number of electrons in southern hemisphere =       11180909
 Total number of electrons incident         =       22500000
 Number of electrons in southern hemisphere =       22361968
 Total number of electrons incident         =       33750000
 Number of electrons in southern hemisphere =       33543350
 ... [many lines removed]
 Total number of electrons incident         =     1991250000
 Number of electrons in southern hemisphere =     1979084481
Total number of incident electrons =     2000000000
Total number of electrons in Southern hemisphere =     1987805764
Transmission yield =       0.993903
Total execution time [s] =                  212

Note that the electron yield in this case is very high, since the majority of electrons make it through the entire foil. The distribution of the 29.5-30 kV electrons is shown in the following stereographic projection:

30 keV Monte Carlo distribution stereographic projection

TKD Master Pattern Computation

Generate the template files:

EMTKDmaster -t

rename the files with the .nml extension, and edit the contents; the default values are reasonable, and you can use as many threads as you have available. For the energyfile parameter, you should use the name of the Monte Carlo output file, i.e., datapath/SrTiO3-master-30kV.h5. You should also rename the BetheParameters.template file to BetheParameters.nml. Upon executing the program you should see the following output:

30 keV Master Pattern stereographic projection

TKD Pattern Computation

Generate the template files:

EMTKD -t

rename the file with the .nml extension, and edit the contents as follows:

 &TKDdata
! template file for the EMTKD program
!
! distance between scintillator and illumination point [microns]
 L = 16000.0,
! tilt angle of the camera (positive below horizontal, [degrees])
 thetac = 10.0,
! CCD pixel size on the scintillator surface [microns]
 delta = 50.0,
! number of CCD pixels along x and y
 numsx = 640,
 numsy = 480,
! pattern center coordinates in units of pixels
 xpc = 0.0,
 ypc = 320.0,
! angle between normal of sample and detector
 omega = 0.0,
! transfer lens barrel distortion parameter
 alphaBD = 0.0,
! energy range in the intensity summation [keV]
 energymin = 22.0,
 energymax = 30.0,
! name of angle file (euler angles or quaternions); path relative to EMdatapathname
 anglefile = 'datapath/euler.txt',
! 'tsl' or 'hkl' Euler angle convention parameter
 eulerconvention = 'tsl',
! name of EBSD master output file; path relative to EMdatapathname
 masterfile = 'datapath/SrTiO3-master-30kV.h5',
! name of Monte Carlo output file; path relative to EMdatapathname
 energyfile = 'datapath/SrTiO3-master-30kV.h5',
! name of output file; path relative to EMdatapathname
 datafile = 'datapath/TKDout.h5',
! incident beam current [nA]
 beamcurrent = 150.0,
! beam dwell time [micro s]
 dwelltime = 100.0,
! binning mode (1, 2, 4, or 8)
 binning = 1,
! intensity scaling mode 'not' = no scaling, 'lin' = linear, 'gam' = gamma correction
 scalingmode = 'gam',
! gamma correction factor
 gammavalue = 0.3333,
! should a circular mask be applied to the data? 'y', 'n'
 maskpattern = 'n',
! number of threads (default = 1)
 nthreads = 1,
 /

The euler.txt file has the following content:

eu
1
20.0,30.0,40.0

and the result of running the EMTKD program is an HDF5 file with a single pattern in the TKDpatterns array:

30 keV TKD Pattern

Information for Users

Home

SEM Modalities     - Monte Carlo Simulations
    - EBSD Master Pattern Simulations
    - EBSD Overlap Master Patterns
    - EBSD Pattern Simulations
    - EBSD Dictionary Indexing
    - EBSD Spherical Indexing
    - EBSD Reflector Ranking
    - EBSD HREBSD
    - ECP Master Pattern Simulations
    - ECP Pattern Simulations
    - TKD Master Pattern Simulations
    - TKD Pattern Simulations
    - ECCI Defect Image Simulations
TEM Modalities     - HH4
    - PED
    - CBED Pattern Simulations
    - STEM-DCI Image Simulations
    - EMIntegrateSTEM utility
XRD Modalities     - Laue Master Pattern Simulation
    - EMLaue
    - EMLaueSlit
General Parameter Definitions * Foil Defect Configuration Definitions
EMsoftWorkbench
Utility Programs     - EMConvertOrientations
    - EMDisorientations
    - EMHOLZ
    - EMKikuchiMap
    - EMOpenCLinfo
    - EMZAgeom
    - EMcuboMK
    - EMdpextract
    - EMdpmerge
    - EMdrawcell
    - EMeqvPS
    - EMeqvrot
    - EMfamily
    - EMGBO
    - EMGBOdm
    - EMgetEulers
    - EMgetOSM
    - EMlatgeom
    - EMlistSG
    - EMlistTC
    - EMmkxtal
    - EMorbit
    - EMorient
    - EMqg
    - EMsampleRFZ
    - EMshowxtal
    - EMsoftSlackTest
    - EMsoftinit
    - EMstar
    - EMstereo
    - EMxtalExtract
    - EMxtalinfo
    - EMzap
IDL Scripts     - Virtual Machine Apps
    - SEMDisplay
    - Efit
    - CBEDDisplay
python wrappers     - python examples
Docker     - Docker Image

Complete Examples

  1. Crystal Data Entry Example
  2. EBSD Example
  3. ECP Example
  4. TKD Example
  5. ECCI Example
  6. CBED Example
  7. Dictionary Indexing Example
  8. DItutorial

Information for Developers

Clone this wiki locally