Skip to content

Record data provenance in cross_sections.xml and never mix libraries - #64

Merged
shimwell merged 2 commits into
mainfrom
cross-sections-provenance
Nov 25, 2026
Merged

shimwell merged 2 commits into
mainfrom
cross-sections-provenance

Conversation

@shimwell

@shimwell shimwell commented Nov 25, 2026 •

Copy link
Copy Markdown
Member

Builds on #63. Please merge #63 first; this PR's diff then shrinks to its own commit.

Provenance comment in cross_sections.xml

Every generate and convert script now starts cross_sections.xml with an XML comment like this:

<?xml version='1.0' encoding='UTF-8'?>
<!--
  Data source: ENDF/B-VIII.1
  Contents: 100 photon
  Generated by: openmc_data 2.5.1.dev4+gf334eb8a8 (generate_endf)
  Date: 2026-11-25 (UTC)
-->
<cross_sections>

For generate_jeff -r 3.3, the comment also lists the C13/O17 TENDL-2019 replacements as Not JEFF data. The new openmc_data.add_provenance helper writes it.

This doesn't break OpenMC. Both readers look only at <directory> and <library>, and both skip comments: the C++ reader (root.children("library") in cross_sections.cpp) and DataLibrary.from_xml. I checked this by running the OpenMC executable on an annotated JEFF-4.0 cross_sections.xml, including a coupled neutron–photon run. DataLibrary.export_to_xml drops comments, so the README says so.

No photon data from other libraries

convert_mcnp70 and convert_mcnp71 no longer accept --photon. That option added eprdata photoatomic data to an ENDF/B library. The README now says that each script produces data from one library only. generate_jeff photon data was already removed in #62.

combine_libraries

  • The combined cross_sections.xml records how many entries of each type came from each input, plus each input's own data source and notes.
  • The --help text and README explain that a later library fills any gap, not just photon data. Combining JEFF-4.0 with a full ENDF/B-VIII.1 library pulled in 59 ENDF neutron nuclides and the ENDF thermal tables. The recommended route is therefore a photon-only library from generate_endf -r viii.1 -p photon.
  • The README has examples for JEFF-4.0 + ENDF/B-VIII.1 photon and TENDL-2025 + ENDF/B-VIII.1 photon.

Testing

  • New tests in tests/test_utils.py: the comment survives DataLibrary.from_xml with entries unchanged, and text that isn't allowed in an XML comment is rejected. The non-network test suite passes (150 passed).
  • Ran generate_endf -r viii.1 -p photon, combined it with a JEFF-4.0 library, and ran an OpenMC coupled neutron–photon simulation on the result. Neutron and thermal data were read from JEFF-4.0 and photon data from ENDF/B-VIII.1.
  • The TENDL-2025 example wasn't run end to end because no complete local TENDL-2025 HDF5 was available. It uses the same code path as the JEFF example.

generate_jeff -r 3.3 processes TENDL-2019 evaluations in place of the
defective JEFF 3.3 C13 and O17 files. This was only noted in the
docstring and a print line. The README now has a footnote, each
substitution raises a warning, and the final summary lists the
substituted files as not JEFF data.
Every generate and convert script now writes an XML comment at the top
of cross_sections.xml with the data source, entry counts by type, the
openmc_data version and script, the date, and any evaluations taken
from another library (JEFF 3.3 C13/O17). OpenMC's C++ and Python
readers ignore comments.

convert_mcnp70 and convert_mcnp71 no longer accept --photon, which
added eprdata photoatomic data to an ENDF/B library.

combine_libraries now records how many entries of each type came from
each input. The README explains that it fills any gap from later
libraries, and shows how to combine JEFF-4.0 or TENDL-2025 with a
photon-only ENDF/B-VIII.1 library.
@shimwell
shimwell merged commit 68ec915 into main Nov 25, 2026
3 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant