Hacktoberfest 2026: the issues maintainers tagged for October, open and beginner-friendly. Browse Hacktoberfest issues

[BUG] ABACUS SCF reader inverts coordinates for left-handed cells without transforming forces

Open
#1,061 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Assessment

Difficulty
3/5
Estimated time
1-2 days
Newbie friendliness
76/100
Issue type
Bug
Clarity
Clearly specified
Activity status
Active
Tech stack
python
Domain
data

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
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

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

More from deepmodeling/dpdata

All issues in deepmodeling/dpdata

Similar issues

More Python issues

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.