From 59e53bc3b723f25981f6d4a0fc1c5689a6e81eca Mon Sep 17 00:00:00 2001 From: Mike German Date: Fri, 10 Jul 2026 20:08:26 -0400 Subject: [PATCH] fix: wrong nuclide codes for ground-state nuclides + two crashes - _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) --- saltproc/openmc_depcode.py | 2 +- saltproc/results.py | 4 ++-- saltproc/serpent_depcode.py | 2 ++ 3 files changed, 5 insertions(+), 3 deletions(-) diff --git a/saltproc/openmc_depcode.py b/saltproc/openmc_depcode.py index e5f7c6d7c..9f04a159f 100644 --- a/saltproc/openmc_depcode.py +++ b/saltproc/openmc_depcode.py @@ -89,7 +89,7 @@ def __init__(self, if exec_path == "openmc_deplete.py": exec_path = (Path(__file__).parents[0] / exec_path).resolve() else: - exec_path == (Path(template_input_file_path['settings'].parents[0]) / exec_path).resolve() + exec_path = (Path(template_input_file_path['settings'].parents[0]) / exec_path).resolve() self.depletion_settings = depletion_settings self.chain_file_path = chain_file_path diff --git a/saltproc/results.py b/saltproc/results.py index 0bb2cf91b..42634e678 100644 --- a/saltproc/results.py +++ b/saltproc/results.py @@ -148,8 +148,8 @@ def _collect_material_comp(self, material): len(material.after_reproc.comp)) material_comp = np.empty(arr_dim) for nuc in nucs: - nuc_comp_br = material.before_reproc.comp[:, nuc_map[nuc]] - nuc_comp_ar = material.after_reproc.comp[:, nuc_map[nuc]] + nuc_comp_br = material.before_reproc.comp[:, nuc_map[nuc]].tolist() + nuc_comp_ar = material.after_reproc.comp[:, nuc_map[nuc]].tolist() nuc_comp_0 = nuc_comp_br.pop(0) nuc_comp = [] for c1, c2 in zip(nuc_comp_br, nuc_comp_ar): diff --git a/saltproc/serpent_depcode.py b/saltproc/serpent_depcode.py index bd02e3b7a..a3ac6d5a4 100644 --- a/saltproc/serpent_depcode.py +++ b/saltproc/serpent_depcode.py @@ -257,6 +257,8 @@ def _zam_to_nuclide_code(self, Z, a, m): nuc_code = 95642 else: nuc_code = 95242 + else: + nuc_code += a return nuc_code