I’ve been trying to use the .get_atoms function from the depletion module, but I haven’t managed to get it working. I’ve tried dozens of versions of the code to fetch the data, but all of them fail. The error changes, but always has to do with the specifications being passed within the parenthesis. It also seems to think something is out of place or simply returns a “KeyError” otherwise. The snippet of the code is included below.
File “core.py”, line 3592, in
time, u235 = results.get_atoms(“1”, ‘U235’, nuc_units=‘atom/b-cm’, time_units=‘d’)
File “/home/rmclem/miniconda3/envs/openmc-py3.7/lib/python3.7/site-packages/openmc/deplete/results.py”, line 147, in get_atoms
concentrations[i] = result[0, mat_id, nuc]
File “/home/rmclem/miniconda3/envs/openmc-py3.7/lib/python3.7/site-packages/openmc/deplete/stepresult.py”, line 104, in getitem
mat = self.index_mat[mat]
KeyError: ‘1’
materials_dep = results.export_to_materials(1) # 1 is for 1 step depletion, 0 would be fresh
materials_dep.export_to_xml()
This generates a new materials.xml file containing the depleted materials which can be used to check compositions. There are some quirks to using this though, primarily the “atomic percents” listed in the compositions don’t add to 1 or anything close to it for the depleted materials. The values are consistently arbitrary.