Open shimwell opened 4 months ago
this can help find pathways to a specific isotope. It shows the isotopes and reactions that result in the target
import os
from pathlib import Path
import openmc
import openmc.deplete
import openmc_depletion_plotter
from openmc.data import DADZ
chain_file = Path(os.environ['OPENMC_CHAIN_FILE'])
chain = openmc.deplete.Chain.from_xml(chain_file)
pathways_to_target = {}
for nuclide in chain.nuclides:
atomics_number, mass_number, metastable_state = openmc.data.zam(nuclide.name)
if len(nuclide.reactions)>2:
print(nuclide.reactions)
reactions=nuclide.reactions
for reaction in reactions:
if reaction.type in DADZ.keys():
delta_mass_number, delta_atomics_number = DADZ[reaction.type]
target_mass_number = mass_number + delta_mass_number
target_atomics_number = atomics_number + delta_atomics_number
target = openmc.data.gnds_name(
Z=target_atomics_number,
A=target_mass_number
)
print(f'{nuclide.name}{reaction.type}{target}')
pathways_to_target.setdefault(target, []).append((nuclide.name, reaction.type))
These code above can be improved to account for targets that are metastable and made more concise
import os
from pathlib import Path
import openmc
import openmc.deplete
from openmc.data import DADZ
chain_file = Path(os.environ['OPENMC_CHAIN_FILE'])
chain = openmc.deplete.Chain.from_xml(chain_file)
pathways_to_target = {}
for nuclide in chain.nuclides:
if len(nuclide.reactions)>0:
for reaction in nuclide.reactions:
# if the reaction changes the A or Z number
if reaction.type in DADZ.keys():
pathways_to_target.setdefault(reaction.target, []).append((nuclide.name, reaction.type))
we have cross section processing examples but no chain file examples
something like this could help find reactions only available via threshold reactions