fix: wrong nuclide codes for ground-state nuclides + two crashes#211
Open
steps-re wants to merge 1 commit into
Open
fix: wrong nuclide codes for ground-state nuclides + two crashes#211steps-re wants to merge 1 commit into
steps-re wants to merge 1 commit into
Conversation
- _zam_to_nuclide_code: for ground-state nuclides (m == 0) the mass number `a` was never added, so e.g. U-235 encoded as 92000 instead of 92235. The inverse _nuclide_code_to_zam recovers `a = nuc_code % 1000`, confirming the code must be Z*1000 + a. Add `a` in the m == 0 branch only; the metastable branches already encode `a` (serpent) / follow their own convention (nndc), so they're untouched. - results.py: `material.before_reproc.comp[:, ...]` is a NumPy array; `.pop(0)` on it raises AttributeError. Add `.tolist()` (matching the sibling method that does). - openmc_depcode.py: the non-default depletion-script branch used `==` instead of `=`, so exec_path was never updated (resolved path computed and discarded). Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Three independent fixes found while auditing the depletion code.
1. Ground-state nuclides get the wrong ZA code (
serpent_depcode.py,_zam_to_nuclide_code)For a ground-state nuclide (
m == 0) the mass numberais never added, so e.g. U-235 (Z=92, a=235) encodes as92000instead of92235. The inverse method_nuclide_code_to_zamrecoversa = nuc_code % 1000, confirming the encoding must beZ*1000 + a.I add
aonly in them == 0branch. The metastable branches are intentionally left untouched: theserpentbranch's((a/100)-3)*100already carries ana-dependent offset, and thenndcbranch follows its own convention — I didn't want to disturb conventions I'm not certain about. Happy to extend if the metastable paths also needa.2.
.pop()on a NumPy array (results.py)comp[:, ...]is a NumPy array with no.pop. The sibling method (_collect_material_properties) calls.tolist()first; added it here for bothbefore/afterarrays.3.
==instead of=(openmc_depcode.py)The non-default depletion-script branch compares instead of assigns, so the resolved path is computed and discarded and
exec_pathis never updated. Changed to=.Testing
Localized fixes verified against the surrounding code; I didn't run the suite locally (needs a Serpent/OpenMC environment). Glad to adjust to your conventions.