How does OpenMC locate the Jeff33/ENDFB libraries?

I believe I set up OpenMC correctly (I have yet to test fully), however I was wondering how OpenMC knows to locate the isotopes in files outside of the anaconda3 directory.

I believe OpenMC could read the cross sections (either JEFF33/ENDF) outside the anaconda3 directory as long as you provide the cross_sections.xml.

There are various of ways on doing so,
I think the most convenient way is to define an environment variable on your .bashrc.

For instance, if you are using WSL and the cross section is located on,

D:/OpenMC/endfb71_hdf5/

Then you could add the following line to your .bashrc ,

export OPENMC_CROSS_SECTIONS='/mnt/d/OpenMC/endfb71_hdf5/cross_sections.xml'

OpenMC then would read the endfb71 cross section.
If you’d like to vary the cross section, you could simply comment out the line above on .bashrc and add the path to cross_sections.xml for JEFF33.

edit1:
after you modified the .bashrc, you should either restart the terminal or execute the following command,

source ~/.bashrc

Thanks. Is it possible for me to use both the Jeff33 and Endfb71 libraries?

I’d probably add both paths to my .bashrc script and have two separate aliases to reference the paths that I’d input into my terminal.

You can switch between cross section libraries before running, either by setting $OPENMC_CROSS_SECTIONS or by configuring your OpenMC materials. (You cannot use both libraries at the same time.)

https://docs.openmc.org/en/latest/pythonapi/generated/openmc.Materials.html
https://docs.openmc.org/en/latest/io_formats/materials.html?highlight=cross_sections.xml

Note that in principle you could create a mixed library with isotopes from both with something like:

lib = openmc.data.DataLibrary()
lib.register_file(<file from JEFF>)
lib.register_file(<file from ENDF>)
...
lib.export_to_xml('cross_sections_mixed.xml')

which would create a file called cross_sections_mixed.xml that you could point OpenMC to.

1 Like

Hi @arief.rahman, I have a problem with the directory. It shows like this.


I am using WSL and the cross-section is located on
/mnt/c/Users/User/Desktop/Openmc/endfb80_hdf5
And this is my code in .bashrc

The full path of Desktop directory doesn’t seem right to me. You can follow this link to find out the exact location of your Windows Desktop directory.

Hi @Pranto, I have followed as per your link. I see the location that shows the same path that I use.

In .bashrc you set

export OPENMC_CROSS_SECTIONS=/mnt/c/User/Desktop/Openmc/endfb80_hdf5/cross_sections.xml

instead of

export OPENMC_CROSS_SECTIONS=/mnt/c/Users/User/Desktop/Openmc/endfb80_hdf5/cross_sections.xml

Am I right @Yos?

Yes @Pranto, you are right. I missed it. Thank you very much.