From 2dbb0c7523c535f8a3f202609ad820cef54556c0 Mon Sep 17 00:00:00 2001 From: Jonathan Shimwell Date: Fri, 27 Jan 2023 14:26:56 +0000 Subject: [PATCH 1/2] allowing materials.xml to be specified --- openmc/deplete/results.py | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/openmc/deplete/results.py b/openmc/deplete/results.py index 9552a6ba6..b8b383a0e 100644 --- a/openmc/deplete/results.py +++ b/openmc/deplete/results.py @@ -375,7 +375,8 @@ class Results(list): def export_to_materials( self, burnup_index: int, - nuc_with_data: Optional[Iterable[str]] = None + nuc_with_data: Optional[Iterable[str]] = None, + path: PathLike = 'materials.xml' ) -> Materials: """Return openmc.Materials object based on results at a given step @@ -394,6 +395,8 @@ class Results(list): If not provided, nuclides from the cross_sections element of materials.xml will be used. If that element is not present, nuclides from openmc.config['cross_sections'] will be used. + path : PathLike + Path to file to write. Defaults to 'materials.xml'. Returns ------- @@ -407,7 +410,7 @@ class Results(list): # updated. If for some reason you have modified OpenMC to produce # new materials as depletion takes place, this method will not # work as expected and leave out that material. - mat_file = Materials.from_xml("materials.xml") + mat_file = Materials.from_xml(path) # Only nuclides with valid transport data will be written to # the new materials XML file. The precedence of nuclides to select From 60f33d460736e3d22ed7eae633fd7a38cbd48984 Mon Sep 17 00:00:00 2001 From: Jonathan Shimwell Date: Sat, 28 Jan 2023 17:18:35 +0000 Subject: [PATCH 2/2] Review improvement from @paulromano --- openmc/deplete/results.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/openmc/deplete/results.py b/openmc/deplete/results.py index b8b383a0e..3602d6918 100644 --- a/openmc/deplete/results.py +++ b/openmc/deplete/results.py @@ -396,7 +396,7 @@ class Results(list): materials.xml will be used. If that element is not present, nuclides from openmc.config['cross_sections'] will be used. path : PathLike - Path to file to write. Defaults to 'materials.xml'. + Path to materials XML file to read. Defaults to 'materials.xml'. Returns -------