Notes on SRIM: Unattended (batch) operation and processing data files Large parts of this are verbatim extracts from SRIM Documentation (v. 2003.20) Physics of Recoil Cascades …The number of displacement collisions records how many target atoms were set in motion in the cascade with energies above their displacement energy (which you specified in the input program to TRIM)... A vacancy is the hole left behind when a recoil atom moves from its original site. Next, the table shows replacement collisions, which reduce the number of vacancies. If a moving atom strikes a stationary target atom and transfers more than its displacement energy to it, and the initial atom, after the collision, does not have enough energy to move onwards, and it is the same element as the atom it struck, then it just replaces that atom in the target and there is no vacancy created. Although this may sound complicated, this mechanism may reduce the total vacancies by up to 30%. The summation goes: Displacements = Vacancies + Replacement Collisions …The calculation of cascades, target displacements, replacement collisions, etc. makes certain assumptions which are defined explicitly below: Assume an incident atom has atomic number Z1, and energy E. It has a collision within the target with an atom of atomic number Z2. After the collision, the incident ion has energy E1 and the struck atom has energy E2. Previously specified for the target are energies E d, the displacement energy, Eb, the binding energy of a lattice atom to its site, and Ef, the final energy of a moving atom, below which it is considered to be stopped. A displacement occurs if E2>Ed (the hit atom is given enough energy to leave the site). A vacancy occurs if both E1>Ed and E2>Ed (both atoms have enough energy to leave the site). Both atoms then become moving atoms of the cascade. The energy, E2, of atom Z2 is reduced by Eb before it has another collision. If E2<Ed, then the struck atom does not have enough energy and it will vibrate back to its original site releasing E2 as phonons. If E1<Ed and E2>Ed and Z1 = Z2, then the incoming atom will remain at the site and the collision is called a replacement collision with E1 released as phonons. The atom in the lattice site remains the same atom by exchange. This type of collision is common in single element targets with large recoil cascades. If E1<Ed and E2>Ed and Z1Z2, then Z1 becomes a stopped interstitial atom. Finally, if E1<Ed and E2<Ed, then Z1 becomes an interstitial and E1+E2 is released as phonons. If your target has several different elements in it, and each has a different displacement energy, then E d will change for each atom of the cascade hitting different target atoms.… Quick vs. Full Calculations TRIM allows the user to omit certain aspects of collision kinetics in order to increase the speed of the calculation. "Full Damage Cascades" includes all normal kinetics of the ion penetrating the target. The "Quick" calculation ignores target atom cascades and limits the calculation to the ion trajectories. The "Sputtering" calculation includes special plots related to target atom sputtering. Finally, TRIM may be run in a constrained mode, as explained below for calculating neutron, electron, and photon cascades. (1) - Quick: Kinchen-Pease - This option should be used if you don't care about details of target damage or sputtering. The damage calculated with this option will be the quick statistical estimates based on the Kinchin-Pease formalism (see section Physics of Recoil Cascades for details about target damage).. The following data will be calculated correctly: Final distribution of ions in the target, Ionization energy loss by the ion into the target, Energy transferred to recoil atoms, Backscattered Ions Rebecca Powles 6 February 2016 Page 1/9 and Transmitted Ions. You will get identical range results for each ion as when you use the Full Damage Cascade option below, since the random number generator for the ions is separate from that used for the recoils. (2) - Full Cascades - This option follows every recoil until its energy drops below the lowest displacement energy of any target atom. Hence all collisional damage to the target is analyzed. The one exception is for very rare massive cascades which exceed 2000 atoms. At this point TRIM runs out of memory, and an error message is posted indicating that the limit of 2000 atoms in a single cascade has been exceeded. The calculation continues after the message is posted. [My interpretation of this is that full cascades are necessary for any calculations used to assess target damage (which is what we are concerned with), and quick calculations should only be used to get ion ranges.] Output Files relevant to Energy Loss Energy Loss to Ionization The datafile IONIZ.TXT, and the plot summaries the energy loss to the target electrons within the target window. This plot and file contains the energy given up to the target electrons. The data relating to "Ions" is the direct energy transferred from the ion to the target electrons. The data relating to the "Recoils" is energy transferred from recoiling target atoms to the target electrons. ====== Argon (10keV) ======= SRIM-2003.20 ======================================== Ion and Recoil IONIZATION See SRIM Outputs\TDATA.txt for details ======================================== See file : SRIM Outputs\TDATA.txt for calculation data Ion = Ar Energy = 10 keV ============= TARGET MATERIAL ====================================== Layer 1 : PET Layer Width = 10000.E+00 A ; Layer # 1- Density = 9.631E22 atoms/cm3 = 1.397 g/cm3 Layer # 1- H = 36.3 Atomic Percent = 4.19 Mass Percent Layer # 1- C = 45.4 Atomic Percent = 62.5 Mass Percent Layer # 1- O = 18.1 Atomic Percent = 33.3 Mass Percent ==================================================================== Total Ions calculated =010000.00 =============================================================== Table Ionization Units are >>>> eV / Angstrom / Ion <<<< =============================================================== TARGET DEPTH (Ang) ----------389000.E-05 777000.E-05 116500.E-04 … IONIZ. by IONS ----------1039.20E-02 1039.11E-02 1020.97E-02 IONIZ. by RECOILS ----------2277.50E-03 4055.10E-03 5216.12E-03 Energy Loss to Phonons The datafile PHONON.TXT, and the plot summaries the energy loss of the ions and recoiling target atoms into target phonons. The energy loss to target phonons consists of the direct creation of phonons by the ion, and the additional energy loss by target recoil atoms to phonons. Rebecca Powles 6 February 2016 Page 2/9 ====== Argon (10keV) ======= SRIM-2003.20 ======================================== Ion and Recoil PHONONS See SRIM Outputs\TDATA.txt for calc. details ======================================== See file : SRIM Outputs\TDATA.txt calculation data Ion = Ar Energy = 10 keV ============= TARGET MATERIAL ====================================== Layer 1 : PET Layer Width = 1.E+04 AAA ; Layer # 1- Density = 9.631E22 atoms/cm3 = 1.397 g/cm3 Layer # 1- H = 36.3 Atomic Percent = 4.19 Mass Percent Layer # 1- C = 45.4 Atomic Percent = 62.5 Mass Percent Layer # 1- O = 18.1 Atomic Percent = 33.3 Mass Percent ==================================================================== Total Ions calculated =10000.00 ======================================================== Table Units are >>>> Phonons / Angstrom / Ion <<<< ======================================================== DEPTH PHONONS PHONONS (Ang.) by ION by RECOILS ----------- ----------- ----------389000.E-05 126130.E-05 286503.E-05 777000.E-05 122127.E-05 555112.E-05 116500.E-04 123007.E-05 794211.E-05 155300.E-04 124469.E-05 988060.E-05 194100.E-04 127521.E-05 116107.E-04 … Energy Loss to Vacancy Production This plot and the files VACANCY.TXT and NOVAC.TXT, tabulate the energy loss to target vacancies. Each target atom element is shown separately. The number of vacancies depends on the Displacement Energy assigned to each target atom. The file NOVAC.TXT tabulates replacement collisions. These are a special type of collision in which the moving atom collides with an identical target atom, transfers an amount of energy greater than that atom's displacement energy, and does not have enough energy to move on out of the lattice site. Hence the original moving atom replaces the target atom, the target atom moves on, and since the two atoms are the same atomic species, there is no final damage. The two atoms exchange places, but since they are the same species there is no detectable change. [I’m not sure what the primary knock-on atom column is – I think maybe it is the number of target atoms recoiling (added to the cascade) in atoms/angstrom/ion, this column is not used for energy loss calculations ] Rebecca Powles 6 February 2016 Page 3/9 ====== Argon (10keV) ======= SRIM-2003.20 ========================================== Ion and Target VACANCY production See SRIM Outputs\TDATA.txt for calc. details ========================================== See file : SRIM Outputs\TDATA.txt for calculation data Ion = Ar Energy = 10 keV ============= TARGET MATERIAL ====================================== Layer 1 : PET Layer Width = 1.E+04 A ; Layer # 1- Density = 9.631E22 atoms/cm3 = 1.397 g/cm3 Layer # 1- H = 36.3 Atomic Percent = 4.19 Mass Percent Layer # 1- C = 45.4 Atomic Percent = 62.5 Mass Percent Layer # 1- O = 18.1 Atomic Percent = 33.3 Mass Percent ==================================================================== Total Ions calculated =10000.00 Total Target Vacancies = 141 /Ion Total Target Displacements = 143 /Ion Total Target Replacement Collisions = 2 /Ion !!!! NOTE : 2nd Column below is number of Primary Knock-Ons !!!! ( PKO are number of Target Atoms Recoiling from the Ion. ) ========================================================== Table Units are >>>> Vacancies / Angstrom / Ion <<<< ========================================================== TARGET DEPTH Ar H C O (Ang.) Knock-Ons Vacancies Vacancies Vacancies ----------- ----------- ----------- ----------- ----------389000.E-05 7002.62E-05 1216.75E-04 9412.60E-05 4420.04E-05 777000.E-05 1280.40E-04 1120.89E-04 1130.42E-04 5103.00E-05 116500.E-04 1277.05E-04 1198.71E-04 1297.92E-04 5484.47E-05 155300.E-04 1284.52E-04 1334.26E-04 1407.18E-04 6121.11E-05 194100.E-04 1301.79E-04 1464.13E-04 1561.03E-04 6657.24E-05 232900.E-04 1300.24E-04 1553.04E-04 1653.79E-04 7110.88E-05 … ====== Argon (10keV) ======= SRIM-2003.20 ========================================= Replacement Collisions See SRIM Outputs\TDATA.txt for calc. details ========================================= See file: SRIM Outputs\TDATA.txt for data about the calculation Ion = Ar Energy = 10 keV ============= TARGET MATERIAL ====================================== Layer 1 : PET Layer Width = 1.E+04 AAA ; Layer # 1- Density = 9.631E22 atoms/cm3 = 1.397 g/cm3 Layer # 1- H = 36.3 Atomic Percent = 4.19 Mass Percent Layer # 1- C = 45.4 Atomic Percent = 62.5 Mass Percent Layer # 1- O = 18.1 Atomic Percent = 33.3 Mass Percent ==================================================================== Total Ions calculated =10000.00 Total Target Vacancies = 141 /Ion Total Target Displacements = 143 /Ion Total Target Replacement Collisions = 2 /Ion ================================================================ Table Energy Units are >>>> Number / Angstrom / Ion <<<< ================================================================ DEPTH (A) Number ---------------------3890000.E-06 0000.030747 7770000.E-06 0000.007990 1165000.E-05 0000.003608 1553000.E-05 0000.003814 … Rebecca Powles 6 February 2016 Page 4/9 Calculating Electronic and Nuclear LET According to the discussion above, linear energy transfer (LET) can be calculated from the SRIM output files: Electronic LET = eV/ion/Angstrom Nuclear LET = eV/ion/Angstrom Ionization LET (Ion) + Ionization LET (Recoils) IONIZ.TXT column 2 IONIZ.TXT column 3 Binding Energy LET + Phonon Energy LET eV/ion/Angstrom eV/ion/Angstrom Binding Energy LET = Number of Displacements * Binding Energy, Eb eV/ion/Angstrom displ./ion/Angstrom eV/displacement Phonons (Ion) + Phonons (Recoils) Phonon Energy LET = eV/ion/Angstrom PHONON.TXT column 2 PHONON.TXT column 3 For Full Cascades: Number of Displacements= Number of Vacancies + Number of Replacements displ./ion/Angstrom displ./ion/Angstrom displ./ion/Angstrom Sum of Target Atom Vacancies Number of Vacancies = displ./ion/Angstrom VACANCY.TXT sum: columns 3,4,+… Replacements Number of Replacements = displ./ion/Angstrom NOVAC.TXT column 2 For Quick Calculations: Sum of Target Atom Vacancies Number of Displacements = displ./ion/Angstrom VACANCY.TXT sum: columns 2+3 Rebecca Powles 6 February 2016 Page 5/9 Running TRIM automatically (batch mode) from SRIM help file TRIM Monte Carlo calculations can be run without any keyboard inputs. This allows TRIM to be run with sequential calculations for a group of related results (sometimes called "running in a batch mode"). Between each run, the input file to TRIM is slightly altered, in order to make similar runs which may be compared. This input file, TRIM.IN, controls the TRIM calculation. Instructions: Look at the SRIM file: TRIMAUTO which contains one number. If the number is 1 then TRIM runs without input, and at completion is saves all datafiles and terminates. If any other number is in TRIMAUTO, or the file is not present, then TRIM runs normally. Running TRIM in batch mode: (1) Run a full TRIM calculation. (1) Edit the file TRIM.IN, changing any parameters to vary the TRIM calculation. Be sure to edit line #3, Ion Number, to the finite number ions to be calculated (not the default 99999). Be sure to edit line #7 to obtain the desired output datafiles. Be sure to edit line #13 to Plot Type = 5 (no plots) if you wish a rapid calculation. (2) Run TRIM.EXE by executing it directly. (3) When TRIM is completed, save or rename all the *.TXT files which have been generated. (4) Repeat as needed You will obtain all output files requested in TRIM.IN, line #7, plus two special groups: *.TXT = Files containing all the data shown in the available plots *.SAV = Files allowing the restart of TRIM where this calculation stopped. You will have to alter file "SRIM Saves/TDATA.SAV", Line #10, "Ion Number Total" to a bigger number in order to continue calculations with TRIM using old data. This special change is required to sum a group of TRIM calculations. See the Help section: Combining Multiple TRIM Calculations. Example: The following is a simple procedure for running TRIM in batch mode: (1) Edit TRIM.IN to set the calculation. (2) Start the batch job TRIM.EXT. (3) While the calculation is progressing, you may still execute any of the TRIM functions. (4) When TRIM finishes, change the file TRIM.IN to a new setup. (5) Go to step (2) to continue Running a set of SRIM simulations automatically It is possible to run SRIM from the (Windows/DOS) command line. The documentation for this mode is provided in the SRIM file: TRIMAUTO.TXT and in the help topic 'Auto-TRIM' available through the help menu under 'TRIM FAQ and Solutions'. In batch/non-interactive mode, SRIM will start and execute using the input data in the file TRIM.IN which is in the main program directory where TRIM.EXE is located. TRIM.IN specifies all data needed to run the simulation including the target composition, density and thickness, incident ion species, charge and energy, which output files to produce and which calculation mode to use (Quick/Full Cascades). Output files produced such as IONIZ.TXT, PHONON.TXT, VACANCY.TXT and NOVAC.TXT are saved in the main directory, and are overwritten with each new simulation. Rebecca Powles 6 February 2016 Page 6/9 First, read the documentation in TRIMAUTO.TXT so that you understand how to run SRIM on a single input file(TRIM.IN) in non-interactive mode. The next step is to automate this process to run SRIM automatically on a set of input files. Instructions: I have written two DOS batch files (MultiLET.bat and LET.bat, listings below) which will run SRIM in non-interactive mode on a set of pre-prepared *.IN files, allowing unattended simulation of many ion/energy/target combinations. To use these batch files, you need to do the following: Note: In this description, the main SRIM directory is the directory where the file TRIM.EXE is located, the data directory is where the input and output files are located. 1. 2. 3. 4. 5. 6. Copy MultiLET.bat and LET.bat to the main directory. Make a new directory which will contain the input and output data for the set of simulations. This is the data directory. Copy TRIMAUTO (from the main directory) to the data directory. Edit the file so that the first line contains a "1", and the second line is the path of the data directory Make a set of input files (following the format of TRIM.IN), one for each set of conditions you wish to simulate (see below), and save them in the data directory. Make sure these files do not have spaces in their filenames, and that the file extension is .IN At a command prompt, cd to the main directory At the command prompt type: MULTILET.bat datadirectory substituting the pathname of the data directory. This will run SRIM in non-interactive mode using every *.IN file in the data directory, moving all output files produced back to the data directory with names prefixed with the name of the input file. For example, running MultiLET.bat .\myData would run SRIM on all input files with names like *.IN in the data directory .\myData. If there were two input files .\myData\sim1.IN and \myData\sim2.IN in the data directory, the output files would be .\myData\sim1_ioniz.txt, .\myData\sim2_ioniz.txt, .\myData\sim1_phonon.txt etc. Creating input files: To create a set of input files, the easiest method is to first run SRIM in normal mode, setting up the target, ion and simulation parameters to match one of the desired set of input conditions. Start the simulation, then quit SRIM, opting to save the data so that SRIM can be re-started (this ensures the input data is saved to TRIM.IN). Copy TRIM.IN (in the main directory) to the data directory, and open the copy with a text editor. Check the SRIM documentation for details of the format of this file, and alter the appropriate values to change the incident ion species, ion energy and calculation mode. If you are not sure how to change a parameter, run SRIM again with the conditions you want and look at how TRIM.IN in the main directory has changed. Save each *.IN file to the data directory with a new name to reflect the simulation conditions, and repeat for each set of conditions. There are also some example input files available in the SRIM documentation. Rebecca Powles 6 February 2016 Page 7/9 Example input (TRIM.IN) file Values that can are likely to vary between input files are highlighted: Ion Z use 1 for quick, 2 for full calculations Xmax (maximum depth for output values) Ion M Number of ions simulated Ion Energy Bragg Correction (change to match target value below) ==> SRIM-2003.20 This file controls TRIM Calculations. Ion: Z1 , M1, Energy (keV), Angle,Number,Bragg Corr,AutoSave Number. 18 39.962 2.5 0 20000 .9570329 10000 Cascades(1=No;2=Full;3=Sputt;4-5=Ions;6-7=Neutrons), Random Number Seed, Reminders 1 0 0 Diskfiles (0=no,1=yes): Ranges, Backscatt, Transmit, Sputtered, Recoils (0=none;1=Some;2=All Details;>10=EXYZ Output) 0 0 0 0 0 Target material : Number of Elements & Layers "Argon (2.5keV) " 3 1 Target Energies (eV): Binding, Surface, Individual Displacement 3 2 10 28 28 PlotType (0-5); Plot Depths: Xmin, Xmax(Ang.) [=0 0 for Viewing Full Target] 5 0 230 Target Elements: Z Mass(amu) Atom 1 = H = 1 1.008 Atom 2 = C = 6 12.011 Atom 3 = O = 8 15.999 Layer Layer Name / Width Density H(1) C(6) O(8) Numb. Description (Ang) (g/cm3) Stoich Stoich Stoich 1 "PET" 10000 1.397 .363636 .454545 .181818 0 Target layer phases (0=Solid, 1=Gas) 0 Target Target Compound Corrections (Bragg) composition .9570329 and binding Target atom displacement energies (eV) energies 10 28 28 Target atom lattice binding energies (eV) 3 3 3 Target atom surface binding energies (eV) 2 7.41 2 Stopping Power Version (1=2003, 0=2003) 0 Some Hints: Depth Resolution: The number of depth values in the output files is fixed (at ?100), so to get good depth resolution when simulating multiple incident ion species and/or energies, make sure you set Xmax on line 13 (this corresponds the 'plot window' when running SRIM interactively) to a value just beyond the maximum range of the incident. You can use the range calculation facility of SRIM to determine appropriate Xmax values for each input file. Oscillations at small depths: For low ion energies and/or heavy ions, you may see oscillations in the output values at small depths (some Angstroms) - this will not go away by increasing the number of ions simulated - it is due to effects of statistical sampling and the intermolecular spacing in the early part of the ion trajectory - see TRIM FAQ in the help menu. Rebecca Powles 6 February 2016 Page 8/9 Batch file listings: MultiLET.bat echo off REM for each input file in the data directory *.IN REM run LET.BAT to process the file in TRIM and move the output REM pass data directory as first argument echo working in data directory: %1 echo processing the following input files: dir %1\*.IN echo switching to batch mode in TRIM move %1\trimauto >nul FOR %%a in (%1\*.IN) do call:PROC_FILE %1 %%a :PROC_FILE @echo data directory: %1 @echo processing %~n2 call let.bat %1 %~n2 GOTO :EOF LET.bat echo off REM run TRIM.EXE in main SRIM directory with REM input file TRIM.IN from data directory input as %1 REM in auto mode according to TRIMAUTO REM by replacing files and moving them to the correct location REM first argument is data directory REM second argument is stem of input and output file REM data directory must contain a file stem.IN which is a TRIM.IN file REM the results will be copied back to the data directory with the name REM ioniz_stem.txt etc REM note - all data files in the main SRIM directory will be overwritten if not exist trim.exe echo 'Must run this from SRIM main directory' REM echo data directory: %1 REM echo file stem %2 REM step 1: copy input file from data directory to main SRIM directory if not exist %1\%2.in echo file %1\%2.in was not found copy %1\%2.in TRIM.IN >nul echo copied input file %2.in to main directory as TRIM.IN REM step 2: run TRIM trim.exe echo finished running TRIM REM step 3: copy output *.txt files back to data directory with new name if not exist tdata.txt echo no summary results were saved... move tdata.txt %1\tdata_%2.txt >nul if exist %1\tdata_%2.txt echo results in: %1\tdata_%2.txt if not exist ioniz.txt echo no ionization results were saved... move ioniz.txt %1\ioniz_%2.txt >nul if exist %1\ioniz_%2.txt echo results in: %1\ioniz_%2.txt if not exist vacancy.txt echo no vacancy results were saved... move vacancy.txt %1\vacancy_%2.txt >nul if exist %1\vacancy_%2.txt echo results in: %1\vacancy_%2.txt if not exist phonon.txt echo no phonon results were saved... move phonon.txt %1\phonon_%2.txt >nul if exist %1\phonon_%2.txt echo results in: %1\phonon_%2.txt if not exist novac.txt echo no replacement results were saved... move novac.txt %1\novac_%2.txt >nul if exist %1\novac_%2.txt echo results in: %1\novac_%2.txt Rebecca Powles 6 February 2016 Page 9/9