Skip to content

EBSD Example

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

Example 2: EBSD Pattern Simulation

On this page, we cover an explicit example of an EBSD pattern simulation, from the Monte Carlo and master pattern simulations to the final pattern. We assume that the reader has successfully created the Ni.xtal crystal data file described in the first example. The instructions are for the command-line versions of all the programs; you can also use the EMsoftWorkbench to perform these simulations... see the corresponding help page for instructions.

Monte Carlo Simulation

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

EMMCOpenCL -t

Rename the resulting template file to whatever name you prefer to use, and make sure to use the extension .nml. Edit the filename.nml file with the correct parameters for a Ni EBSD run: set the mode to full, set the xtalname variable to Ni.xtal, set the sample tilt angle (typically 70°), set the GPU platform and device IDs, set the incident beam energy to 20 (in keV) and the energy below which not to consider any electrons (10), along with the energy bin size (1), set the maximum depth from which to consider BSEs along with the depth bin size, and set the name of the output file. Make sure that you follow the convention for file pathnames followed in EMsoft. Save the namelist file. It is recommended that output filenames have the form Ni-master-20kV.h5, i.e., the compound name followed by master and the microscope accelerating voltage.

Then execute the program as follows:

EMMCOpenCL filename.nml

This will produce a lot of output; after the standard program header and information about the crystal structure, the OpenCL portion of the program will start with the following output (the numbers are just examples and do not necessarily represent the output for the Ni run):

.......
Density, avZ, avA =   8.91125  28.00000,  58.69340
 OpenCL source file set to : EMMC.cl
Kernel source length (characters) :                13238

Program Build Successful... Creating kernel
Monte Carlo mode set to full. Performing full calculation...

 Total number of electrons incident =       11250000
 Number of BSE electrons =        6405279
 Total number of electrons incident =       22500000
 Number of BSE electrons =       12809516
 Total number of electrons incident =       33750000
 Number of BSE electrons =       19208588
 Total number of electrons incident =       45000000
 Number of BSE electrons =       25611403
.......
 Total number of electrons incident =     1980000000
 Number of BSE electrons =     1126787153
 Total number of electrons incident =     1991250000
 Number of BSE electrons =     1133187795
Total number of incident electrons =     2000000000
Total number of BSE electrons =     1138179286
Backscatter yield =       0.569090
Total execution time [s] =                  287

On a high end gaming card, e.g., the NVidia GTX 1080 card, a Monte Carlo run with 2 billion incident electrons will take about 4-5 minutes; a run with the CPU-based EMMC program will take several hours.

The EMMCOpenCL program creates an HDF5-formatted output file that contains the Monte Carlo depth and directional histograms in square Lambert equal-area projection format. You can use the EMsoftWorkbench to visualize the Monte Carlo results; alternatively, you can use any other program with HDF5 capability (Matlab, IDL, HDFview, ...) to analyze the contents of the output file.

As an example, here are the Monte Carlo output profiles for the 19 kV energy bin, displayed as a square Lambert projection and the corresponding stereographic projection.

19 keV Monte Carlo distribution in square Lambert projection

19 keV Monte Carlo distribution in stereographic projection

EBSD Master Pattern Computation

Generate the template files:

EMEBSDmaster -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., Ni-master-20kV.h5. You should also rename the BetheParameters.template file to BetheParameters.nml. Upon executing the program (in this case with 24 threads), you should see the following output:

...
 total number of BSE electrons in MC data set    2000000000.0000000     
 -> completed reading pathname/Ni-master-20kV.h5

 Range of reflections along a*, b* and c* =           8           8           8

Generating Sgh coefficient lookup table ...Done


Starting computation for energy bin (in reverse order)  11 of   11; energy [keV] = 20.00

# independent beam directions to be considered =  125752
 Attempting to set number of threads to  24
  completed beam direction    5000 of   125752
  completed beam direction   10000 of   125752
  completed beam direction   15000 of   125752
... (many lines omitted)
  completed beam direction  115000 of   125752
  completed beam direction  120000 of   125752
  completed beam direction  125000 of   125752
 -> Average number of strong reflections =   25
 -> Average number of weak reflections   =   13
Execution time [s]:        3955
Final data stored in file pathname/Ni-master-20kV.h5

Total execution time [s]         170

The Execution time [s] entry lists the total time of all threads added together whereas the Total execution time [s] lists the wall time; the wall time multiplied by the number threads (170x24=4080) is typically about the same as the total execution time for all threads added together, apart from some overhead in writing the data to a file etc...

Below is an example master pattern for energy bin 19 keV in both the square Lambert projection (equal area) and a stereographic projection (equal angle).

19 keV master pattern in square Lambert projection

19 keV master pattern in stereographic projection

EBSD Pattern Simulation

Now that we have a completed master file, we can compute individual EBSD patterns or sets of patterns for a given detector geometry and orientation set. To get the template parameter file, execute the following command:

EMEBSD -t

which generates an EMEBSD.template file in your current folder. Rename the file as needed with .nml extension and edit its contents.

 &EBSDdata
! template file for the EMEBSD program
!
! distance between scintillator and illumination point [microns]
 L = 15000.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 = 0.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 = 10.0,
 energymax = 20.0,
! name of angle file (euler angles or quaternions); path relative to EMdatapathname
 anglefile = 'path/testeuler.txt',
! 'tsl' or 'hkl' Euler angle convention parameter
 eulerconvention = 'tsl',
! name of EBSD master output file; path relative to EMdatapathname
 masterfile = 'path/Ni-master-20kV.h5',
! name of Monte Carlo output file; path relative to EMdatapathname
 energyfile = 'path/Ni-master-20kV.h5',
! name of output file; path relative to EMdatapathname
 datafile = 'path/EBSDout.h5',
! bitdepth '8bit' for [0..255] bytes; 'float' for 32-bit reals; '##int' for 32-bit integers with ##-bit dynamic range
! e.g., '9int' will get you 32-bit integers with intensities scaled to the range [ 0 .. 2^(9)-1 ]; 
! '17int' results in the intensity range [ 0 .. 2^(17)-1 ]
 bitdepth = '8bit',
 ! incident beam current [nA]
 beamcurrent = 150.0,
! beam dwell time [micro s]
 dwelltime = 100.0,
! binning mode (1, 2, 4, or 8)
 binning = 2,
! should we perform an approximate computation that includes a lattice distortion? ('y' or 'n')
! This uses a polar decomposition of the deformation tensor Fmatrix which results in
! an approcimation of the pattern for the distorted lattice; the bands will be very close
! to the correct position in each pattern, but the band widths will likely be incorrect.
 applyDeformation = 'n'
! if applyDeformation='y' then enter the 3x3 deformation tensor in column-major form
! the default is the identity tensor, i.e., no deformation
 Ftensor = 1.D0, 0.D0, 0.D0, 0.D0, 1.D0, 0.D0, 0.D0, 0.D0, 1.D0,
! 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 = 6,
 /

There are many parameters in this file, as described in detail in the help page for the EMEBSD program. For the anglefile parameter, you will need to generate a file that contains one or more Euler angle triplets (in the Bunge convention); a typical input file looks like this:

eu
2
0.0, 0.0, 0.0
120.0, 45.0, 60.0

The first line tells the program that the input orientations are in Euler format, the second line states the number of orientations, and then each orientation is entered in degrees and separated by commas.

Executing the program is as simple as typing:

EMEBSD filename.nml

The program will list information about how the pattern simulation is split up over the available threads. Once the program ends, you should have an output HDF5 file in your folder that contains all the simulated EBSD patterns. You can use the EMsoftWorkbench to visualize those patterns, or any other program that allows you to read data sets from an HDF5 file.

The two patterns for the above detector parameter set and Euler orientation triplets are as follows:

EBSD pattern for (0,0,0)

EBSD pattern for (120,45,60)

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