Skip to content

About

Python package for processing nuclear data distribution in ACE and ENDF format into HDF5 format for use in OpenMC. Adapted from the openmc data repo.

Resources

Stars

21 stars

Watchers

2 watching

Forks

Latest commit

 

History

163 Commits

Folders and files

Repository files navigation

test_urls test_package test_convert_scripts

OpenMC Data

Aims to facilitate the use of different nuclear data libraries with OpenMC by providing command line tools that process and download nuclear data automatically.

Prerequisites

You should have already installed OpenMC, see the docs for installation instructions.

Some scripts (mainly the generate scripts) require NJOY to be installed and added to your path. NJOY can be pip installed from the unofficial wheels in the shimwell/wheels repository, which puts the njoy executable on your path:

python -m pip install --extra-index-url https://shimwell.github.io/wheels njoy2016

Installation

The package is distributed on PYPI and can be installed with pip.

pip install openmc_data

Usage

Once installed several scripts are available in your terminal that are able to download and process nuclear data.

The scripts accept input arguments, to find out the input arguments available for a particular script run the script name with --help after the name. For example:

convert_endf --help

Produce Cross Section Files

In the convert and generate tables, each release lists the data it produces: n = neutron, g = photon (gamma), s(a,b) = thermal scattering. Temperatures are for neutron data; thermal scattering data keep the evaluation's own temperatures.

Download cross sections

Script name Library Release Neutron temperatures (K)
download_endf ENDF/B VII.1
VIII.0
VIII.1
250, 293.6, 600, 900, 1200, 2500
download_jeff JEFF 3.3
4.0
250, 293.6, 600, 900, 1200, 2500
download_tendl TENDL 2019
2021
293.6

Convert cross sections

Script name Library Release Neutron temperatures (K)
convert_endf ENDF/B VII.1 (n, g, s(a,b)) 293.6
convert_fendl FENDL 3.2c (n, g)
3.2b (n, g)
3.2a (n, g)
3.2 (n, g)
3.1d (n, g)
3.1a (n, g)
3.1 (n, g)
3.0 (n, g)
2.1 (n, g)
3.2c, 3.2b, 3.2a, 3.2: 293.6
3.1d, 3.1a, 3.1, 3.0: not yet confirmed
2.1: 300
convert_jeff JEFF 3.2 (n, s(a,b))
3.3 (n, s(a,b))
4.0 (n, s(a,b)) (default)
3.2: 293, 300, 400, 500, 600, 700, 800, 900, 1000, 1200, 1500, 1800
3.3: 293, 600, 900, 1200, 1500, 1800
4.0: 0.1, 293, 300, 600, 900, 1200, 1500, 1800
(all by default; select with -t)
convert_tendl TENDL 2015 (n)
2017 (n)
2019 (n)
2021 (n)
2015: 293.16
2017, 2019, 2021: 293.6

Generate cross sections

Script name Library Release Neutron temperatures (K)
generate_cendl CENDL 3.1 (n)
3.2 (n)
293.6
generate_endf ENDF/B VII.1 (n, g, s(a,b))
VIII.0 (n, g, s(a,b))
VIII.1 (n, g, s(a,b))
250, 293.6, 600, 900, 1200, 2500
(default; change with --temperatures)
generate_fendl FENDL 3.2c (n)
3.2b (n)
3.2a (n)
3.2 (n)
3.1d (n)
3.1a (n)
3.0 (n)
293.6
generate_jendl JENDL 4.0 (n)
5.0 (n, g, s(a,b))
250, 293.6, 600, 900, 1200, 2500
(default; change with --temperatures)
generate_jeff JEFF 3.3* (n, s(a,b))
4.0 (n, s(a,b))
250, 293.6, 600, 900, 1200, 2500
(default; change with --temperatures)
generate_tendl TENDL 2023 (n)
2025 (n)
293.6

* generate_jeff -r 3.3 substitutes TENDL-2019 evaluations for C13 and O17, because the JEFF 3.3 evaluations of these nuclides have defective MF=6 data. The C13 and O17 files in the output are therefore TENDL-2019 data, not JEFF. JEFF 4.0 has no substitutions.

Combine libraries

The generate and convert scripts never mix libraries, so photon data for a neutron-only library (JEFF, TENDL) come from a separate run. combine_libraries then merges the cross_sections.xml files. Libraries are listed in order of preference: everything from the first is used, and a later library only adds entries the earlier ones lack. Give the photon library as a photon-only library, otherwise its neutron and thermal entries would also fill gaps in the first.

JEFF-4.0 neutron and thermal scattering data with ENDF/B-VIII.1 photon data:

generate_jeff -r 4.0                     # writes jeff-4.0-hdf5/
generate_endf -r viii.1 -p photon        # writes endfb-viii.1-hdf5/ (photon only)
combine_libraries \
    -l jeff-4.0-hdf5/cross_sections.xml endfb-viii.1-hdf5/cross_sections.xml \
    -o jeff-4.0-endfb-viii.1-photon.xml

TENDL-2025 neutron data with ENDF/B-VIII.1 photon data:

generate_tendl -r 2025                   # writes tendl-2025-hdf5/
generate_endf -r viii.1 -p photon        # writes endfb-viii.1-hdf5/ (photon only)
combine_libraries \
    -l tendl-2025-hdf5/cross_sections.xml endfb-viii.1-hdf5/cross_sections.xml \
    -o tendl-2025-endfb-viii.1-photon.xml

Without -d the combined XML is written to the current directory and points at the original files. With -d <directory> the HDF5 files are copied there too. The combined XML records, as a comment, how many entries of each type came from which library. Point OpenMC at it with openmc.config['cross_sections'] or OPENMC_CROSS_SECTIONS.

Each cross_sections.xml written by the generate, convert and combine scripts starts with an XML comment that records the data source, the number of entries of each type, the openmc_data version and script, and any evaluations taken from another library. OpenMC ignores XML comments, so the comment does not change how the library loads. openmc.data.DataLibrary drops comments when it rewrites a file.

Produce Depletion Chain files

Download chain files

Script name Library Release Branching options
download_chain ENDF/B VII.1
VIII.0
None
SFR
PWR
download_chain ENDF/B VIII.1 None
SFR
PWR
FNS
download_chain JEFF 4.0 None
SFR
PWR
FNS
download_chain JENDL 5.0 None
SFR
PWR
FNS
download_chain TENDL 2017
2019
None
SFR
PWR
FNS
FNS-ORIGEN
download_chain TENDL 2025 None
SFR
PWR
FNS

The JEFF-4.0 and JENDL-5.0 chains are made with generate_jeff_chain and generate_jendl_chain and take their neutron, decay and fission yield data from their own library only, as do the ENDF/B chains. Their FNS branching ratios come from the isomeric production data of the same library, with the decay data of the same library passed to generate_branching_ratios --decay.

Chain Nuclides FNS reaction types FNS branched channels Size
ENDF/B-VIII.1 3820 30 236 28 MB
JEFF-4.0 3851 29 2742 9 MB
JENDL-5.0 4070 28 2328 66 MB

ENDF/B-VIII.1 has isomeric production data for far fewer reactions than JEFF-4.0, JENDL-5.0 or TENDL, so its FNS chain splits fewer channels. The JENDL-5.0 chains are larger because its decay sublibrary holds more, and more detailed, decay radiation spectra.

All the TENDL chains are made with generate_tendl_chain using decay data and neutron induced fission yields from ENDF/B-VIII.0, so the releases can be compared against one another.

Generate chain files

Script name Library Release Branching options
generate_endf_chain ENDF/B VII.1
VIII.0
VIII.1
None
SFR
PWR
FNS
generate_jeff_chain JEFF 3.3
4.0 (default)
None
SFR
PWR
FNS
generate_jendl_chain JENDL 5.0 None
SFR
PWR
FNS
generate_tendl_chain TENDL 2015
2017
2019
2021
2023
2025
None
SFR
PWR
FNS
generate_serpent_fissq
generate_endf71_chain_casl ENDF/B None
SFR
PWR

The generate scripts write the chain without branching ratios (None). SFR and PWR are added with add_branching_ratios and the bundled branching_ratios_sfr.json and branching_ratios_pwr.json. FNS branching ratios are made from the library's own isomeric production data with generate_branching_ratios and added with add_branching_ratios, as shown below.

Branching ratios for metastable states

Reactions can produce either the ground state or a metastable state of a nuclide and the split between them is dependent on the neutron spectrum. The generate_branching_ratios script finds this split from the isomeric production data in the ENDF neutron files (MF=8 identifies the isomeric states and whether the production data is in MF=9 or MF=10) and collapses it with a multigroup neutron flux that you provide. The one group branching ratio is reaction rate weighted, which is the weighting that preserves the production rate of each isomer in a single energy group chain.

FNS (fusion neutron source) adds branching ratios for the production of metastable states, which makes a chain suitable for activation calculations of fusion neutron spectra. They are produced with generate_branching_ratios from the isomeric production data in the library's own neutron files, collapsed with a spectrum from the IAEA CoNDERC FNS benchmark.

The branching options differ in which reactions they cover, not only in the values. Counts below are for TENDL 2017.

Branching option Reactions covered Branched channels Ratios come from
None none 0
SFR
PWR
(n,gamma) only 101 Serpent default isomeric branching ratios
FNS-ORIGEN 15 reaction types 2355 ORIGEN
FNS 35 reaction types 14692 the TENDL files themselves

The reactor options only ever split capture. For a fusion spectrum the threshold reactions matter most, and in the FNS chains (n,gamma) is only the fourth largest group behind (n,na), (n,3He) and (n,2n), so SFR and PWR leave out most of what an activation calculation needs.

FNS-ORIGEN is an earlier TENDL 2017 and 2019 chain hosted on the openmc_activator repository, whose branching ratios are derived from ORIGEN data rather than from TENDL. It is kept available for comparison, but the FNS chains are the TENDL only option and the two can differ substantially. For Ag107 capture to Ag108_m1 under a fusion spectrum, for example, FNS gives 0.056 against FNS-ORIGEN's 0.348, because the FNS value is reaction rate weighted and the majority of the capture rate sits in the resolved resonance range where the isomeric ratio is small.

The JSON file written by generate_branching_ratios is in the same format as the branching_ratios_pwr.json and branching_ratios_sfr.json files, so it can be applied to a chain file with add_branching_ratios.

# downloads the ENDF files and makes a chain file from them
generate_tendl_chain -r 2017 --lib endf80

# collapses the isomeric production data with a fusion neutron source spectrum
# taken from the IAEA CoNDERC FNS benchmark
generate_branching_ratios \
    --neutron-dir tendl-2017-endf/neutron \
    --fispact-fluxes fns/Ag/2000exp_5min_fluxes \
    --chain chain_tendl_2017_endf80.xml \
    --decay endf-b8.0-endf/decay --decay-pattern '*.endf' \
    --jobs 20 \
    -o branching_ratios_tendl_2017_fns.json

# adds the branching ratios to the chain file
add_branching_ratios \
    -i chain_tendl_2017_endf80.xml \
    -b branching_ratios_tendl_2017_fns.json \
    -o chain_tendl_2017_endf80_fns.xml

The MF=8 section lists the excited states of each product by excitation energy but not by isomer number. Pass the decay sublibrary used for the chain with --decay so that each state is matched to the isomer with the closest excitation energy. Without it the states are numbered in order of energy, which mislabels an isomer whenever an evaluation lists a higher isomer without the lower one. JEFF-4.0 Ta181 capture, for example, only lists the 519.6 keV Ta182_m2 state, which ranking calls Ta182_m1. When an evaluation lists a metastable state that the decay data has no isomer for, such as the 200.1 keV Tb156 state in TENDL next to the 88.4 keV Tb156_m2, the isomer goes to the nearest state and the other is counted as the ground state, as the chain has no nuclide for it.

Most reactions store their isomeric production as cross sections in MF=10 and need no other data. The remainder store multiplicities in MF=9 which have to be weighted by the reaction cross section, and as the MF=3 cross section is only the background in the resolved resonance range these are reconstructed with NJOY. Passing --cross-sections will instead read them from an existing HDF5 library, which avoids the NJOY runs if you have already made one.

Only the shape of the cross section is used, as a weight, so the NJOY modules that do not affect it are skipped and the reconstruction tolerance is loosened. This is what makes the actinides tractable, as the unresolved resonance probability tables take over two hours per nuclide, and it changes the branching ratios by less than 0.2%.

Use --jobs to process files in parallel. A whole TENDL library is about 2800 evaluations and takes roughly half an hour with --jobs 20, against many hours in series.

Other scripts

Script name Description
convert_tendl_rand Download random TENDL libraries from PSI and convert it to a HDF5 library for use with OpenMC. Only certain nuclides are available from PSI. This script generates a cross_sections_tendl.xml file with random TENDL evaluations plus a standard library located in 'OPENMC_CROSS_SECTIONS'
sample_sandy This scripts generates random (gaussian) evaluations of a nuclear data file following its covariance matrix using SANDY, and converts them to HDF5 for use in OpenMC. Script generates a cross_sections_sandy.xml file with the standard library plus the sampled evaluations.
make_compton
make_stopping_powers
generate_branching_ratios Finds the branching ratios for the production of metastable states in the ENDF neutron files and collapses them with a multigroup neutron flux, writing a JSON file for add_branching_ratios.
add_branching_ratios Adds branching ratios to a preexisting chain file, for any reaction present in the JSON file provided.
reduce_chain
combine_libraries Combines multiple cross_section.xml files into a single cross_section.xml.

Testing

Install the test dependencies with python -m pip install '.[tests]', then run the offline suite with python -m pytest -q -rs tests -m 'not network and not integration'. Tests stay in the flat tests directory: test_utils.py covers shared utilities, test_urls.py covers registry validation, HTTP helper regressions and marked live URL checks, and script-specific tests belong in files named test_<script>.py alongside them. Use pytest's tmp_path for generated test artifacts rather than writing into the repository.

The network marker identifies live external URL checks; integration identifies data download and processing tests. Pull requests and pushes run offline tests and CLI help checks in test_package.yml, and offline URL syntax and repository-file checks in test_urls.yml, without compiling OpenMC for the URL jobs. Live URL checks run nightly or manually in a separate job of that same workflow. Full, multi-GB processing runs only through the required script choice in the manual test_processing.yml workflow.

Exactly one URL is explicitly not tested over HTTP because of its Cloudflare challenge: https://nds.iaea.org/fendl/data/neutron/fendl-FENDL-3.2c-neutron-endf.zip. Its syntax is still checked offline. Other HTTP errors, including IAEA and Cloudflare 403 responses, remain failures, not skips or expected failures. Nightly/manual external health checks may remain red until blocked IAEA and obsolete OECD URLs are restored; passing offline checks does not establish that downloads are available.

About

Python package for processing nuclear data distribution in ACE and ENDF format into HDF5 format for use in OpenMC. Adapted from the openmc data repo.

Resources

Stars

21 stars

Watchers

2 watching

Forks

Releases

Packages

Used by

Contributors

Languages