deepmodeling / deepmodeling/deepmd-kit

[BUG] deepmd/kk silently ignores spin atoms instead of rejecting them

Open
#5,996 1 comment 0 reactions 0 assignees View on GitHub
bug
Dominant language
Python
Stars
2k
Forks
649
Avg merge
6d 18h
Merged PRs (30d)
15

Description

### Summary

The host `deepmd` pair style rejects spin atoms and tells the user to select a spin-aware pair style. The `deepmd/kk` compute override omits that guard, so an ordinary model can run with `atom_style spin/kk` while silently ignoring every atom's spin state.

This is present on `origin/master` at `8cfd46e37448`.

### Evidence

`PairDeepMD::compute()` contains:

```cpp
if (atom->sp_flag) {
error->all(FLERR,
"Pair style 'deepmd' does not support spin atoms, please use "
"pair style 'deepspin' instead.");
}
```

`PairDeepMDKokkos::compute()` overrides the entire host compute path and never performs this check. Its device graph is built only from coordinates and atom types; it neither consumes `atom->sp` nor produces `atom->fm`.

### Trigger and impact

Run an ordinary edge-, graph-, or canonical-input `.pt2` model with:

```text
atom_style spin/kk
pair_style deepmd/kk
```

Unlike `pair_style deepmd`, initialization and compute proceed. Changing magnetic moments has no effect, and no magnetic force is produced, which can silently yield invalid spin dynamics.

### Expected behavior

`PairDeepMDKokkos::init_style()` or `compute()` should apply the same `atom->sp_flag` rejection as the host path. A regression should compare `deepmd` and `deepmd/kk` behavior for a spin atom style.

---

Coding agent: Codex
Codex version: codex-cli 0.149.0
Model: gpt-5.6-sol
Reasoning effort: xhigh

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.