srim package¶
Subpackages¶
Submodules¶
srim.input module¶
Write Inputfile for SRIM and TRIM calculations
-
class
srim.input.
AutoTRIM
(mode=1, restart_directroy=None)¶ Bases:
object
-
write
()¶ write AUTOTRIM in current directory
-
-
class
srim.input.
SRInput
(sr)¶ Bases:
object
Input file for Stopping and Range (Calculations)
Parameters: sr ( srim.srim.SR
) – SR class to use for writting file-
newline
= '\r\n'¶
-
write
()¶ Write SR calcualtion to
SR.IN
-
-
class
srim.input.
TRIMInput
(trim)¶ Bases:
object
Input File representation of TRIM run
Parameters: trim ( srim.srim.TRIM
) – A TRIM calculation to use for writing a file-
newline
= '\r\n'¶
-
srim_num_elements
¶ Number of unique elements in target (layer elements treated as unique)
-
write
()¶ Write TRIMInput class to
TRIM.IN
-
srim.output module¶
Read output files of SRIM simulation
TODO: Read header information
-
class
srim.output.
Backscat
¶ Bases:
object
The kinetics of all backscattered ions (energy, location and trajectory)
TODO: one day to be implemented! submit pull request please!
-
class
srim.output.
Collision
(directory, filename='COLLISON.txt')¶ Bases:
object
Reads the SRIM Collisions file.
This is the most important file in my opinion. It records every single collision and its energies. The file will get huge for simulations with many collisions. Since the file can be larger than the amount of RAM it will read the file in sections (buffers).
Parameters: - directory (
str
) – directory of calculation - filename (
str
, optional) – filename for Collisions. DefaultCOLLISON.txt
- directory (
-
class
srim.output.
EnergyToRecoils
(directory, filename='E2RECOIL.txt')¶ Bases:
srim.output.SRIM_Output
E2RECOIL.txt
Energy transfered to atoms through binary collisionParameters: - directory (
str
) – directory of calculation - filename (
str
, optional) – filename for EnergyToRecoils. DefaultE2RECOIL.txt
-
absorbed
¶ Energy [eV/(Angstrom-Ion)] absorbed from collisions with Atom
TODO: fix terminology
-
depth
¶ Depth [Ang] of bins in SRIM Calculation
-
ion
¶ Ion used in SRIM calculation
mass could be wrong
-
ions
¶ Energy [eV/(Angstrom-Ion)] transfered to material through ion collisions
-
num_ions
¶ Number of Ions in SRIM simulation
- directory (
-
class
srim.output.
Ioniz
(directory, filename='IONIZ.txt')¶ Bases:
srim.output.SRIM_Output
IONIZ.txt
Ionization by ions and depth. Includes header information about calculationParameters: - directory (
str
) – directory of calculation - filename (
str
, optional) – filename for Ioniz. DefaultIONIZ.txt
-
depth
¶ Depth [Ang] of bins in SRIM Calculation
-
ion
¶ Ion used in SRIM calculation
mass could be wrong
-
ions
¶ Ionization energy [eV/(Angstrom Ion)] lost to electronic stopping in incident ions
-
num_ions
¶ Number of Ions in SRIM simulation
-
recoils
¶ Ionization energy [eV/(Angstrom Ion)] lost to electronic stopping in recoil ions
- directory (
-
class
srim.output.
NoVacancy
(directory, filename='NOVAC.txt')¶ Bases:
srim.output.SRIM_Output
NOVAC.txt
Table of Replacement CollisionsParameters: - directory (
str
) – directory of calculation - filename (
str
, optional) – filename for NoVacancy. DefaultNOVAC.txt
-
depth
¶ Depth [Ang] of bins in SRIM Calculation
-
ion
¶ Ion used in SRIM calculation
mass could be wrong
-
num_ions
¶ Number of Ions in SRIM simulation
-
number
¶ Replacement Collisions [Number/(Angstrom-Ion)]
- directory (
-
class
srim.output.
Phonons
(directory, filename='PHONON.txt')¶ Bases:
srim.output.SRIM_Output
PHONON.txt
Distribution of PhononsParameters: - directory (
str
) – directory of calculation - filename (
str
, optional) – filename for Phonons. DefaultPHONON.txt
-
depth
¶ Depth [Ang] of bins in SRIM Calculation
-
ion
¶ Ion used in SRIM calculation
mass could be wrong
-
ions
¶ Number of phonons [Phonons/(Angstrom Ion)] created from ions collisions
-
num_ions
¶ Number of Ions in SRIM simulation
-
recoils
¶ Number of phonons [Phonons/(Angstrom Ion)] created from recoils resulting from ion collisions
- directory (
-
class
srim.output.
Range
(directory, filename='RANGE.txt')¶ Bases:
srim.output.SRIM_Output
RANGE.txt
Table of the final distribution of the ions, and any recoiling target atomsParameters: - directory (
str
) – directory of calculation - filename (
str
, optional) – filename for Range. DefaultRANGE.txt
-
depth
¶ Depth [Ang] of bins in SRIM Calculation
-
elements
¶ Per elements [(Atoms/cm3)/(Atoms/cm2)] distribution of each element
-
ion
¶ Ion used in SRIM calculation
mass could be wrong
-
ions
¶ Ion final distribution [(Atoms/cm3)/(Atoms/cm2)]
-
num_ions
¶ Number of Ions in SRIM simulation
- directory (
-
class
srim.output.
Results
(directory)¶ Bases:
object
Gathers all results from folder
Parameters: directory ( str
) – directory to look for TRIM calculationsNotes
- Files that are looked for:
IONIZ.txt
handled bysrim.output.Ioniz
VACANCY.txt
handled bysrim.output.Vacancy
NOVAC.txt
handled bysrim.output.NoVacancy
E2RECOIL.txt
handled bysrim.output.EnergyToRecoils
PHONON.txt
handled bysrim.output.Phonons
RANGE.txt
handled bysrim.output.Range
-
exception
srim.output.
SRIMOutputParseError
¶ Bases:
Exception
SRIM error reading output file
-
class
srim.output.
SRIM_Output
¶ Bases:
object
-
class
srim.output.
SRResults
(directory, filename='SR_OUTPUT.txt')¶ Bases:
object
Read SR_OUTPUT.txt file generated by pysrim SR.run()
-
data
¶ - [
- <energy in keV>, <electronic stopping in <units> >, <nuclear stopping in <units> >, <projected range in um>, <longitudinal straggling in um>, <lateral straggling in um>
]
-
ion
¶ - {
- ‘name’: <e.g. Silicon>, ‘Z1’: <int(atomic number)>, ‘A1’: <float(atomic mass)>
}
-
target
¶ - {
‘density g/cm3’: <float>, ‘density atoms/cm3’: <float>, ‘target composition’: {
- <element 1 symbol>’: {
- <int(Z)>, <float(stoichiometric percent)>, <float(mass percent)>
}, <element 2 symbol>’: {…}, …
}
}
-
units
¶
-
-
class
srim.output.
Sputter
¶ Bases:
object
The kinetics of all target atoms sputtered from the target.
TODO: one day to be implemented! submit pull request please!
-
class
srim.output.
Transmit
¶ Bases:
object
The kinetics of all transmitted ions (energy, location and trajectory)
TODO: one day to be implemented! submit pull request please!
-
class
srim.output.
Vacancy
(directory, filename='VACANCY.txt')¶ Bases:
srim.output.SRIM_Output
VACANCY.txt
Table of the final distribution of vacancies vs depthParameters: - directory (
str
) – directory of calculation - filename (
str
, optional) – filename for Vacancy. DefaultVACANCY.txt
-
depth
¶ Depth [Ang] of bins in SRIM Calculation
-
ion
¶ Ion used in SRIM calculation
mass could be wrong
-
knock_ons
¶ Vacancies produced [Vacancies/(Angstrom-Ion) by ion]
-
num_ions
¶ Number of Ions in SRIM simulation
-
vacancies
¶ Vacancies [Vacancies/(Angstrom-Ion)] produced of element in layer
- directory (
-
srim.output.
buffered_findall
(filename, string, start=0)¶ A method of reading a file in buffered pieces (needed for HUGE files)
srim.srim module¶
Module for automating srim calculations
-
class
srim.srim.
SR
(layer, ion, **kwargs)¶ Bases:
object
Automate SR Calculations
Parameters: - leyer (
srim.core.layer.Layer
) – constructed layer for SR calculation - ion (
srim.core.ion.Ion
) – constructed ion for SR calculation - kwargs – See
srim.srim.SRSettings
for available SR options. There are a few and none are required. Defaults are appropriate for most cases.
-
run
(srim_directory='/tmp/srim')¶ Run configured srim calculation
- This method:
- writes the input file to
<srim_directory/SR Module/TRIM.IN
- launches
<srim_directory>/SR Module/SRModule.exe
. Useswine
if available (needed for linux and osx)
- writes the input file to
Parameters: srim_directory ( str
, optional) – path to srim directory.SRIM.exe
should be located in this directory. Default/tmp/srim
will absolutely need to be changed for windows.
- leyer (
-
class
srim.srim.
SRSettings
(**args)¶ Bases:
object
SR Settings
Parameters: - energy_min (
float
, optional) – lowest energy in [eV] to calculation range - output_type (
int
, optional) – specify units for output table (1) eV/Angstrom (2) keV/micron (3) MeV/mm (4) keV / (ug/cm2) (5) MeV / (mg/cm2) (6) keV / (mg/cm2) (7) eV / (1E15 atoms/cm2) (8) L.S.S reduced units - output_filename (
str
, optional) – filename to give for SR output from calcualtion - correction (
float
, optional) – Bragg rule correction. Usually no correction needed for heavy elements. Default 1.0 implies 100% of value (no change). 1.1 will increase by 10%.
Notes
This class should never explicitely created. Instead set as kwargs in
srim.srim.SR
- energy_min (
-
class
srim.srim.
TRIM
(target, ion, calculation=1, number_ions=1000, **kwargs)¶ Bases:
object
Automate TRIM Calculations
Parameters: - target (
srim.core.target.Target
) – constructed target for TRIM calculation - ion (
srim.core.ion.Ion
) – constructed ion for TRIM calculation - calculation (
int
, optional) – Default 1 quick KP calculation (1) Ion Distribution and Quick Calculation of Damage (quick KP) (2) Detailed Calculation with full Damage Cascades (full cascades) (3) Monolayer Collision Steps / Surface Sputtering (4) Ions with specific energy/angle/depth (quick KP damage) using TRIM.DAT (5) Ions with specific energy/angle/depth (full cascades) using TRIM.DAT (6) Recoil cascades from neutrons, etc. (full cascades) using TRIM.DAT (7) Recoil cascades and monolayer steps (full cascades) using TRIM.DAT (8) Recoil cascades from neutrons, etc. (quick KP damage) using TRIM.DAT - number_ions (
int
, optional) – number of ions that you want to simulate. Default 1000. A lot better than the 99999 default in TRIM… - kwargs – See
srim.srim.TRIMSettings
for available TRIM options. There are many and none are required defaults are appropriate for most cases.
Notes
If you are doing a simulation with over 1,000 ions it is recomended to split the calculaion into several smaller calculations. TRIM has been known to unexpectedly crash mainly due to memory usage.
-
static
copy_output_files
(src_directory, dest_directory, check_srim_output=True)¶ Copies known TRIM files in directory to destination directory
Parameters: - src_directory (
str
) – source directory to look for TRIM output files - dest_directory (
str
) – destination directory to copy TRIM output files to - check_srim_output (
bool
, optional) – ensure that all files exist
- src_directory (
-
run
(srim_directory='/tmp/srim')¶ Run configured srim calculation
- This method:
- writes the input file to
<srim_directory>/TRIM.IN
- launches
<srim_directory>/TRIM.exe
. Useswine
if available (needed for linux and osx)
- writes the input file to
Parameters: srim_directory ( str
, optional) – path to srim directory.SRIM.exe
should be located in this directory. Default/tmp/srim/
will absolutely need to change for windows.
- target (
-
class
srim.srim.
TRIMSettings
(**kwargs)¶ Bases:
object
TRIM Settings
This object can construct all options available when running a TRIM calculation.
Parameters: - description (
str
, optional) – A name to give calculation. Has no effect on the actual calculation. - reminders (
str
, optional) – TODO: could not find description. default 0 - autosave (
int
, optional) – save calculations after every autosave steps. default 0 will not autosave except at end - plot_mode (
int
, optional) – Default 5. (0) ion distribution with recoils projected on y-plane (1) ion distribution with recoils projected on z-plane (2) ion distribution without recoils projected on y-plane (3) transverse plot of ions + recoil cascades, yz-plane (4) all four (0-3) on one screen (5) no graphics (default and at least 5X faster than others) - plot_xmin (
float
, optional) – minimum x depth to plot only really matters ifplot_mode
between 0-4. Default 0.0. - plot_xmax (
float
, optional) – maximum x depth to plot only really matters ifplot_mode
between 0-4. Default 0.0. - ranges (
bool
, optional) – whether includeRANGES.txt
,RANGE_3D.txt
to output files. Default (0) False - backscattered (
bool
, optional) – whether includeBACKSCAT.txt
to output files. Default (0) False - transmit (
bool
, optional) – whether includeTRANSMIT.txt
to output files. Default (0) False - sputtered (
bool
, optional) – whether includeSPUTTER.txt
to output files. Default (0) False - collisions (
bool
, optional) – whether includeCOLLISON.txt
to output files. Yes they did mispell collisions. Default (0) False - exyz (int) – increment in eV to use for
EXYZ.txt
file. Default (0) - angle_ions (
float
, optional) – angle of incidence of the ion with respect to the target surface. Default (0) perpendicular to the target surface along x-axis. Values 0 - 89.9. - bragg_correction (
float
, optional) – bragg correction to stopping. Default (0) no correction - random_seed (
int
, optional) – a random seed to start calculation with. Default random integer between 0 and 100,000. Thus all calculations by default are random. - version (
int
, optional) – SRIM-2008 or SRIM-2008 so not really much choice. Default (0)
Notes
This class should never explicitely created. Instead set as kwargs in
srim.srim.TRIM
- description (