Skip to content

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

Description

@njzjz-bot

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:

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:

atom_style spin/kk
pair_style deepmd/kk <ordinary-model.pt2>

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions