From 35c9f406b4ad2696ddc5230dd57ff1ebcb6e3e8b Mon Sep 17 00:00:00 2001 From: Sterling Harper Date: Fri, 6 Sep 2019 09:52:49 -0400 Subject: [PATCH] Address #1333 comment --- openmc/data/data.py | 7 ++++++- openmc/material.py | 2 -- 2 files changed, 6 insertions(+), 3 deletions(-) diff --git a/openmc/data/data.py b/openmc/data/data.py index b332344241..e813209f0a 100644 --- a/openmc/data/data.py +++ b/openmc/data/data.py @@ -358,7 +358,12 @@ def zam(name): symbol, A, state = _GND_NAME_RE.match(name).groups() except AttributeError: raise ValueError("'{}' does not appear to be a nuclide name in GND " - "format.".format(name)) + "format".format(name)) + + if symbol not in ATOMIC_NUMBER: + raise ValueError("'{}' is not a recognized element symbol" + .format(symbol)) + metastable = int(state[2:]) if state else 0 return (ATOMIC_NUMBER[symbol], int(A), metastable) diff --git a/openmc/material.py b/openmc/material.py index 1700055268..375e1dca1e 100644 --- a/openmc/material.py +++ b/openmc/material.py @@ -413,8 +413,6 @@ class Material(IDManagerMixin): Z, _, _ = openmc.data.zam(nuclide) except ValueError as e: warnings.warn(str(e)) - except KeyError as e: - warnings.warn(repr(e)) else: # For actinides, have the material be depletable by default if Z >= 89: