deepmodeling / deepmodeling/DeePTB

[Code scan] HDF5Dataset checks one Hamiltonian filename but opens another

Open Beginner friendly
#352 0 comments 0 reactions 0 assignees View on GitHub
Dominant language
Python
Stars
122
Forks
36
PR merge metrics
No merged PRs in 30d

Description

This issue is part of a Codex global repository scan.

Problem:
The HDF5 trajectory loader asserts that `hamiltonian.h5` exists, then opens `hamiltonians.h5`. A dataset with only the plural file fails the assertion, while a dataset with only the singular file passes the assertion and fails at open time.

Code reference:
https://github.com/deepmodeling/deeptb/blob/86c60c73996f0dd961c3138f2e88424382cb734e/dptb/data/dataset/_hdf5_dataset.py#L62-L65

Related convention:
https://github.com/deepmodeling/deeptb/blob/86c60c73996f0dd961c3138f2e88424382cb734e/dptb/data/dataset/_default_dataset.py#L86-L88

Impact:
HDF5 datasets with Hamiltonian labels cannot be loaded reliably.

Suggested fix:
Use one canonical filename for both the existence check and the open call. The surrounding code and generated ABACUS outputs appear to use `hamiltonians.h5`.

Contributor guide

Open the contributing guide

Research direction

Open dptb/data/dataset/_hdf5_dataset.py around lines 62–65 and compare the filename handling with dptb/data/dataset/_default_dataset.py around lines 86–88. Verify which Hamiltonian filename the surrounding code and generated ABACUS outputs use, then make the existence check and file open agree. Done means HDF5 datasets using the canonical Hamiltonian file load without either filename mismatch failure.

Written by the indexing model from the issue text.

Assessment

Tech stack
python
Domain
data
Issue type
Bug
Difficulty
1/5
Estimated time
Under an hour
Activity status
Quiet
Clarity
Clearly specified
Newbie friendliness
88/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.