irradiapy.lammps.cascadebase module

Base class for running LAMMPS simulations of collisional cascades.

class irradiapy.lammps.cascadebase.CascadeBase(*, comm=<factory>, dir_parent, nsims, cmds_preamble, cmds_therma=None, atomic_symbols, cmds_cascade=None, cmds_rerun=None, seed=1, finalize=True, skip=<factory>, uttm_nxyz=None, uttm_extent=None)[source]

Bases: ABC

Base class for running LAMMPS simulations of collisional cascades. Not to be used directly.

Warning

In order to use child classes: - Do not use “write_data” or “write_restart”, these are created automatically. - Include in the “thermo” output: step, dt, time. - In the dump command, place only the file name, the path will be added automatically.

Parameters:
  • comm (Comm) – The MPI communicator.

  • dir_parent (Path) – The parent directory for the simulation.

  • nsims (int) – The number of simulations to run.

  • cmds_preamble (list[Command]) – The preamble commands to run before the simulation. These commands are run before any thermalisation, run, and rerun.

  • cmds_therma (list[Command] | None) – The commands to run for the thermalization step.

  • cmds_cascade (list[Command] | None) – The commands to run for the cascade step.

  • cmds_rerun (list[Command] | None) – The commands to run for the rerun step.

  • atomic_symbols (list[str]) – The atomic symbols of the atoms in the simulation in the same order as the atom types in LAMMPS.

  • seed (int) – The random seed for the simulation.

  • finalize (bool) – If True, after all simulations, the LAMMPS instance is finalized.

  • skip (str | list[int]) – A string of comma-separated integers and ranges to skip simulations. For example, “1, 2, 3-5, 7-9” will skip simulations 1, 2, 3, 4, 5, 7, 8, and 9.

  • uttm_c (float (default=None)) – Only for UTTM calculations. The UTTM electron heat capacity in eV/K.

  • uttm_k (float (default=None)) – Only for UTTM calculations. The UTTM electron thermal conductivity in W/(m*K).

  • uttm_temperature (float (default=None)) – Only for UTTM calculations. The UTTM electron temperature in K.

  • uttm_nxyz (tuple[int, int, int] | None) – Only for UTTM calculations. The number of grid voxels in the x, y, and z directions.

  • uttm_extent (tuple[float, float, float, float, float, float] | None) – Only for UTTM calculations. The extent of the grid in the x, y, and z directions.

atomic_symbols: list[str]
cmds_cascade: list[Command] | None = None
cmds_preamble: list[Command]
cmds_rerun: list[Command] | None = None
cmds_therma: list[Command] | None = None
comm: Comm
dir_parent: Path
exec_cmds(lmp, cmds)[source]

Executes a list of commands.

Parameters:

cmds (list[Command]) – The commands to execute

Return type:

None

finalize: bool = True
get_pka_properties(path_log)[source]

Returns the properties of the PKA from a LAMMPS log file.

Parameters:

path_log (Path) – The path to the log file.

Returns:

The PKA properties.

Return type:

dict[str, int | float | ndarray]

get_pkas_properties()[source]

Returns the properties of the PKAs from a set of LAMMPS log files.

Yields:

dict[str, int | float | np.ndarray] – The PKA properties.

get_simulation_dirs()[source]

Returns the simulation directories.

Returns:

The simulation directories.

Return type:

list[Path]

nsims: int
path_log_cwd: Path
rank: int
abstractmethod run()[source]

Runs the cascade simulation.

Return type:

None

seed: int = 1
skip: str | list[int]
types_to_atomic_numbers(types)[source]

Converts atom types to atomic numbers.

Parameters:

types (ndarray) – The atom types.

Returns:

The atomic numbers.

Return type:

ndarray

uttm_c: float | None = None
uttm_extent: tuple[float, float, float, float, float, float] | None = None
uttm_k: float | None = None
uttm_nxyz: tuple[int, int, int] | None = None
uttm_temperature: float | None = None