Skip to content

Density file names that differ from others only in case: Ind and Disp as ind-total and disp-total - #11

Merged
btyrcha merged 2 commits into
mainfrom
fix/density-file-names
Nov 16, 2026
Merged

btyrcha merged 2 commits into
mainfrom
fix/density-file-names

Conversation

@btyrcha

@btyrcha btyrcha commented Nov 16, 2026

Copy link
Copy Markdown
Owner

calc_densities names its files delta_dm_<key> after the density keys, and the keys Ind/ind and Disp/disp (with their _A and _B variants: six pairs) differ only in case. On a case-insensitive file system (macOS and Windows by default) ind is written first and Ind then goes into the same file. The result is delta_dm_ind_A.cube holding Ind (ind + exch-ind_S2), with no error; the same holds for disp. This affects the cubes and the deprecated .npy files since 0.4.0, and files copied from Linux collide in the same way. The .npz bundle is not affected: its entry names are case-sensitive and np.load never puts them on disk.

  • prop_sapt.artifacts.density_file_name(key, suffix) names the files of single densities: delta_dm_<key><suffix>, with Ind and Disp named ind-total and disp-total, e.g. delta_dm_ind-total_A.cube.
  • density_file_names(keys, suffix) names several and raises a ValueError if two names differ only in case (or not at all).
  • calc_densities names its cubes, its .npy files and the cube list in the bundle metadata with them, checked before anything is written.
  • Unchanged: the density keys (rho["Ind"], DENSITY_COMPONENTS), the bundle and its format version, and the cube comment line, which still names the key (propSAPT delta_dm_Ind_A: ...).
  • examples/make_cubes_from_mo_matrices.py uses the helper. The usage guide says where Ind and Disp are saved.
  • CHANGELOG Fixed entry: users who wrote files with 0.4.0 or 0.5.0 on macOS or Windows should recompute their delta_dm_ind* and delta_dm_disp* files. AI-USAGE entry.

Tests: the mapping, the error, and all names from DENSITY_COMPONENTS with _A/_B being distinct when case is ignored, so a future key cannot reintroduce the problem. The tests of saved cubes and .npy files now expect the new names. Full suite: 472 passed, 2 skipped, 2 xfailed. black and flake8 (critical) clean.

After this is merged, #8 needs a rebase that routes its two TREXIO name builders (export_trexio and trexio_filenames in calc_densities) through density_file_names(keys, ".h5"). The rebase will not flag them as conflicts.

🤖 Generated with Claude Code

btyrcha and others added 2 commits November 16, 2026 13:56
The density keys Ind and Disp differ from ind and disp only in case, so
their files delta_dm_<key> (cubes, .npy) collided on case-insensitive file
systems: on macOS or Windows the Ind and Disp densities were written over
the ind and disp files, with no error.

prop_sapt.artifacts.density_file_name names the files of single densities,
with Ind and Disp as ind-total and disp-total; density_file_names also
refuses names that differ only in case. calc_densities names its cubes and
.npy files with them, before writing anything. The density keys and the
entries of the .npz bundle are unchanged.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
The example that writes cubes from a bundle names them with
density_file_name; the usage guide and the changelog say where the Ind and
Disp densities are saved now, and that files from 0.4.0 and 0.5.0 written
on macOS or Windows need recomputing.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@btyrcha
btyrcha merged commit 781e024 into main Nov 16, 2026
4 checks passed
@btyrcha
btyrcha deleted the fix/density-file-names branch November 16, 2026 13:26
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