problem in chain.export_to_xml

Hello all,

I was trying to use the reduce method. i can see the reduction in number of nucides if i print nuclide_dict. when i try to export the reduced chain to xml i get an error.

I thought i might be doing something wrong in reduction so i tried to copy depletion chain from xml file and try to export it to a new file. I get the same error again.

The code i am using is shown here.

chain_file = ‘./chain_casl_pwr.xml’
chain = openmc.deplete.Chain.from_xml(chain_file)
#reduction=chain.reduce([‘U235’,‘U238’,‘O16’],1)
new_chain=openmc.deplete.Chain()
new_chain = chain
new_chain.export_to_xml(‘chain_casl_pwr_1’)
print (new_chain)

the error i am seeing is

Traceback (most recent call last):
File “run_depletion.py”, line 93, in
new_chain.export_to_xml(‘chain_casl_pwr_1’)
File “/home/saleem/.local/lib/python3.6/site-packages/openmc/deplete/chain.py”, line 431, in export_to_xml
root_elem.append(nuclide.to_xml_element())
File “/home/saleem/.local/lib/python3.6/site-packages/openmc/deplete/nuclide.py”, line 247, in to_xml_element
rx_elem.set(‘target’, daughter)
File “src/lxml/etree.pyx”, line 816, in lxml.etree._Element.set
File “src/lxml/apihelpers.pxi”, line 593, in lxml.etree._setAttributeValue
File “src/lxml/apihelpers.pxi”, line 1538, in lxml.etree._utf8
TypeError: Argument must be bytes or unicode, got ‘NoneType’

Your help will be highly appreciated. Thank you

Khurrum,

Thank you for bringing this to our attention. This error is due to a bug in handling reaction targets that don’t exist in the chain.

Thankfully the fix is easy, and is now a pull request - https://github.com/openmc-dev/openmc/pull/1551. Until the request is merged, there isn’t a simple work around unfortunately.

Regards,

Andrew

Thank you Andrew.