Skip to content

[BUG] DeepMD LAMMPS pair styles misinterpret comm_style tiled as CommBrick #5995

Description

@njzjz-bot

Summary

The DeepMD LAMMPS pair styles accept comm_style tiled but unconditionally cast the active communicator to a CommBrick-derived helper and read brick-only protected fields. CommTiled stores the same concepts with different pointer ranks and layout, so the model receives invalid communication metadata.

This is present on origin/master at 8cfd46e37448.

Evidence

Examples of the unchecked casts are:

commdata_ = (CommBrickDeepMD*)comm;
commdata_ = (CommBrickDPA4Spin*)comm;

in source/lmp/pair_deepmd.cpp and source/lmp/pair_dpa4spin.cpp. The Kokkos message-passing path reaches the same data through PairDeepMD::make_comm_nlist().

CommBrick exposes one-dimensional swap arrays such as int *sendnum, int *recvnum, int *firstrecv, and int **sendlist. CommTiled instead stores per-swap/per-peer layouts such as int **sendnum, int **recvnum, int **firstrecv, and int ***sendlist. Reinterpreting a CommTiled object as CommBrick therefore yields garbage pointers rather than equivalent metadata.

Trigger and impact

Use two or more ranks with:

comm_style tiled
pair_style deepmd/kk <message-passing edge-input .pt2>

The with-communication artifact receives invalid send/receive lists. Host deepmd, deepspin, and dpa4spin also use the brick-only cast when constructing their neighbor-list communication metadata.

This can crash, fail inside the backend, or communicate incorrect features depending on the interpreted pointer values.

Expected behavior

Until tiled metadata is explicitly flattened into the backend's InputNlist representation, these pair styles should detect and reject non-brick communication in init_style() with a clear error. A multi-rank regression should cover comm_style tiled.


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

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

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