Distinguish atomic and nuclear masses - #4129
Merged
Merged
Conversation
Three non-functional follow-ups to the atomic/nuclear mass split: - Scope the CODATA 2018 attribution in atomic_mass.h to the bare-particle MASS_* constants it actually describes, and point out that the ATOMIC_MASS table below it comes from AME2020 instead. - Document that nuclear_mass(0, 1) returns the CODATA neutron mass, and note the deliberate asymmetry with atomic_mass(0, 1), which returns zero because a free neutron has no corresponding neutral atom. - Compare against the AME2020 literals with == rather than Approx in the atomic mass test section. These are exact lookups from a literal table, so Approx's default ~1e-5 relative tolerance would not catch a wrong-but-close table entry. The derived comparisons keep Approx, since evaluating atomic_mass() - Z * MASS_ELECTRON in two different contexts may differ under FP contraction. Co-Authored-By: Claude Opus 5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_017Z78GT8mhn4WcG3XN8by7v
5 tasks
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.
Description
While working on a feature, I noticed that there is an inconsistency in our
ATOMIC_MASStable in C++. Namely, several light isotopes use named constants likeMASS_PROTON,MASS_ALPHA, etc. within the table, but those named constants represent nuclear masses (which exclude the mass of electrons), not atomic masses (which include electron mass). This PR makes theATOMIC_MASStable consistently contain neutral ground-state atomic masses and adds dedicated helpers for atomic and nuclear mass lookup.ParticleType::mass()continues to provide the bare rest mass needed for particle kinematics, while light nuclei use their CODATA constants and heavier nuclei are derived from the corresponding atomic masses.Note that existing inverse-velocity and time-cutoff regression tests remain unchanged because the masses of transportable neutrons, photons, electrons, and positrons are unaffected.
Checklist