[BUG] ABACUS SCF reader inverts coordinates for left-handed cells without transforming forces
Nobody has claimed this yet.
Assessment
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Newbie friendliness
- 76/100
Research direction
Start with dpdata/formats/abacus/stru.py::right_hand_rule() and get_frame_from_stru(), then inspect dpdata/formats/abacus/scf.py::get_force() and get_frame(). Run the provided dpdata.LabeledSystem(..., fmt="abacus/scf") reproduction using task.21.zip. Done means left-handed cells produce consistently transformed coordinates and forces while energy, stress, and virial remain unchanged.
Written by the indexing model from the issue text.
Description
Bug summary
When the input STRU cell has a negative determinant, right_hand_rule() negates the cell and Cartesian coordinates. However, the SCF reader loads forces from running_scf.log without negating them.
The exported coordinates and forces therefore belong to inconsistent spatial representations. The trigger is cell handedness, not atom count.
dpdata Version
The same logic was also observed in GitHub master on September 20, 2026. The affected installation uses the older dpdata/abacus/ module path.
Input Files, Running Commands, Error Log, etc.
task.21.zip
calculation/
├── INPUT
├── STRU
└── OUT.ABACUS/running_scf.log
Read and export using:
import dpdata
system = dpdata.LabeledSystem("calculation", fmt="abacus/scf")
system.to_deepmd_npy("exported")
Observed values from an affected dataset:
eg:
Original Cartesian position ≈ [ 2.7337, 7.0893, 2.2321]
Exported coord.npy ≈ [-2.7337, -7.0891, -2.2320]
ABACUS TOTAL-FORCE = [-0.0020299593, 2.3578977033, 0.3664125131]
Exported force.npy ≈ [-0.002, 2.3579, 0.3664]
The coordinates are approximately negated, while the force signs remain unchanged. This is a silent data-consistency error rather than a parsing exception.
Steps to Reproduce
Prepare a converged ABACUS SCF calculation whose input STRU cell has det(cell) < 0 and whose output contains nonzero forces.
Read the calculation with dpdata.LabeledSystem(..., fmt="abacus/scf").
Compare the parsed cell and Cartesian coordinates with the original STRU.
Compare the parsed forces with the corresponding TOTAL-FORCE block.
Actual: Cell and coordinates are negated; forces retain their original signs.
Expected: If coordinates undergo spatial inversion, forces must also be negated. Energy, stress, and virial should remain unchanged under this inversion.
Further Information, Files, and Links
Relevant source code:
stru.py::right_hand_rule() negates only the cell and coordinates:
if np.linalg.det(cell) < 0:
cell = -cell
coord = -coord
get_frame_from_stru() calls this function without returning an inversion flag.
scf.py::get_force() reads forces without a spatial transformation.
scf.py::get_frame() combines the transformed structure with the untransformed forces.
- Dominant language
- Python
- Stars
- 254
- Forks
- 158
- PR merge metrics
- No merged PRs in 30d
Getting set up
This project ships no dev container, Dockerfile or contributing guide, so setting up is up to you: start from its README, and see our first-contribution guide for the general steps.
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
More from deepmodeling/dpdata
-
[Code scan] Pyright configuration excludes most format and plugin modulesPossibly taken @njzjz-bot claimed this 83 days ago. Openenhancement
Difficulty 2/5 1-3 hours Newbie friendliness 72/100
deepmodeling/dpdata#1004 ·
-
Difficulty 5/5 Over a week Newbie friendliness 35/100
deepmodeling/dpdata#1058 ·
-
feature request qe
Difficulty 3/5 1-2 days Newbie friendliness 45/100
deepmodeling/dpdata#901 · 4 comments ·
-
enhancement vasp
Difficulty 4/5 3-5 days Newbie friendliness 38/100
deepmodeling/dpdata#642 ·
-
enhancement lammps
Difficulty 4/5 3-5 days Newbie friendliness 25/100
deepmodeling/dpdata#609 · 1 comment ·
All issues in deepmodeling/dpdata
Similar issues
-
area/install reliability
Difficulty 2/5 1-3 hours Newbie friendliness 75/100
Maintainers usually reply within 1 day
-
Difficulty 2/5 1-3 hours Newbie friendliness 83/100
FluidNumerics/fluid-walk-blocker#191 ·
Maintainers usually reply within 1 day
-
Difficulty 2/5 1-3 hours Newbie friendliness 62/100
TransformerLensOrg/TransformerLens#1868 ·
Maintainers usually reply within 1 day
-
Difficulty 2/5 1-3 hours Newbie friendliness 76/100
Maintainers usually reply within 1 day
-
Difficulty 1/5 Under an hour Newbie friendliness 85/100
climate-analytics-lab/jax-gcm#1057 ·
Maintainers usually reply within 1 day