diff --git a/source/lmp/plugin/deepmdplugin.cpp b/source/lmp/plugin/deepmdplugin.cpp index 9bc0b685d2..bda880df88 100644 --- a/source/lmp/plugin/deepmdplugin.cpp +++ b/source/lmp/plugin/deepmdplugin.cpp @@ -13,6 +13,7 @@ #endif #include "pair_deepmd.h" #include "pair_deepspin.h" +#include "pair_dpa4spin.h" #include "version.h" #if LAMMPS_VERSION_NUMBER >= 20220328 #include "pppm_dplr.h" @@ -22,6 +23,7 @@ using namespace LAMMPS_NS; static Pair* pairdeepmd(LAMMPS* lmp) { return new PairDeepMD(lmp); } static Pair* pairdeepspin(LAMMPS* lmp) { return new PairDeepSpin(lmp); } +static Pair* pairdpa4spin(LAMMPS* lmp) { return new PairDPA4Spin(lmp); } #ifdef LMP_KOKKOS // Runtime plugins do not consume the PairStyle declarations used by LAMMPS' @@ -109,6 +111,13 @@ extern "C" void lammpsplugin_init(void* lmp, void* handle, void* regfunc) { plugin.handle = handle; (*register_plugin)(&plugin, lmp); + plugin.style = "pair"; + plugin.name = "dpa4spin"; + plugin.info = "dpa4spin pair style " STR_GIT_SUMM; + plugin.author = "Tiancheng Li"; + plugin.creator.v1 = (lammpsplugin_factory1*)&pairdpa4spin; + (*register_plugin)(&plugin, lmp); + plugin.style = "compute"; plugin.name = "deeptensor/atom"; plugin.info = "compute deeptensor/atom " STR_GIT_SUMM; diff --git a/source/lmp/tests/test_lammps_dpa4spin_registration.py b/source/lmp/tests/test_lammps_dpa4spin_registration.py new file mode 100644 index 0000000000..3e44940dfb --- /dev/null +++ b/source/lmp/tests/test_lammps_dpa4spin_registration.py @@ -0,0 +1,26 @@ +# SPDX-License-Identifier: LGPL-3.0-or-later +"""Native-spin host registration does not require a model artifact.""" + +import os + +import pytest +from lammps import ( + lammps, +) + + +def test_native_spin_host_style_is_registered() -> None: + """The runtime plugin, rather than the host binary, must expose dpa4spin.""" + plugin = os.environ.get("DEEPMD_TEST_PLUGIN") + if not plugin: + pytest.skip("DEEPMD_TEST_PLUGIN is required to validate plugin registration") + + lmp = lammps(cmdargs=["-log", "none", "-screen", "none"]) + try: + assert not lmp.has_style("pair", "dpa4spin"), ( + "host LAMMPS already provides dpa4spin; plugin provenance is ambiguous" + ) + lmp.command(f"plugin load {plugin}") + assert lmp.has_style("pair", "dpa4spin") + finally: + lmp.close()