Skip to content

Fix forces acting on constrained atoms when reading from extxyz database - #1448

Open
yantar92 wants to merge 1 commit into
ACEsuit:mainfrom
yantar92:main
Open

Fix forces acting on constrained atoms when reading from extxyz database#1448
yantar92 wants to merge 1 commit into
ACEsuit:mainfrom
yantar92:main

Conversation

@yantar92

@yantar92 yantar92 commented Apr 23, 2026

Copy link
Copy Markdown

I have noticed that forces from xyz training inputs (example: attached) are not always loaded correctly.
When the inputs contain structures with constrained atoms, the forces used for training are set to 0 instead of the real values obtained from the DFT data.

This seems to happen only with newer ASE versions, after ASE started storing the constraint info in the xyz data. See https://ase-lib.org/changelog.html#id18

In

atoms.arrays["REF_forces"] = atoms.get_forces()
, get_forces method is used, which automatically sets forces to 0 by default, if constraints are present. See https://ase-lib.org/ase/atoms.html#ase.Atoms.get_forces

AtomsToGraphs might also be affected, but I did not check in details. There are also a couple more instances of get_forces in the code, but those look safe. (Although, explicitly passing apply_constraint=False might be a good measure if that's what is implied in the code).

Potentially related: #1148

CC: @anfeus

data.xyz.gz

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