mirror of
https://github.com/openmc-dev/openmc.git
synced 2026-07-26 21:25:36 -04:00
Even more elegant error check on element names
This commit is contained in:
parent
d9b2c4dccc
commit
70b2f968f8
1 changed files with 2 additions and 3 deletions
|
|
@ -530,9 +530,8 @@ class Material(IDManagerMixin):
|
|||
# Allow for element identifier to be given as a symbol or name
|
||||
if len(element)>2:
|
||||
el = element.lower()
|
||||
if el in openmc.data.ELEMENT_SYMBOL:
|
||||
element = openmc.data.ELEMENT_SYMBOL[el]
|
||||
else:
|
||||
element = openmc.data.ELEMENT_SYMBOL.get(el)
|
||||
if element is None:
|
||||
msg = 'Element name "{}" not recognised'.format(el)
|
||||
raise ValueError(msg)
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue