How to modify openmc.run()

Hi all,
I am a beginner in OpenMC, working on some tasks related to cross-section data. In this example Jupyter Notebook Viewer, I noticed that after using openmc.run() , the cross-section data is directly accessed. I would like to separate the process of accessing cross-section data. How should I modify the openmc.run() function? Should I modify the C++ API within OpenMC or the Python API?
Thanks

Hi Jin

If I have understood then you want to load the cross section data but not transport particles straight away.

Have you seen the openmc.lib part of the code. Could be ideal for this use case openmc.lib – Python bindings to the C/C++ API — OpenMC Documentation

All the best

Hello Shimwell,
my idea is to replace the process of accessing cross-section data in the transport particles example with an AI-based calculation method. However, I’m unsure how to modify the openmc.run() function, as its default method is using cross_sections.xml .Or, how can I write an API in OpenMC?

Thanks

you can change the path of the cross_sections.xml loaded by setting the config to a different path

openmc.config['cross_sections']='my_new_cross_sections.xml'

Hi Shimwell
When it comes to searching for cross_sections data, I’d like to know how to check the energy of the incoming neutrons, for instance, in megaelectronvolts (MeV). Could you provide a specific example so that I can calculate subsequent cross_sections and generate a new cross_sections.xml file?
Regards
Jin

To check the energy distribution of neutrons you can use an Energy Filter on a tally. Here is an example neutronics-workshop/tasks/task_07_CSG_cell_tally_spectra/2_example_neutron_spectra_on_cell.ipynb at main · fusion-energy/neutronics-workshop · GitHub