From bea3e07fea0e3e5b74fced43a3cd6da7ea7f7608 Mon Sep 17 00:00:00 2001 From: Paul Romano Date: Wed, 15 Apr 2020 06:51:00 -0500 Subject: [PATCH] Changes in data/reaction.py from PullRequest Inc. review --- openmc/data/neutron.py | 4 ++-- openmc/data/reaction.py | 12 +++++++----- openmc/deplete/chain.py | 2 +- 3 files changed, 10 insertions(+), 8 deletions(-) diff --git a/openmc/data/neutron.py b/openmc/data/neutron.py index 06ba86f4d..4b6693853 100644 --- a/openmc/data/neutron.py +++ b/openmc/data/neutron.py @@ -20,7 +20,7 @@ from .function import Tabulated1D, Sum, ResonancesWithBackground from .grid import linearize, thin from .njoy import make_ace from .product import Product -from .reaction import Reaction, _get_photon_products_ace +from .reaction import Reaction, _get_photon_products_ace, FISSION_MTS from . import resonance as res from . import resonance_covariance as res_cov from .urr import ProbabilityTables @@ -543,7 +543,7 @@ class IncidentNeutron(EqualityMixin): data.reactions[rx.mt] = rx # Read total nu data if available - if rx.mt in (18, 19, 20, 21, 38) and 'total_nu' in group: + if rx.mt in FISSION_MTS and 'total_nu' in group: tgroup = group['total_nu'] rx.derived_products.append(Product.from_hdf5(tgroup)) diff --git a/openmc/data/reaction.py b/openmc/data/reaction.py index 2283b084a..2e88021ec 100644 --- a/openmc/data/reaction.py +++ b/openmc/data/reaction.py @@ -64,6 +64,8 @@ REACTION_NAME.update({i: '(n,3He{})'.format(i - 750) for i in range(750, 799)}) REACTION_NAME.update({i: '(n,a{})'.format(i - 800) for i in range(800, 849)}) REACTION_NAME.update({i: '(n,2n{})'.format(i - 875) for i in range(875, 891)}) +FISSION_MTS = (18, 19, 20, 21, 38) + def _get_products(ev, mt): """Generate products from MF=6 in an ENDF evaluation @@ -492,7 +494,7 @@ def _get_activation_products(ev, rx): # Determine if file 9/10 are present present = {9: False, 10: False} - for i in range(n_states): + for _ in range(n_states): if decay_sublib: items = get_cont_record(file_obj) else: @@ -1021,7 +1023,7 @@ class Reaction(EqualityMixin): neutron.yield_ = yield_ rx.products.append(neutron) else: - assert mt in (18, 19, 20, 21, 38) + assert mt in FISSION_MTS rx.products, rx.derived_products = _get_fission_products_ace(ace) for p in rx.products: @@ -1126,13 +1128,13 @@ class Reaction(EqualityMixin): # Get fission product yields (nu) as well as delayed neutron energy # distributions - if mt in (18, 19, 20, 21, 38): + if mt in FISSION_MTS: rx.products, rx.derived_products = _get_fission_products_endf(ev) if (6, mt) in ev.section: # Product angle-energy distribution for product in _get_products(ev, mt): - if mt in (18, 19, 20, 21, 38) and product.particle == 'neutron': + if mt in FISSION_MTS and product.particle == 'neutron': rx.products[0].applicability = product.applicability rx.products[0].distribution = product.distribution else: @@ -1177,7 +1179,7 @@ class Reaction(EqualityMixin): for dist in neutron.distribution: dist.angle = AngleDistribution.from_endf(ev, mt) - if mt in (18, 19, 20, 21, 38) and (5, mt) in ev.section: + if mt in FISSION_MTS and (5, mt) in ev.section: # For fission reactions, rx.products[0].applicability = neutron.applicability rx.products[0].distribution = neutron.distribution diff --git a/openmc/deplete/chain.py b/openmc/deplete/chain.py index 775ef2169..b78590bc2 100644 --- a/openmc/deplete/chain.py +++ b/openmc/deplete/chain.py @@ -316,7 +316,7 @@ class Chain: nuclide.reactions.append(ReactionTuple( name, daughter, q_value, 1.0)) - if any(mt in reactions_available for mt in [18, 19, 20, 21, 38]): + if any(mt in reactions_available for mt in openmc.data.FISSION_MTS): if parent in fpy_data: q_value = reactions[parent][18] nuclide.reactions.append(