Skip to content

TREXIO export of the density changes for VIAMD, and their natural orbitals - #8

Merged
btyrcha merged 11 commits into
mainfrom
feature/trexio-export
Nov 18, 2026
Merged

btyrcha merged 11 commits into
mainfrom
feature/trexio-export

Conversation

@btyrcha

@btyrcha btyrcha commented Nov 14, 2026

Copy link
Copy Markdown
Owner

Summary

  • density_natural_orbitals gives the natural orbitals of the interaction-induced density
    changes, from calc_densities results or a densities.npz bundle. A few of them usually
    carry most of a change, in the spirit of NOCV.
  • TREXIO files of the density changes, to view them interactively in
    VIAMD:
    • calc_densities(save_trexio=True) and the save_trexio setting of the runner's
      densities task write them with the calculation.
    • export_trexio and prop-sapt export trexio write them from existing bundles.
  • What a file holds: the natural orbitals of one density change. Positive occupations are
    written as alpha orbitals and negative ones as beta, so VIAMD's alpha − beta density is the
    density change. Psi4's basis set is written as it is, because its AO order and
    normalisation are TREXIO's.
  • trexio is optional: there is a trexio extra, and trexio is added to prop-sapt.yaml so
    CI runs the export tests. trexio is imported only when a file is written.
  • A usage-guide section (writing the files, viewing them in VIAMD, reading the natural
    orbitals), an example (examples/export_trexio.py) and changelog entries.

Tests

  • The AOs written, evaluated as the TREXIO specification defines them
    (tests/trexio_spec.py), match Psi4's up to g functions, for spherical and Cartesian basis
    sets.
  • The files reproduce every He–H2 density change to round-off.
  • Exporting from a bundle gives the same files as exporting at calculation time.
  • Also covered: the CLI, the runner setting, and the errors when trexio is missing.
  • The full suite passes locally (496 passed).
  • A density that VIAMD exported back from a prototype file matched propSAPT's to 1.2e-9 rms.
    f/g shells and Cartesian basis sets are not yet checked in VIAMD itself.

🤖 Generated with Claude Code

btyrcha and others added 8 commits November 16, 2026 14:30
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…trexio extra

The density changes are written as natural orbitals, positive occupations as alpha and
negative ones as beta, so that VIAMD's alpha - beta density is the density change.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…relative_cutoff

An absolute cutoff of 1e-10 changed the weaker density changes by up to 7e-6 of their
largest value; 1e-12 of the largest occupation drops as many orbitals with no change.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
trexio is checked before the calculation (and when a run configuration asks for the
files), and the bundle lists the files with their encoding, as it does the cubes.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…rexio command

The bundle's basis set is rebuilt by Psi4 and checked against the one it records; the
orbitals come from its monomer wavefunctions.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…tals

The usage guide says how to write the files and view them in VIAMD, and how to read the
natural orbitals of the density changes.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
export_trexio and calc_densities name the TREXIO files through
density_file_names, so the Ind and Disp files are delta_dm_ind-total*.h5
and delta_dm_disp-total*.h5 and no longer collide with ind and disp on a
case-insensitive file system. export_trexio checks the names before it
writes anything; TREXIO_PREFIX is gone.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@btyrcha
btyrcha force-pushed the feature/trexio-export branch from 9f7cd5a to 5f05252 Compare November 16, 2026 13:47
btyrcha and others added 3 commits November 16, 2026 15:32
calc_densities writes the bundle before the cube and TREXIO files, so
that a failed or interrupted export cannot lose the matrices. Its
"cubes" and "trexio" metadata entries therefore list the files the call
was asked to write, which may be missing if writing them failed. The
calc_densities docstring, a comment and the usage guide now say so.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
A negative cutoff kept the natural orbitals of zero occupation, and one
of 1 or more, or nan, silently left out every orbital. export_trexio
now refuses them with a ValueError before anything else, which
prop-sapt export trexio reports as an error.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@btyrcha
btyrcha merged commit 5c659be into main Nov 18, 2026
4 checks passed
@btyrcha
btyrcha deleted the feature/trexio-export branch November 18, 2026 13:08
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