irradiapy.srim.py2srim module
This module contains the Py2SRIM class.
- class irradiapy.srim.py2srim.Py2SRIM(seed=0, srim_dir=<factory>, wineprefix=<factory>, wine_cmd=<factory>, check_interval=0.2, minimize_window=False, plot_type=5, xmin=0.0, xmax=0.0, do_ranges=1, do_backscatt=1, do_transmit=1, do_sputtered=1, do_collisions=1, exyz=0.0, autosave=0)[source]
Bases:
objectBase class for running SRIM calculations from Python.
- Variables:
seed (int (default=0)) – Seed for SRIM randomness.
root_dir (Path) – Root directory where all calculations will be stored.
calculation (str) – SRIM calculation.
srim_dir (Path (default=config.get_srim_dir())) – Directory where SRIM is installed.
wineprefix (Path (default=Path(os.environ.get("WINEPREFIX", Path.home() / ".wine-srim2013")))) – Wine prefix to use for running SRIM on Linux. By default, it uses the WINEPREFIX environment variable if set, or ~/.wine-srim2013 otherwise.
wine_cmd (str (default=os.environ.get("WINE", "wine"))) – Command to run Wine on Linux. By default, it uses the WINE environment variable if set, or wine otherwise.
recoilsdb (RecoilsDB) – Database to store all recoils collected from SPECTRA-PKA and SRIM calculations.
check_interval (float (default=0.2)) – Interval to check for SRIM window/popups.
minimize_window (bool (default=False)) – Whether to minimize the SRIM/TRIM window while calculations run.
plot_type (int (default=5)) – Plot type during SRIM calculations. 5 for no plots (faster calculations).
xmin (float (default=0.0)) – Minimum x for plots and depth-dependent means during SRIM calculations. Particularly important for large targets, since SRIM divides it in 100 segments.
xmax (float (default=0.0)) – Maximum x for plots and depth-dependent means during SRIM calculations. Particularly important for large targets, since SRIM divides it in 100 segments. 0.0 for full target.
do_ranges (int (default=1)) – Whether to save RANGE.txt file. Disabling this might cause errors afterwards because of missing tables.
do_backscatt (int (default=1)) – Whether to save BACKSCAT.txt file. Disabling this might cause errors afterwards because of missing tables.
do_transmit (int (default=1)) – Whether to save TRANSMIT.txt file. Disabling this might cause errors afterwards because of missing tables.
do_sputtered (int (default=1)) – Whether to save SPUTTER.txt file. Disabling this might cause errors afterwards because of missing tables.
do_collisions (int (default=1)) – Whether to save COLLISON.txt file. Disabling this might cause errors afterwards because of missing tables.
exyz (float (default=0.0)) – Whether to save ions position every time they loose exyz energy in the EXYZ.txt file.
autosave (int (default=0)) – Autosave every this number of ions. 0 to disable.
- run(root_dir, target, calculation, atomic_numbers, energies, depths, ys, zs, cosxs, cosys, coszs, max_energy_rel, max_srim_iters, fail_on_transmit, fail_on_backscatt, fp_energy_abs=1000.0, ignore_32bit_warning=True, minimize_window=None)[source]
Run SRIM iteratively, creating a folder tree driven by a recoil-energy threshold.
Group ions by atomic number, keeping only those that should be sent to SRIM.
Create a directory tree under
root_dirwhere each branch holds asrim.dbfile.Run SRIM once per branch.
Recursively spawn new SRIM runs for recoils from the
collisiontable whose energy is above the relative maximum of their matching MD debris datasets.Stop at depth
max_srim_iters. Depth islen(tree); for example,(26, 76, 26)has depth 3.
- Parameters:
root_dir (
Path) – Root directory where all calculations will be stored.calculation (
str) – SRIM calculation.atomic_numbers (
GenericAlias[int_]) – Ion atomic numbers.energies (
GenericAlias[double]) – Ion energies.depths (
GenericAlias[double]) – Ion initial depths.ys (
GenericAlias[double]) – Ion initial y positions.zs (
GenericAlias[double]) – Ion initial z positions.cosxs (
GenericAlias[double]) – Ion initial x directions.cosys (
GenericAlias[double]) – Ion initial y directions.coszs (
GenericAlias[double]) – Ion initial z directions.max_energy_rel (
float) – Relative recoil energy threshold for matching MD debris datasets. Recoils abovemax_dataset_energy * max_energy_relspawn further SRIM branches, wheremax_dataset_energyis the highest recoil energy available in the matching dataset data. Must be at least 1.0.max_srim_iters (
int) – Maximum number of SRIM iterations.fail_on_transmit (
bool) – If True, raise if any ion is transmitted (TRANSMIT.txt non-empty).fail_on_backscatt (
bool) – If True, raise if any ion is backscattered (BACKSCAT.txt non-empty).fp_energy_abs (
float) – Absolute recoil energy below which unmatched recoils are represented by Frenkel pairs instead of being sent to SRIM, in eV.ignore_32bit_warning (
bool) – Whether to ignore the 32-bit warning when using 32-bit SRIM with 64-bit Python.minimize_window (
bool|None) – Whether to minimize the SRIM/TRIM window while calculations run. If None, use the instance-levelminimize_windowsetting. The default instance setting is False.
- Returns:
Database with all recoils collected.
- Return type: