Materials Sub-Module

Materials utilities module

pyPenred.simulation.materials.create(name: str, density: SupportsFloat, composition: Sequence[tuple[SupportsInt, SupportsFloat]], filename: str = '') None

creates a material file based on the provided weight fraction composition. The composition should be given as a list of tuples with atomic number and weight fraction.

Parameters:
  • name (str) – Name assigned to the material.

  • density (float) – Material density in g/cm^3.

  • composition (list of tuple) – Material composition list. Each element consists of a 2D tuple with the corresponding element atomic number (Z) and weight fraction. For example, [(Z1, weight1), (Z2, weight2), …].

  • filename (str, optional) – File name for the generated material. If empty, it defaults to ‘${name}.mat’.

Returns:

None

pyPenred.simulation.materials.createListed(matID: SupportsInt, filename: str = '') None

Creates a material file from the PENELOPE predefined material list.

Parameters:
  • matID (int) – Material numerical identifier. The complete list can be found in the ‘Predefined Materials’ appendix within the penred documentation.

  • filename (str) – File name for the generated material.

Returns:

None

pyPenred.simulation.materials.mutren(energies: Sequence[SupportsFloat], density: SupportsFloat, composition: Sequence[tuple[SupportsInt, SupportsFloat]], tolerance: SupportsFloat = 0.1, simTime: SupportsFloat = 30) tuple

Calculates the mu_en coefficients for the given material composition at specified energies.

Parameters:
  • energies (list[float]) – Array of energies, in eV.

  • density (float) – Material density in g/cm^3.

  • composition (list of tuple) – Material composition list. Each element consists of a 2D tuple with the corresponding element atomic number (Z) and weight fraction. For example, [(Z1, weight1), (Z2, weight2), …].

  • tolerance (float, optional) – Relative error to stop the simulation.

  • simTime (float, optional) – Allowed time (in seconds) to simulate each provided energy.

Returns:

A tuple with the muen coefficients for the specified material corresponding to the input energies.

For example, for a energy array provided with E1, E2, …, En, returns: (muen(E1), muen(E2), …, muen(En))

Return type:

tuple

Example

# Run the simulation and store the results
results = pyPenred.simulation.materials.mutren(energies=muenE, density=1.0, composition=((1,0.112), (8,0.888)), tolerance=0.1, simTime=30)
pyPenred.simulation.materials.mutrenFromFile(energies: Sequence[SupportsFloat], filename: str, tolerance: SupportsFloat = 0.1, simTime: SupportsFloat = 30) tuple

Calculates the mu_en coefficients for a given material file at specified energies.

Parameters:
  • energies (list[float]) – Array of energies, in eV.

  • filename (str) – Path to the material definition file.

  • tolerance (float, optional) – Relative error to stop the simulation.

  • simTime (float, optional) – Allowed time (in seconds) to simulate each provided energy.

Returns:

A tuple with the muen coefficients for the specified material corresponding to the input energies.

For example, for a energy array provided with E1, E2, …, En, returns: (muen(E1), muen(E2), …, muen(En))

Return type:

tuple

Example

# Run the simulation and store the results
results = pyPenred.simulation.materials.mutrenFromFile(energies=muenE, filename=water.mat, tolerance=0.1, simTime=30)
pyPenred.simulation.materials.mutrenInterval(density: SupportsFloat, composition: Sequence[tuple[SupportsInt, SupportsFloat]], emin: SupportsFloat = 50.0, emax: SupportsFloat = 1000000000.0, ebins: SupportsInt = 100, tolerance: SupportsFloat = 0.1, simTime: SupportsFloat = 30) tuple

Calculates the mu_en coefficients for the specified material composition across a defined energy interval.

Parameters:
  • density (float) – Material density in g/cm^3.

  • composition (list of tuple) – Material composition list. Each element consists of a 2D tuple with the corresponding element atomic number (Z) and weight fraction. For example, [(Z1, weight1), (Z2, weight2), …].

  • emin (float, optional) – Lower bound of energy range in eV.

  • emax (float, optional) – Upper bound of energy range in eV.

  • ebins (unsigned, optional) – Number of linear-spaced energy bins between emin and emax.

  • tolerance (float, optional) – Relative error to stop the simulation.

  • simTime (float, optional) – Allowed time (in seconds) to simulate each provided energy.

Returns:

A tuple containing two tuples: The first with the energy bins and the second with the muen coefficients for the specified material.

Return type:

tuple

Example

# Run the simulation and store the results
results = pyPenred.simulation.materials.mutrenInterval(density=1.0, composition=((1,0.112), (8,0.888)), emin=100e3, emax=200e3, ebins=120, tolerance=0.1, simTime=30)
pyPenred.simulation.materials.range(energies: Sequence[SupportsFloat], density: SupportsFloat, composition: Sequence[tuple[SupportsInt, SupportsFloat]], verbose: SupportsInt = 1) tuple

Calculates the particle ranges (in cm) for a given material composition at specified energies.

Parameters:
  • energies (double) – List of energies, in eV, at which to calculate particle ranges.

  • density (float) – Material density in g/cm^3.

  • composition (list of tuple) – Material composition list. Each element consists of a 2D tuple with the corresponding element atomic number (Z) and weight fraction. For example, [(Z1, weight1), (Z2, weight2), …].

  • verbose (int, optional) – Verbosity level.

Returns:

A tuple containing the n tuples (one for each particle type), where each inner tuple contains the ranges, in cm, for all input energies. The order is: ((electron ranges), (gamma ranges), (positron ranges))

Return type:

tuple

Example

# Run the simulation and store the results
results = pyPenred.simulation.materials.range(energies=[100e3, 200e3, 50e3], density=1.0, composition=((1,0.112), (8,0.888)), verbose=1)
pyPenred.simulation.materials.rangeFromFile(energies: Sequence[SupportsFloat], filename: str, verbose: SupportsInt = 1) tuple

Calculates the particle ranges (in cm) for a given material file at specified energies.

Parameters:
  • energies (double) – List of energies, in eV, at which to calculate particle ranges.

  • filename (str) – Path to the material definition file.

  • verbose (int, optional) – Verbosity level.

Returns:

A tuple containing the n tuples (one for each particle type), where each inner tuple contains the ranges, in cm, for all input energies. The order is: ((electron ranges), (gamma ranges), (positron ranges))

Return type:

tuple

Example

# Run the simulation and store the results
results = pyPenred.simulation.materials.rangeFromFile(energies=[100e3, 200e3, 50e3], filename=water.mat, verbose=1)