Skip to content

Support endf.Material in from_endf methods#3932

Merged
paulromano merged 1 commit into
openmc-dev:developfrom
paulromano:endf-material-compat
May 30, 2026
Merged

Support endf.Material in from_endf methods#3932
paulromano merged 1 commit into
openmc-dev:developfrom
paulromano:endf-material-compat

Conversation

@paulromano
Copy link
Copy Markdown
Contributor

Description

This PR updates the various from_endf methods on classes within openmc.data to function properly when passed an endf.Material object (which effectively replaces the Evaluation class from OpenMC). This is meant to be an alternative to the solution proposed in paulromano/endf-python#40.

Let me know what you think @shimwell!

Checklist

  • I have performed a self-review of my own code
  • I have run clang-format (version 18) on any C++ source files (if applicable)
  • I have followed the style guidelines for Python source files (if applicable)
  • I have made corresponding changes to the documentation (if applicable)
  • I have added tests that prove my fix is effective or that my feature works (if applicable)

@paulromano paulromano requested a review from shimwell April 29, 2026 19:44
@shimwell shimwell self-assigned this Apr 29, 2026
@shimwell
Copy link
Copy Markdown
Member

shimwell commented May 26, 2026

I think this is good to go, I just noticed some docstrings that can be optionally considered for updating

Routing through as_evaluation means these methods now accept a str path too which might want to be added to their docstring

File Method
openmc/data/reaction.py:1154 Reaction.from_endf
openmc/data/angle_distribution.py:216 AngleDistribution.from_endf
openmc/data/resonance.py:82 Resonances.from_endf
openmc/data/resonance_covariance.py:77 ResonanceCovariances.from_endf
openmc/data/photon.py:1069 PhotonReaction.from_endf
openmc/data/fission_energy.py:199 FissionEnergyRelease.from_endf

@paulromano
Copy link
Copy Markdown
Contributor Author

Thanks @shimwell! All of the methods you mentioned there are not really intended to be called with an ENDF filename since they are really just used internally when building the class hierarchy for a full evaluation. In my opinion, the only time it makes sense to pass a filename is when you are using a top-level class like IncidentNeutron.

@paulromano paulromano merged commit 1914e3e into openmc-dev:develop May 30, 2026
17 checks passed
@paulromano paulromano deleted the endf-material-compat branch May 30, 2026 02:54
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.

2 participants