diff --git a/openmc/data/data.py b/openmc/data/data.py index 361aa6457b..fcdafede7e 100644 --- a/openmc/data/data.py +++ b/openmc/data/data.py @@ -223,19 +223,19 @@ def atomic_mass(isotope): """ if not _ATOMIC_MASS: - # Load data from AME2016 file + # Load data from AME2020 file, Note format change to AME2016 mass_file = os.path.join(os.path.dirname(__file__), 'mass_1.mas20.txt') with open(mass_file, 'r') as ame: - # Read lines in file starting at line 40 - for line in itertools.islice(ame, 39, None): + # Read lines in file starting at line 37 + for line in itertools.islice(ame, 36, None): name = f'{line[20:22].strip()}{int(line[16:19])}' - mass = float(line[96:99]) + 1e-6*float( - line[100:106] + '.' + line[107:112]) + mass = float(line[106:109]) + 1e-6*float( + line[110:116] + '.' + line[117:123]) _ATOMIC_MASS[name.lower()] = mass # For isotopes found in some libraries that represent all natural # isotopes of their element (e.g. C0), calculate the atomic mass as - # the sum of the atomic mass times the natural abudance of the isotopes + # the sum of the atomic mass times the natural abundance of the isotopes # that make up the element. for element in ['C', 'Zn', 'Pt', 'Os', 'Tl']: isotope_zero = element.lower() + '0' diff --git a/tests/unit_tests/test_data_misc.py b/tests/unit_tests/test_data_misc.py index c3f7e3cfff..37e024fe23 100644 --- a/tests/unit_tests/test_data_misc.py +++ b/tests/unit_tests/test_data_misc.py @@ -76,15 +76,17 @@ def test_thin(): def test_atomic_mass(): - assert openmc.data.atomic_mass('H1') == 1.00782503224 - assert openmc.data.atomic_mass('U235') == 235.04392819 + assert openmc.data.atomic_mass('H1') == 1.007825031898 + assert openmc.data.atomic_mass('U235') == 235.043928117 + assert openmc.data.atomic_mass('Li6') == 6.01512288742 + assert openmc.data.atomic_mass('Pb220') == 220.025905 with pytest.raises(KeyError): openmc.data.atomic_mass('U100') def test_atomic_weight(): - assert openmc.data.atomic_weight('C') == 12.011115164864455 - assert openmc.data.atomic_weight('carbon') == 12.011115164864455 + assert openmc.data.atomic_weight('C') == 12.011115164865895 + assert openmc.data.atomic_weight('carbon') == 12.011115164865895 with pytest.raises(ValueError): openmc.data.atomic_weight('Qt')