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]
This commit is contained in:
Andrew Johnson 2020-04-22 21:59:49 -04:00
parent 173c85c2cb
commit ea6a069544
No known key found for this signature in database
GPG key ID: 253418E91B7F6FEB

View file

@ -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))