Depletion results reading problem

Dear Experts @paulromano @Shimwell , When I tried to view my depletion results, I encountered the following error. I wonder if it is an error caused by the new version. How can I solve this problem?

_, u235 = results.get_atoms("1", "U235")
_, xe135 = results.get_atoms("1", "Xe135")
---------------------------------------------------------------------------
KeyError                                  Traceback (most recent call last)
Cell In[14], line 1
----> 1 _, u235 = results.get_atoms("1", "U235")
      2 _, xe135 = results.get_atoms("1", "Xe135")

File ~/.local/lib/python3.10/site-packages/openmc/deplete/results.py:203, in Results.get_atoms(self, mat, nuc, nuc_units, time_units)
    201 for i, result in enumerate(self):
    202     times[i] = result.time[0]
--> 203     concentrations[i] = result[0, mat_id, nuc]
    205 # Unit conversions
    206 times = _get_time_as(times, time_units)

File ~/.local/lib/python3.10/site-packages/openmc/deplete/stepresult.py:103, in StepResult.__getitem__(self, pos)
    101     mat = str(mat.id)
    102 if isinstance(mat, str):
--> 103     mat = self.index_mat[mat]
    104 if isinstance(nuc, str):
    105     nuc = self.index_nuc[nuc]

KeyError: '1'
1 Like

I think you defined the material ID incorrectly in the code. You need to check your material.xml file and define the correct ID from there.

1 Like