12
12
from collections .abc import Mapping , Iterable
13
13
from numbers import Real , Integral
14
14
from warnings import warn
15
+ from typing import List
15
16
16
17
import lxml .etree as ET
17
18
import scipy .sparse as sp
@@ -244,6 +245,10 @@ class Chain:
244
245
Reactions that are tracked in the depletion chain
245
246
nuclide_dict : dict of str to int
246
247
Maps a nuclide name to an index in nuclides.
248
+ stable_nuclides : list of openmc.deplete.Nuclide
249
+ List of stable nuclides available in the chain.
250
+ unstable_nuclides : list of openmc.deplete.Nuclide
251
+ List of unstable nuclides available in the chain.
247
252
fission_yields : None or iterable of dict
248
253
List of effective fission yields for materials. Each dictionary
249
254
should be of the form ``{parent: {product: yield}}`` with
@@ -256,7 +261,7 @@ class Chain:
256
261
"""
257
262
258
263
def __init__ (self ):
259
- self .nuclides = []
264
+ self .nuclides : List [ Nuclide ] = []
260
265
self .reactions = []
261
266
self .nuclide_dict = {}
262
267
self ._fission_yields = None
@@ -272,7 +277,18 @@ def __len__(self):
272
277
"""Number of nuclides in chain."""
273
278
return len (self .nuclides )
274
279
275
- def add_nuclide (self , nuclide ):
280
+
281
+ @property
282
+ def stable_nuclides (self ) -> List [Nuclide ]:
283
+ """List of stable nuclides available in the chain"""
284
+ return [nuc for nuc in self .nuclides if nuc .half_life is None ]
285
+
286
+ @property
287
+ def unstable_nuclides (self ) -> List [Nuclide ]:
288
+ """List of unstable nuclides available in the chain"""
289
+ return [nuc for nuc in self .nuclides if nuc .half_life is not None ]
290
+
291
+ def add_nuclide (self , nuclide : Nuclide ):
276
292
"""Add a nuclide to the depletion chain
277
293
278
294
Parameters
0 commit comments