How to indicate cross section data

All, I am having the same issue. I want to specify the path to my cross section library, but it never ends up in the materials.xml file. I can edit the materials.xml file by hand (or write a script to do that) and insert the cross section line, but that sort of defeats the purpose of the python api.

I have tried every which way I can think of to specify the path to the cross sections I want to use. I prefer to not do this with an environment variable so that I could more explicitly run a sensitivity study on different cross section sets.

I am playing with the assembly example file and have the source codes of interest available (being a new user I cannot upload). I have been compiling with the command:

python3 assembly.py --generate

Here is the assembly source code of interest:

Define materials

fuel = openmc.Material(name=‘Fuel’)
fuel.set_density(‘g/cm3’, 10.29769)
fuel.add_nuclide(‘U234’, 4.4843e-6)
fuel.add_nuclide(‘U235’, 5.5815e-4)
fuel.add_nuclide(‘U238’, 2.2408e-2)
fuel.add_nuclide(‘O16’, 4.5829e-2)

clad = openmc.Material(name=‘Cladding’)
clad.set_density(‘g/cm3’, 6.55)
clad.add_nuclide(‘Zr90’, 2.1827e-2)
clad.add_nuclide(‘Zr91’, 4.7600e-3)
clad.add_nuclide(‘Zr92’, 7.2758e-3)
clad.add_nuclide(‘Zr94’, 7.3734e-3)
clad.add_nuclide(‘Zr96’, 1.1879e-3)

hot_water = openmc.Material(name=‘Hot borated water’)
hot_water.set_density(‘g/cm3’, 0.740582)
hot_water.add_nuclide(‘H1’, 4.9457e-2)
hot_water.add_nuclide(‘O16’, 2.4672e-2)
hot_water.add_nuclide(‘B10’, 8.0042e-6)
hot_water.add_nuclide(‘B11’, 3.2218e-5)
hot_water.add_s_alpha_beta(‘c_H_in_H2O’)

openmc.Materials.cross_sections = ‘/home/neonnuke/openmc/xsecs/endfb80_hdf5/cross_sections.xml’

And here is the materials.xml file without the line needed:

<?xml version='1.0' encoding='utf-8'?>

… etcetera

And I can get it to run with openmc by inserting the line:

<cross_sections>/home/neonnuke/openmc/xsecs/endfb80_hdf5/cross_sections.xml</cross_sections>

right after the materials tag.