From 7d930820921dbd5082b8d6f3f17764a41c2f37f0 Mon Sep 17 00:00:00 2001 From: Pengchao_Zhang Date: Tue, 6 Oct 2026 23:29:12 +0800 Subject: [PATCH] fix(lammps): register built-in KOKKOS styles with generated sources --- source/lmp/builtin.cmake | 3 +++ source/lmp/pair_deepmd_kokkos.h | 18 ++++++++++-------- source/lmp/pair_dpa4spin_kokkos.h | 18 ++++++++++-------- 3 files changed, 23 insertions(+), 16 deletions(-) diff --git a/source/lmp/builtin.cmake b/source/lmp/builtin.cmake index e051e5c24a..296c5a5f35 100644 --- a/source/lmp/builtin.cmake +++ b/source/lmp/builtin.cmake @@ -78,3 +78,6 @@ target_compile_definitions( # register styles registerstyles(${CMAKE_CURRENT_LIST_DIR}) generatestyleheaders(${LAMMPS_STYLE_HEADERS_DIR}) +if(COMMAND generatestylesources) + generatestylesources(${LAMMPS_STYLE_HEADERS_DIR}) +endif() diff --git a/source/lmp/pair_deepmd_kokkos.h b/source/lmp/pair_deepmd_kokkos.h index bd3689aedf..08959812bc 100644 --- a/source/lmp/pair_deepmd_kokkos.h +++ b/source/lmp/pair_deepmd_kokkos.h @@ -1,19 +1,21 @@ // SPDX-License-Identifier: LGPL-3.0-or-later // The device pair style is available when the LAMMPS Kokkos package is enabled. -#ifdef LMP_KOKKOS - -#ifndef LAMMPS_VERSION_NUMBER -#error Please define LAMMPS_VERSION_NUMBER to yyyymmdd -#endif - #ifdef PAIR_CLASS +#ifdef LMP_KOKKOS // clang-format off PairStyle(deepmd/kk,PairDeepMDKokkos); PairStyle(deepmd/kk/device,PairDeepMDKokkos); PairStyle(deepmd/kk/host,PairDeepMDKokkos); // clang-format on +#endif #else +#ifdef LMP_KOKKOS + +#ifndef LAMMPS_VERSION_NUMBER +#error Please define LAMMPS_VERSION_NUMBER to yyyymmdd +#endif + #ifndef LMP_PAIR_DEEPMD_KOKKOS_H #define LMP_PAIR_DEEPMD_KOKKOS_H @@ -129,6 +131,6 @@ class PairDeepMDKokkos : public PairDeepMD, public KokkosBase { } // namespace LAMMPS_NS #endif -#endif - #endif // LMP_KOKKOS + +#endif diff --git a/source/lmp/pair_dpa4spin_kokkos.h b/source/lmp/pair_dpa4spin_kokkos.h index 1485e6e336..26cd99ea91 100644 --- a/source/lmp/pair_dpa4spin_kokkos.h +++ b/source/lmp/pair_dpa4spin_kokkos.h @@ -1,19 +1,21 @@ // SPDX-License-Identifier: LGPL-3.0-or-later // The device pair style is available when the LAMMPS Kokkos package is enabled. -#ifdef LMP_KOKKOS - -#ifndef LAMMPS_VERSION_NUMBER -#error Please define LAMMPS_VERSION_NUMBER to yyyymmdd -#endif - #ifdef PAIR_CLASS +#ifdef LMP_KOKKOS // clang-format off PairStyle(dpa4spin/kk,PairDPA4SpinKokkos); PairStyle(dpa4spin/kk/device,PairDPA4SpinKokkos); PairStyle(dpa4spin/kk/host,PairDPA4SpinKokkos); // clang-format on +#endif #else +#ifdef LMP_KOKKOS + +#ifndef LAMMPS_VERSION_NUMBER +#error Please define LAMMPS_VERSION_NUMBER to yyyymmdd +#endif + #ifndef LMP_PAIR_DPA4SPIN_KOKKOS_H #define LMP_PAIR_DPA4SPIN_KOKKOS_H @@ -118,6 +120,6 @@ class PairDPA4SpinKokkos : public PairDPA4Spin, public KokkosBase { } // namespace LAMMPS_NS #endif -#endif - #endif // LMP_KOKKOS + +#endif