Requested changes for PR

Modified data.py to align with OpenMC Python convention,
added more elegant check for element names
This commit is contained in:
Paul Cosgrove 2020-02-27 12:44:58 +00:00
parent bf7f7327a5
commit d9b2c4dccc
2 changed files with 4 additions and 2 deletions

View file

@ -4,6 +4,7 @@ import os
import re
from warnings import warn
# Isotopic abundances from Meija J, Coplen T B, et al, "Isotopic compositions
# of the elements 2013 (IUPAC Technical Report)", Pure. Appl. Chem. 88 (3),
# pp. 293-306 (2013). The "representative isotopic abundance" values from

View file

@ -530,8 +530,9 @@ class Material(IDManagerMixin):
# Allow for element identifier to be given as a symbol or name
if len(element)>2:
el = element.lower()
element = openmc.data.ELEMENT_SYMBOL.get(el,"empty")
if element == "empty":
if el in openmc.data.ELEMENT_SYMBOL:
element = openmc.data.ELEMENT_SYMBOL[el]
else:
msg = 'Element name "{}" not recognised'.format(el)
raise ValueError(msg)