From ea6a0695441b3189329c275f6b5ad86e2a85bd8a Mon Sep 17 00:00:00 2001 From: Andrew Johnson Date: Wed, 22 Apr 2020 21:59:49 -0400 Subject: [PATCH] Don't write reaction targets that are None to XML This is related to a bug pointed out in the user's group, where writing a ReactionTuple with a None target errors. https://groups.google.com/forum/#!topic/openmc-users/jB_-zEKhF-k The condition appeared when the reaction was a non-fission (n, gamma), but the daughter isotope did not exist in the Chain, represented by None. This issue is resolved by skipping the target only if daughter is None, regardless of reaction. The Nuclide.from_xml can handle a missing target just as it handles a target of "Nothing" [case-insensitive] --- openmc/deplete/nuclide.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/openmc/deplete/nuclide.py b/openmc/deplete/nuclide.py index c7e05b235..7fb032aaa 100644 --- a/openmc/deplete/nuclide.py +++ b/openmc/deplete/nuclide.py @@ -243,7 +243,7 @@ class Nuclide: rx_elem = ET.SubElement(elem, 'reaction') rx_elem.set('type', rx) rx_elem.set('Q', str(Q)) - if rx != 'fission' or daughter is not None: + if daughter is not None: rx_elem.set('target', daughter) if br != 1.0: rx_elem.set('branching_ratio', str(br))