From aeb1052c1907e4d12890fcbbc2bb53ee3c737aa3 Mon Sep 17 00:00:00 2001 From: John Tramm Date: Thu, 12 Jun 2025 19:54:35 -0500 Subject: [PATCH] Fix Resetting of Auto IDs When Generating MGXS (#3437) --- openmc/model/model.py | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) diff --git a/openmc/model/model.py b/openmc/model/model.py index c19c8ac9f..7e679d10a 100644 --- a/openmc/model/model.py +++ b/openmc/model/model.py @@ -1552,7 +1552,6 @@ class Model: "if a material has a k-infinity > 1.0.") mgxs_sets = [] for material in self.materials: - openmc.reset_auto_ids() model = openmc.Model() # Set materials on the model @@ -1749,7 +1748,6 @@ class Model: directory : str Directory to run the simulation in, so as to contain XML files. """ - openmc.reset_auto_ids() model = openmc.Model() model.materials = self.materials @@ -1861,7 +1859,6 @@ class Model: directory : PathLike Directory to run the simulation in, so as to contain XML files. """ - openmc.reset_auto_ids() model = copy.deepcopy(self) model.tallies = openmc.Tallies() @@ -1973,7 +1970,7 @@ class Model: # Make sure all materials have a name, and that the name is a valid HDF5 # dataset name for material in self.materials: - if material.name is None: + if not material.name or not material.name.strip(): material.name = f"material {material.id}" material.name = re.sub(r'[^a-zA-Z0-9]', '_', material.name)