@@ -134,10 +134,11 @@ def _read_activation_products(evaluation):
134134 Returns
135135 -------
136136 dict
137- ``{mt: {(Z, A, lfs ): yield_func}}`` where yield_func is a
137+ ``{mt: {(Z, A, m ): yield_func}}`` where yield_func is a
138138 :class:`openmc.data.Tabulated1D` giving the yield as a function of
139- energy. lfs is the level number flag (0=ground, 1=first metastable,
140- etc.)
139+ energy. m is the isomeric state number (0=ground, 1=first metastable,
140+ etc.), derived by sequentially numbering the excited states in order
141+ of increasing LFS.
141142 """
142143 results = {}
143144
@@ -207,7 +208,22 @@ def _read_activation_products(evaluation):
207208 openmc .data .Tabulated1D (energy , yield_ )
208209
209210 if products :
210- results [mt ] = products
211+ # Remap LFS level numbers to sequential isomeric state numbers.
212+ # LFS in MF9/MF10 refers to the energy level, not the isomeric
213+ # state number. Isomeric states are numbered sequentially:
214+ # ground (LFS=0) -> m=0, then m=1, m=2, ... for excited states
215+ # in order of increasing LFS.
216+ za_groups : dict [tuple [int , int ], list [int ]] = {}
217+ for (Z , A , lfs ) in products :
218+ za_groups .setdefault ((Z , A ), []).append (lfs )
219+
220+ remapped = {}
221+ for (Z , A ), lfs_values in za_groups .items ():
222+ lfs_values .sort ()
223+ for m , lfs in enumerate (lfs_values ):
224+ remapped [(Z , A , m )] = products [(Z , A , lfs )]
225+
226+ results [mt ] = remapped
211227
212228 return results
213229
@@ -230,7 +246,7 @@ def _add_isomeric_reactions(nuclide, rx_name, q_value, iso_products,
230246 q_value : float
231247 Q value of the reaction in [eV]
232248 iso_products : dict
233- ``{(Z, A, lfs ): yield_func}`` from :func:`_read_activation_products`
249+ ``{(Z, A, m ): yield_func}`` from :func:`_read_activation_products`
234250 decay_data : dict
235251 Decay data keyed by nuclide name
236252 missing_rx_product : list
@@ -241,8 +257,8 @@ def _add_isomeric_reactions(nuclide, rx_name, q_value, iso_products,
241257 # Map product states to daughter names, filtering missing nuclides
242258 yield_funcs = {} # {daughter_name: yield_func}
243259 ground_state = None
244- for (Z , A , lfs ), yield_func in iso_products .items ():
245- daughter = gnds_name (Z , A , lfs )
260+ for (Z , A , m ), yield_func in iso_products .items ():
261+ daughter = gnds_name (Z , A , m )
246262
247263 if daughter not in decay_data :
248264 orig_daughter = daughter
@@ -251,15 +267,15 @@ def _add_isomeric_reactions(nuclide, rx_name, q_value, iso_products,
251267 missing_rx_product .append ((parent , rx_name , orig_daughter ))
252268 continue
253269
254- # If multiple LFS map to same daughter, keep the one with
270+ # If multiple states map to same daughter, keep the one with
255271 # larger max yield (shouldn't normally happen)
256272 if daughter in yield_funcs :
257273 if np .max (yield_func .y ) > np .max (yield_funcs [daughter ].y ):
258274 yield_funcs [daughter ] = yield_func
259275 else :
260276 yield_funcs [daughter ] = yield_func
261277
262- if lfs == 0 :
278+ if m == 0 :
263279 ground_state = daughter
264280
265281 if not yield_funcs :
0 commit comments