How to use self-calculated macroscopic cross-sections for multi-group Monte Carlo calculations in OpenMC

Hello everyone, I’ve recently been attempting to obtain macroscopic cross-sections using tallies and apply them to “multi-group” calculations in OpenMC. I’ve tried three methods so far, but none have worked successfully:

  1. I performed numerical calculations on values like total, absorption, and flux obtained from tallies to get macroscopic cross-sections, and tried exporting them using the export_to_hdf5 method. However, the values obtained this way cannot be used with this method.

  2. I wanted to format the calculated macroscopic cross-sections into the structure of an MGXS library and create an mgxs_lib object. But I was informed that this must be retrieved from a statepoint file.

  3. I attempted to read the mgxs_lib from the statepoint file first, then modify its values to my calculated macroscopic cross-sections. However, I consistently encountered the following error: “UnboundLocalError: cannot access local variable ‘scatt_mgxs’ where it is not associated with a value”.

Does anyone know how to use self-calculated macroscopic cross-sections for multi-group Monte Carlo calculations in OpenMC?

Thank you very much!

Yunhan