From 0214b220367a6c58fc950ec2d241e40797b27f8a Mon Sep 17 00:00:00 2001 From: yardasol Date: Thu, 1 Sep 2022 11:52:21 -0500 Subject: [PATCH] fix errorneous behavior when adding metastable nuclides via add_components --- openmc/material.py | 3 ++- tests/unit_tests/test_material.py | 1 + 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/openmc/material.py b/openmc/material.py index d9d4f241d..4a988c597 100644 --- a/openmc/material.py +++ b/openmc/material.py @@ -438,7 +438,8 @@ class Material(IDManagerMixin): params['percent_type'] = percent_type ## check if nuclide - if str.isdigit(component[-1]): + if str.isdigit(component[-1]) or (component[-1] == 'm' + and str.isdigit(component[-2])): self.add_nuclide(component, **params) else: # is element kwargs = params diff --git a/tests/unit_tests/test_material.py b/tests/unit_tests/test_material.py index 8bb881795..dde755231 100644 --- a/tests/unit_tests/test_material.py +++ b/tests/unit_tests/test_material.py @@ -32,6 +32,7 @@ def test_add_components(): 'O16': 1.0, 'Zr': 1.0, 'O': 1.0, + 'Ag110m': 1.0, 'U': {'percent': 1.0, 'enrichment': 4.5}, 'Li': {'percent': 1.0,