- class openmc.Materials(materials=None)¶
Collection of Materials used for an OpenMC simulation.
This class corresponds directly to the materials.xml input file. It can be thought of as a normal Python list where each member is a
Material. It behaves like a list as the following example demonstrates:
>>> fuel = openmc.Material() >>> clad = openmc.Material() >>> water = openmc.Material() >>> m = openmc.Materials([fuel]) >>> m.append(water) >>> m += [clad]
materials (Iterable of openmc.Material) – Materials to add to the collection
cross_sections (str or path-like) – Indicates the path to an XML cross section listing file (usually named cross_sections.xml). If it is not set, the
OPENMC_CROSS_SECTIONSenvironment variable will be used for continuous-energy calculations and
OPENMC_MG_CROSS_SECTIONSwill be used for multi-group calculations to find the path to the HDF5 cross section file.
Append material to collection
material (openmc.Material) – Material to append
- export_to_xml(path: Union[str, PathLike] = 'materials.xml')¶
Export material collection to an XML file.
path (str) – Path to file to write. Defaults to ‘materials.xml’.
- classmethod from_xml(path: Union[str, PathLike] = 'materials.xml')¶
Generate materials collection from XML file