def create_material(material_tag: str, material_entry):
if isinstance(material_entry, str):
openmc_material = nmm.Material.from_library(
name=material_entry, material_id=None
).openmc_material
elif isinstance(material_entry, openmc.Material):
# sets the material name in the event that it had not been set
openmc_material = material_entry
elif isinstance(material_entry, (nmm.Material)):
# sets the material tag in the event that it had not been set
openmc_material = material_entry.openmc_material
else:
raise TypeError(
"materials must be either a str, \
openmc.Material, nmm.MultiMaterial or nmm.Material object \
not a ",
type(material_entry),
material_entry,
)
openmc_material.name = material_tag
return openmc_material
I find it more intuitive if it's just
def create_material(material_entry):
if isinstance(material_entry, str):
openmc_material = nmm.Material.from_library(
name=material_entry, material_id=None
).openmc_material
elif isinstance(material_entry, openmc.Material):
# sets the material name in the event that it had not been set
openmc_material = material_entry
elif isinstance(material_entry, (nmm.Material)):
# sets the material tag in the event that it had not been set
openmc_material = material_entry.openmc_material
else:
raise TypeError(
"materials must be either a str, \
openmc.Material, nmm.MultiMaterial or nmm.Material object \
not a ",
type(material_entry),
material_entry,
)
return openmc_material
and the name of the material is assigned in odw.Materials.set_openmc_materials
I find it more intuitive if it's just
and the name of the material is assigned in
odw.Materials.set_openmc_materials