Molden and Trexio support. - #150
Open
mathieulinares wants to merge 36 commits into
Open
Conversation
Co-authored-by: mathieulinares <38646069+mathieulinares@users.noreply.github.com>
Co-authored-by: mathieulinares <38646069+mathieulinares@users.noreply.github.com>
Co-authored-by: mathieulinares <38646069+mathieulinares@users.noreply.github.com>
…comments Co-authored-by: mathieulinares <38646069+mathieulinares@users.noreply.github.com>
Co-authored-by: mathieulinares <38646069+mathieulinares@users.noreply.github.com>
…ntegration Phase 1: Molden file format data structures and documentation
Co-authored-by: mathieulinares <38646069+mathieulinares@users.noreply.github.com>
Co-authored-by: mathieulinares <38646069+mathieulinares@users.noreply.github.com>
…gging Co-authored-by: mathieulinares <38646069+mathieulinares@users.noreply.github.com>
Co-authored-by: mathieulinares <38646069+mathieulinares@users.noreply.github.com>
Co-authored-by: mathieulinares <38646069+mathieulinares@users.noreply.github.com>
…arser Implement Molden file parser for quantum chemistry orbital visualization
- Created md_molden_loader.cpp with MoldenData to md_system_t converter - Implemented coordinate unit conversion (AU to Angstrom) - Added bond inference using VDW radii via md_util_bond_compute_simple - Registered Molden loader in loader.cpp (SYS_LOADER_MOLDEN) - Added .molden and .mold file extension support Co-authored-by: mathieulinares <38646069+mathieulinares@users.noreply.github.com>
- Fixed md_util_bond_compute_simple -> md_util_system_infer_covalent_bonds - Moved molden_test.cpp and molden_parser_test.cpp to test/ directory - Build now succeeds without errors Co-authored-by: mathieulinares <38646069+mathieulinares@users.noreply.github.com>
- Added flags array with FLAG_NONE for all entries - Fixes incomplete table structure initialization - Code review feedback addressed Co-authored-by: mathieulinares <38646069+mathieulinares@users.noreply.github.com>
- Updated datasets/molden_examples/README.md with VIAMD usage instructions - Added drag-and-drop instructions and visualization features - Updated main README.md to mention Molden support - Documented camera controls and supported features Co-authored-by: mathieulinares <38646069+mathieulinares@users.noreply.github.com>
…ization [WIP] Implement Phase 3 of Molden file integration for visualization
… look wrong though.
There was a problem hiding this comment.
Pull request overview
This PR expands VIAMD’s quantum/electronic-structure source support by adding optional TREXIO loading, integrating a Molden parser/loader path with new example datasets, and unifying QM UI window labeling/behavior across VeloxChem, Molden, and TREXIO.
Changes:
- Add optional TREXIO support (CMake detection, file probing for
.h5/.hdf5, TREXIO parsing + md_system conversion). - Add Molden parsing utilities, loader integration, and multiple Molden example datasets plus standalone validation programs.
- Introduce shared QM UI helpers and improve electronic-structure orbital selection (incl. beta spin handling) + minor VeloxChem safety checks.
Reviewed changes
Copilot reviewed 33 out of 37 changed files in this pull request and generated 6 comments.
Show a summary per file
| File | Description |
|---|---|
| CMakeLists.txt | Adds optional TREXIO detection/linking and conditionally builds TREXIO component. |
| src/loader.h | Extends loader types (Molden/Mold/TREXIO) and adds allocator parameter to loader::load. |
| src/loader.cpp | Adds Molden/TREXIO loader integration and TREXIO probing for .h5/.hdf5. |
| src/viamd.cpp | Passes allocator into loader and adds error handling around postprocess step. |
| src/main.cpp | Improves MO selection UI to respect beta spin orbital labels/counts. |
| src/qm_ui.h | Adds shared ImGui window-label helpers for QM sources. |
| src/components/veloxchem/veloxchem.cpp | Uses shared QM UI labels/windows and adds guards when vlx is null. |
| src/trexio_data.h | Defines TREXIO data structures and parse/probe API (behind VIAMD_TREXIO). |
| src/trexio_data.cpp | Implements TREXIO probing and parsing via TREXIO C API. |
| src/md_trexio_loader.h | Declares TREXIO → md_system_t loader hooks (behind VIAMD_TREXIO). |
| src/md_trexio_loader.cpp | Converts parsed TREXIO nuclei into md_system_t and infers bonds. |
| src/molden.h | Defines Molden data model + parsing function declarations. |
| src/molden.cpp | Implements Molden utilities and Phase-2 parsing functions. |
| src/md_molden_loader.h | Declares Molden → md_system_t loader hooks. |
| src/md_molden_loader.cpp | Converts parsed Molden atoms into md_system_t and infers bonds. |
| src/QM_FORMAT_NOTES.md | Documents QM source integration model and AO-ordering policy. |
| src/MOLDEN_FORMAT_NOTES.md | Expanded Molden format edge-case documentation. |
| src/MOLDEN_PARSER_USAGE.md | Adds user/developer usage documentation for the Molden parser. |
| src/PHASE1_SUMMARY.md | Phase-1 historical summary documentation (added). |
| src/PHASE2_SUMMARY.md | Phase-2 historical summary documentation (added). |
| PR_NOTE.md | PR-level summary and validation notes (added). |
| README.md | Notes Molden support work in the project description. |
| test/test_molden_loader.cpp | Standalone Molden loader integration smoke test (added). |
| test/molden_test.cpp | Standalone Molden data-structure/demo test (added). |
| test/molden_parser_test.cpp | Standalone Molden parser unit-style tests (added). |
| datasets/molden_examples/README.md | Documents included Molden example datasets. |
| datasets/molden_examples/h2o_sto3g.molden | Adds H2O STO-3G Molden example dataset. |
| datasets/molden_examples/h2_sto3g.molden | Adds H2 STO-3G Molden example dataset. |
| datasets/molden_examples/Ammonia_NH3.molden | Adds ammonia Molden example dataset. |
| datasets/molden_examples/Acetaldehyde_C2H4O.molden | Adds acetaldehyde Molden example dataset. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com>
Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com>
Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com>
Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com>
Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com>
Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com>
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.
PR Note: QM Source Integration, TREXIO Support, and AO Ordering
Summary
This PR extends VIAMD's quantum/electronic-structure file support and makes the user-facing QM workflow more consistent across source formats.
The main changes are:
VeloxChem,Molden, orTREXIOMolden
Molden support was cleaned up around AO ordering, Cartesian shell handling, and validation.
User-facing changes
Moldenin the GUI.Source Details / Advanced.AO-order handling
Molden files vary by producer, especially for p shells, SP-derived p functions, and higher-angular-momentum shell ordering. The default is now automatic resolution:
Standard P Order.SP-Derived P Order.Standard P Order.For spherical shells, the Molden adapter remaps source coefficients into VIAMD/mdlib order for
p,d,f, andgshells.For Cartesian shells, the Molden adapter now supports higher-angular-momentum shell remapping for
6D,10F, and15Gsource order before evaluation.Mixed-format Molden tags such as
[5D10F],[7F], and[9G]are now interpreted per angular momentum instead of being collapsed into one global basis mode.Manual modes are kept only as an advanced/debug override:
AutoSource OrderStandard P OrderSP-Derived P OrderThe Molden component resets its settings between files so an override from one file does not leak into the next file.
Validation
The Molden loader test was updated to current mdlib APIs and extended with new examples:
h2o_sto3g.moldenh2_sto3g.moldenAmmonia_NH3.moldenAnthracene_C14H10.moldenSelenium-trioxide_SeO3.moldenAll intended Molden examples parse and load successfully. The Selenium example specifically covers the previously unsupported Cartesian
d-shell path.Parser coverage also includes mixed-format tag handling such as spherical
d, Cartesianf, and sphericalgcombinations.The NTO Molden example is intentionally excluded from this PR.
TREXIO
This PR adds optional TREXIO support behind
VIAMD_ENABLE_TREXIO.Build integration
pkg-configor a direct header/library search.VIAMD_ENABLE_TREXIO=ON, CMake fetches and builds the configured TREXIO release automatically.-DVIAMD_ENABLE_TREXIO=OFF.pkg-configexposes dependent libraries such as HDF5 separately.Loader integration
TREXIO files are treated as QM system sources. Detection supports:
.trexio.h5.hdf5For HDF5-like extensions, the loader probes the file before selecting the TREXIO loader so it does not steal non-TREXIO HDF5 files such as VeloxChem files.
GUI and representations
TREXIO exposes:
TREXIO SummaryTREXIO Orbital GridThe GUI shows the source as
TREXIO, not genericQM.TREXIO example
A proper ORCA-derived TREXIO water example is included under
datasets/trexio_examples/.This file is independent of the VeloxChem reference path and is intended as the TREXIO validation example.
AO-ordering policy
The central rule is:
The rendering and representation path should not need to know about producer-specific AO quirks.
VIAMD/mdlib internal order
The internal GTO evaluation path expects shell-contiguous ordering sorted by:
VeloxChem
VeloxChem raw data has its own ordering. mdlib's VeloxChem reader remaps the raw VeloxChem AO/MO data into VIAMD/mdlib order before orbital evaluation.
Molden
Molden ordering is producer-dependent. The Molden component resolves this automatically by default and exposes manual override only under advanced source details. This includes the required remaps for spherical
d/f/gand Cartesiand/f/gshells.TREXIO
TREXIO spherical AO order follows the official convention:
The TREXIO component maps this official spherical order into VIAMD/mdlib shell-contiguous order. The default TREXIO mode must remain
TREXIO spherical.Source / mdlib orderandSource p: px,py,pzare debug overrides for unusual or synthetic files only.QM layer / UI organization
The implementation now treats VeloxChem, Molden, and TREXIO as sources of QM/electronic-structure data. A small shared UI helper centralizes common source-window labels and source display.
Important UI decision:
So users see:
VeloxChem Summary,VeloxChem Orbital GridMolden Summary,Molden Orbital GridTREXIO Summary,TREXIO Orbital GridSource-specific details and AO-order overrides belong under
Source Details / Advanced.Validation performed
Out of scope
The current PR keeps source-specific parsing/remapping localized and unifies the GUI/representation behavior where it is safe to do so.