Skip to content

Trim element symbol in atomic_data abort message - #128

Open
djkees wants to merge 1 commit into
nasa:mainfrom
djkees:fix/atomic-data-trim-symbol
Open

Trim element symbol in atomic_data abort message#128
djkees wants to merge 1 commit into
nasa:mainfrom
djkees:fix/atomic-data-trim-symbol

Conversation

@djkees

@djkees djkees commented Aug 29, 2026

Copy link
Copy Markdown
Contributor

Summary

Fixes a stray space in the "Symbol not found" abort message in get_atom (source/atomic_data.f90) when the element symbol is a single letter.

Changes

symbol is a fixed 2-character field (element_name_len = 2), so for single-letter symbols like H it's stored as "H " with a trailing space. The abort message embedded symbol directly instead of trimming it, producing Symbol H not found in the element list. (double space) instead of Symbol H not found in the element list.. Every other abort() call in the codebase that embeds a variable name trims it first (see mixture.f90, input.f90, equilibrium.f90) — this was the one outlier. Added trim() around symbol in the one abort() call at source/atomic_data.f90:155.

Testing

  • Built and ran the full test suite (core-c preset, GNU/gfortran on Windows): all 14 tests pass.
  • Manually reproduced the abort path with a crafted input (reac name Test Q 1 wt%=100, an unrecognized single-letter element in an exploded formula, forcing molecular_weight_from_formula -> get_atom_weight -> get_atom). Confirmed the message changed from a double space to a single space: CRITICAL: Symbol Q not found in the element list.

Compatibility / Numerical behavior

  • No expected changes to numerical results

This only changes the text of an error message on an abort path; it does not touch any numerical computation.


Drafted with Claude's assistance

  • Confirmed the bug and the fix by reading source/atomic_data.f90 directly (the element_name_len = 2 field and the single abort() call missing trim()), and by grepping every other abort() call site to verify the trim() pattern is otherwise universal.
  • Built the project (core-c preset) and ran ctest — all 14 existing tests passed before and after the change.
  • Reproduced the bug end-to-end with a real cea.exe invocation before and after the fix to confirm the message actually changes as described, rather than trusting the diff alone.

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