mirror of
https://github.com/openmc-dev/openmc.git
synced 2026-07-28 06:05:58 -04:00
Merge pull request #2392 from joshmay1/nuclide_determinism
Order nuclides deterministically when adding from elements
This commit is contained in:
commit
ed02703f4b
2 changed files with 5 additions and 5 deletions
|
|
@ -492,7 +492,7 @@ def isotopes(element):
|
|||
|
||||
# Get the nuclides present in nature
|
||||
result = []
|
||||
for kv in sorted(NATURAL_ABUNDANCE.items()):
|
||||
for kv in NATURAL_ABUNDANCE.items():
|
||||
if re.match(r'{}\d+'.format(element), kv[0]):
|
||||
result.append(kv)
|
||||
|
||||
|
|
|
|||
|
|
@ -4,7 +4,7 @@ from xml.etree import ElementTree as ET
|
|||
|
||||
import openmc.checkvalue as cv
|
||||
import openmc
|
||||
from openmc.data import NATURAL_ABUNDANCE, atomic_mass, \
|
||||
from openmc.data import NATURAL_ABUNDANCE, atomic_mass, zam, \
|
||||
isotopes as natural_isotopes
|
||||
|
||||
|
||||
|
|
@ -147,8 +147,8 @@ class Element(str):
|
|||
# and sort to avoid different ordering between Python 2 and 3.
|
||||
mutual_nuclides = natural_nuclides.intersection(library_nuclides)
|
||||
absent_nuclides = natural_nuclides.difference(mutual_nuclides)
|
||||
mutual_nuclides = sorted(list(mutual_nuclides))
|
||||
absent_nuclides = sorted(list(absent_nuclides))
|
||||
mutual_nuclides = sorted(mutual_nuclides, key=zam)
|
||||
absent_nuclides = sorted(absent_nuclides, key=zam)
|
||||
|
||||
# If all naturally occurring isotopes are present in the library,
|
||||
# add them based on their abundance
|
||||
|
|
@ -195,7 +195,7 @@ class Element(str):
|
|||
# If a cross_section library is not present, expand the element into
|
||||
# its natural nuclides
|
||||
else:
|
||||
for nuclide in natural_nuclides:
|
||||
for nuclide in sorted(natural_nuclides, key=zam):
|
||||
abundances[nuclide] = NATURAL_ABUNDANCE[nuclide]
|
||||
|
||||
# Modify mole fractions if enrichment provided
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue