From d9b2c4dcccd222cddc3ac7d556a9f35ee6cbfd81 Mon Sep 17 00:00:00 2001 From: Paul Cosgrove Date: Thu, 27 Feb 2020 12:44:58 +0000 Subject: [PATCH] Requested changes for PR Modified data.py to align with OpenMC Python convention, added more elegant check for element names --- openmc/data/data.py | 1 + openmc/material.py | 5 +++-- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/openmc/data/data.py b/openmc/data/data.py index e34ab8d46..b2ab9462a 100644 --- a/openmc/data/data.py +++ b/openmc/data/data.py @@ -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 diff --git a/openmc/material.py b/openmc/material.py index 542ed9028..2bb461b02 100644 --- a/openmc/material.py +++ b/openmc/material.py @@ -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)