f4enix.input.materials.SubMaterial#

class f4enix.input.materials.SubMaterial(name: str, zaidList: list[Zaid], elemList: list[Element] | None = None, header: str | None = None, additional_keys: list[str] | None = None)#

Bases: object

Generate a SubMaterial Object starting from a list of Zaid and eventually Elements list. Usually this kind of objects are generated directly reading a full material card, and rarely instanciated directly with the __init__ method.

Parameters:
  • name (str) – if the first submaterial, the name is the name of the material (e.g. m1).

  • zaidList (list[Zaid]) – list of zaids composing the submaterial.

  • elemList (list[Element], optional) – list of elements composing the submaterial. The default is None.

  • header (str, optional) – Header of the submaterial. The default is None.

  • additional_keys (list[str], optional) – list of additional keywords in the submaterial. The default is None.

Return type:

None.

Variables:
  • zaidList (list[Zaid]) – list of zaids in the sub-material

  • elements (list[Element]) – list of elements in the sub-material

  • header (str) – comment in the MCNP input file that is the header of the submat

  • additional_keys (list[str]) – list of additional keys that may be part of the material

Methods

__init__(name, zaidList[, elemList, header, ...])

Generate a SubMaterial Object starting from a list of Zaid and eventually Elements list.

from_text(text)

Generate a submaterial from MCNP input text

get_info(lib_manager)

Returns DataFrame containing the different fractions of the elements and zaids

scale_fractions(norm_factor)

Scale the zaids fractions using a normalizing factor

to_text()

Write to text in MNCP format the submaterial

to_xml(libmanager, material)

Generate XML content for a material and add it to a material tree.

translate(newlib, lib_manager[, code])

This method implements the translation logic of JADE.

classmethod from_text(text: str) SubMaterial#

Generate a submaterial from MCNP input text

Parameters:

text (list[str]) – Original text of the MCNP input.

Returns:

generated submaterial.

Return type:

SubMaterial

get_info(lib_manager: LibManager) tuple[DataFrame, DataFrame]#

Returns DataFrame containing the different fractions of the elements and zaids

Parameters:

lib_manager (libmanager.LibManager) – Library manager for the conversion.

Returns:

  • df_el (pd.DataFrame) – table of information of the submaterial on an elemental level.

  • df_zaids (pd.DataFrame) – table of information of the submaterial on a zaid level.

scale_fractions(norm_factor: float) None#

Scale the zaids fractions using a normalizing factor

Parameters:

norm_factor (float) – scaling factor.

Return type:

None.

to_text() str#

Write to text in MNCP format the submaterial

Returns:

formatted submaterial text.

Return type:

str

to_xml(libmanager: LibManager, material: Material) None#

Generate XML content for a material and add it to a material tree.

Parameters:
  • libmanager – libmanager handling the libraries operations.

  • material – The XML tree where the material content will be added.

translate(newlib: dict | str, lib_manager: LibManager, code: str = 'mcnp') None#

This method implements the translation logic of JADE. All zaids are translated accordingly to the newlib specified.

Parameters:
  • newlib (dict | str) –

    There are a few ways that newlib can be provided:

    1) str (e.g. 31c), the new library to translate to will be the one indicated;

    2) dic (e.g. {‘98c’ : ‘99c’, ‘31c: 32c’}), the new library is determined based on the old library of the zaid

    3) dic (e.g. {‘98c’: [list of zaids], ‘31c’: [list of zaids]}), the new library to be used is explicitly stated depending on the zaidnum.

  • lib_manager (LibManager) – Object handling libraries operation.

Return type:

None.