Skip to content

#65 Fix garbled string energy unit in write_std_multixyz - #69

Merged
joshkamm merged 1 commit into
masterfrom
claude/se-gsm-driver-job-array-kck43i
Jul 8, 2026
Merged

#65 Fix garbled string energy unit in write_std_multixyz#69
joshkamm merged 1 commit into
masterfrom
claude/se-gsm-driver-job-array-kck43i

Conversation

@joshkamm

@joshkamm joshkamm commented Jul 8, 2026

Copy link
Copy Markdown
Member

Description

write_std_multixyz (pyGSM/utilities/manage_xyz.py) multiplied each node's energy by units.KJ_MOL_TO_AU before writing it to the XYZ comment line. The energy passed in is already in kcal/mol (level_of_theories/base_lot.py's get_energy returns Hartree * KCAL_MOL_PER_AU), so this treated a kcal/mol value as if it were kJ/mol and produced a garbled AU-scaled number — not documented, not any real unit.

Fix: write the value as-is, in its native kcal/mol, with an explicit kcal/mol label so the format is self-documenting and downstream readers can detect it (py-conformational-sampling#86, ZimmermanGroup/asymmetric-aminoallylation#3).

Consequence for existing consumers: any tool that read the old comment-line value directly will see roughly a 4.184x change in energies for files written after this fix (that was the actual bug — the old numbers were off by that factor). py-conformational-sampling's analyze.py and asymmetric-aminoallylation's data.py both now detect the format via the unit label so old and new files read back correctly; see the linked PRs/issues.

Todos

  • Implement changes
  • Update tests — none existed for write_std_multixyz's comment-line format; ran the full existing suite

Questions

  • None

Status

  • Ready to go — pytest pyGSM/tests/ passes (2/2) against this branch

Closes #65


Generated by Claude Code

pyGSM's internal energies are already in kcal/mol (base_lot.get_energy
returns Hartree * KCAL_MOL_PER_AU). write_std_multixyz multiplied them by
KJ_MOL_TO_AU, treating a kcal/mol value as kJ/mol and emitting a garbled
AU-scaled number that downstream code had to reverse-engineer.

Write the energy in its native kcal/mol unit with an explicit "kcal/mol"
label so the output is a clean, documented, self-identifying unit. Geometry
readers in this repo parse only atom lines, so the label is safe.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01FZskcb9ogmfHPD1GAw1VDD
@joshkamm
joshkamm merged commit 006c9b6 into master Jul 8, 2026
0 of 2 checks passed
@joshkamm
joshkamm deleted the claude/se-gsm-driver-job-array-kck43i branch July 31, 2026 20:31
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.

Fix units in manage_xyz.write_std_multixyz

2 participants