From 112161d6c8ce35329ebe1c39f946201d325ef15a Mon Sep 17 00:00:00 2001 From: SY Wang Date: Thu, 12 Nov 2026 21:06:33 +0800 Subject: [PATCH 1/4] Use CMake build of NEP_CPU --- CMakeLists.txt | 5 +- cmake/CollectBuildInfoVars.cmake | 6 +-- cmake/modules/FindNEP.cmake | 47 ----------------- docs/advanced/install.md | 9 +--- source/CMakeLists.txt | 13 ++--- source/source_md/unittests/CMakeLists.txt | 4 +- toolchain/build_abacus_aocc-aocl.sh | 4 +- toolchain/build_abacus_gcc-aocl.sh | 4 +- toolchain/build_abacus_gcc-mkl.sh | 4 +- toolchain/build_abacus_gnu.sh | 4 +- toolchain/build_abacus_intel.sh | 4 +- toolchain/scripts/package_versions.sh | 4 +- toolchain/scripts/stage4/install_nep.sh | 61 ++++------------------- 13 files changed, 35 insertions(+), 134 deletions(-) delete mode 100644 cmake/modules/FindNEP.cmake diff --git a/CMakeLists.txt b/CMakeLists.txt index 4db27108ce7..107d00a7a39 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -55,6 +55,7 @@ option(ENABLE_DFTD4 "Enable DFT-D4 dispersion correction" OFF) option(ENABLE_PLUMED "Enable using the PLUMED enhanced-sampling library" OFF) option(ENABLE_JSON "Enable JSON output" OFF) option(ENABLE_CNPY "Enable cnpy usage" OFF) +option(ENABLE_NEP "Enable NEP_CPU" OFF) option(DEBUG_INFO "Print message to debug" OFF) option(COMMIT_INFO "Print commit information in log" ON) @@ -595,8 +596,8 @@ if(DEFINED DeePMD_DIR) find_package(DeePMD REQUIRED) endif() -if(DEFINED NEP_DIR) - find_package(NEP REQUIRED) +if(ENABLE_NEP) + find_package(NEP_CPU CONFIG REQUIRED) endif() if(DEFINED TensorFlow_DIR) diff --git a/cmake/CollectBuildInfoVars.cmake b/cmake/CollectBuildInfoVars.cmake index d74e8c0243b..ae42333461a 100644 --- a/cmake/CollectBuildInfoVars.cmake +++ b/cmake/CollectBuildInfoVars.cmake @@ -356,10 +356,8 @@ else() set(ABACUS_DEEPMD_VERSION "no") endif() -if(DEFINED NEP_DIR AND NEP_VERSION) - set(ABACUS_NEP_VERSION "yes (v${NEP_VERSION})") -elseif(DEFINED NEP_DIR) - set(ABACUS_NEP_VERSION "yes (path: ${NEP_DIR})") +if(ENABLE_NEP) + set(ABACUS_NEP_VERSION "yes") else() set(ABACUS_NEP_VERSION "no") endif() diff --git a/cmake/modules/FindNEP.cmake b/cmake/modules/FindNEP.cmake deleted file mode 100644 index c37dd5e3559..00000000000 --- a/cmake/modules/FindNEP.cmake +++ /dev/null @@ -1,47 +0,0 @@ -############################################################################### -# - Find NEP -# Finds the NEP header and library. -# -# This module will search for the NEP library, looking for a hint -# from the NEP_DIR environment variable or CMake variable. -# -# This module defines the following variables: -# -# NEP_FOUND - True if the NEP library and headers were found. -# NEP_INCLUDE_DIR - The directory where nep.h is located. -# NEP_LIBRARY - The full path to the NEP library. -# -# It also defines the following imported target: -# -# NEP::nep - The NEP library target. -# -############################################################################### -# Note: Currently only CPU version is supported, Since the NEP interface with GPU support is not available yet. -# In feature, if available, we can use USE_CUDA to switch between CPU and GPU version. - -find_path( - NEP_INCLUDE_DIR nep.h - HINTS ${NEP_DIR} - PATH_SUFFIXES "include") - -find_library( - NEP_LIBRARY - NAMES nep - HINTS ${NEP_DIR} - PATH_SUFFIXES "lib") - -include(FindPackageHandleStandardArgs) -find_package_handle_standard_args(NEP DEFAULT_MSG NEP_LIBRARY NEP_INCLUDE_DIR) - -if(NEP_FOUND) - if(NOT TARGET NEP::nep) - add_library(NEP::nep UNKNOWN IMPORTED) - set_target_properties( - NEP::nep - PROPERTIES IMPORTED_LINK_INTERFACE_LANGUAGES "C" - IMPORTED_LOCATION "${NEP_LIBRARY}" - INTERFACE_INCLUDE_DIRECTORIES "${NEP_INCLUDE_DIR}") - endif() -endif() - -mark_as_advanced(NEP_INCLUDE_DIR NEP_LIBRARY) diff --git a/docs/advanced/install.md b/docs/advanced/install.md index 86d63cfd1ee..f21545efec2 100644 --- a/docs/advanced/install.md +++ b/docs/advanced/install.md @@ -63,15 +63,8 @@ cmake -B build -DDeePMD_DIR=/dir_to_deepmd-kit -DTorch_DIR=/dir_to_pytorch ``` ## Build with NEP -This interface enables running MD simulations with the NEP model. It requires the [NEP_CPU](https://github.com/brucefan1983/NEP_CPU) library, which can be easily installed using toolchain as shown below: -```bash -./install_abacus_toolchain_new.sh --with-nep=install -``` -To build ABACUS: -```bash -cmake -B build -DNEP_DIR=/path/to/nep_cpu -``` +This interface enables running MD simulations with the NEP model. It requires the [NEP_CPU](https://github.com/brucefan1983/NEP_CPU) library version 1.5.1 or newer. To build ABACUS with NEP support, pass `-DENABLE_NEP=ON` to CMake. ## Build with LibRI support diff --git a/source/CMakeLists.txt b/source/CMakeLists.txt index ae735fb8d83..d1aaf29f0c4 100644 --- a/source/CMakeLists.txt +++ b/source/CMakeLists.txt @@ -67,6 +67,7 @@ set(_abacus_feature_definitions $<$:TEST_EXX_RADIAL=1> $<$:__LIBXC> $<$:__DFTD4> + $<$:__NEP> $<$:GATHER_INFO>) if(ABACUS_COMMIT_INFO_INCLUDE_DIR) @@ -86,9 +87,6 @@ if(DEFINED DeePMD_DIR) list(APPEND _abacus_feature_definitions __DPMDC) endif() endif() -if(DEFINED NEP_DIR AND NEP_FOUND) - list(APPEND _abacus_feature_definitions __NEP) -endif() target_include_directories( abacus_compile_requirements @@ -296,7 +294,8 @@ set(_abacus_feature_libs $<$:ZLIB::ZLIB> $<$:cereal::cereal> $<$:Libxc::xc> - $<$:PLUMED::plumed>) + $<$:PLUMED::plumed> + $<$:nep::nep_cpu>) set(_abacus_feature_include_dirs) set(_abacus_feature_compile_options) @@ -341,10 +340,6 @@ if(DEFINED DeePMD_DIR) list(APPEND _abacus_feature_include_dirs ${DeePMD_DIR}/include) endif() -if(DEFINED NEP_DIR AND NEP_FOUND) - list(APPEND _abacus_feature_libs NEP::nep) -endif() - if(DEFINED TensorFlow_DIR AND TensorFlow_FOUND) list(APPEND _abacus_feature_libs TensorFlow::tensorflow_cc) list(APPEND _abacus_feature_include_dirs ${TensorFlow_DIR}/include) @@ -424,7 +419,7 @@ foreach( dftd4::dftd4 DeePMD::deepmd_c DeePMD::deepmd_cc - NEP::nep + nep::nep_cpu TensorFlow::tensorflow_cc ZLIB::ZLIB PEXSI::PEXSI diff --git a/source/source_md/unittests/CMakeLists.txt b/source/source_md/unittests/CMakeLists.txt index 1e36657408d..e99f3f0856e 100644 --- a/source/source_md/unittests/CMakeLists.txt +++ b/source/source_md/unittests/CMakeLists.txt @@ -145,8 +145,8 @@ addtest( SOURCES test_dp_aparam.cpp ../module_dp/dp_aparam.cpp) set(_md_nep_test_libs parameter psi device) -if(DEFINED NEP_DIR AND NEP_FOUND) - list(APPEND _md_nep_test_libs NEP::nep) +if(ENABLE_NEP) + list(APPEND _md_nep_test_libs nep::nep_cpu) endif() addtest( diff --git a/toolchain/build_abacus_aocc-aocl.sh b/toolchain/build_abacus_aocc-aocl.sh index 970a077912e..d104b104b53 100755 --- a/toolchain/build_abacus_aocc-aocl.sh +++ b/toolchain/build_abacus_aocc-aocl.sh @@ -28,7 +28,7 @@ FFTW3="${AOCLhome}" LIBRI="${LIBRI_ROOT}" LIBCOMM="${LIBCOMM_ROOT}" USE_CUDA=OFF # set ON to enable gpu-abacus -# NEP_DIR="${INSTALL_DIR}/NEP_CPU-main" +ENABLE_NEP=OFF # set ON to enable NEP # LIBTORCH="${INSTALL_DIR}/libtorch-2.1.2/share/cmake/Torch" # LIBNPY="${INSTALL_DIR}/libnpy-1.0.1/include" # DEEPMD="${HOME}/apps/anaconda3/envs/deepmd" @@ -76,7 +76,7 @@ cmake_args=( -DLIBRI_DIR="${LIBRI}" -DLIBCOMM_DIR="${LIBCOMM}" -DUSE_CUDA="${USE_CUDA}" - # -DNEP_DIR="${NEP_DIR}" + -DENABLE_NEP="${ENABLE_NEP}" # -DTorch_DIR="${LIBTORCH}" # -DDeePMD_DIR="${DEEPMD}" # -DENABLE_MLALGO=1 diff --git a/toolchain/build_abacus_gcc-aocl.sh b/toolchain/build_abacus_gcc-aocl.sh index 956c33cef18..f5f18d7aded 100755 --- a/toolchain/build_abacus_gcc-aocl.sh +++ b/toolchain/build_abacus_gcc-aocl.sh @@ -27,7 +27,7 @@ FFTW3="${AOCLhome}" LIBRI="${LIBRI_ROOT}" LIBCOMM="${LIBCOMM_ROOT}" USE_CUDA=OFF # set ON to enable gpu-abacus -# NEP_DIR="${INSTALL_DIR}/NEP_CPU-main" +ENABLE_NEP=OFF # set ON to enable NEP # LIBTORCH="${INSTALL_DIR}/libtorch-2.1.2/share/cmake/Torch" # LIBNPY="${INSTALL_DIR}/libnpy-1.0.1/include" # DEEPMD="${HOME}/apps/anaconda3/envs/deepmd" @@ -72,7 +72,7 @@ cmake_args=( -DLIBRI_DIR="${LIBRI}" -DLIBCOMM_DIR="${LIBCOMM}" -DUSE_CUDA="${USE_CUDA}" - # -DNEP_DIR="${NEP_DIR}" + -DENABLE_NEP="${ENABLE_NEP}" # -DTorch_DIR="${LIBTORCH}" # -DDeePMD_DIR="${DEEPMD}" # -DENABLE_MLALGO=1 diff --git a/toolchain/build_abacus_gcc-mkl.sh b/toolchain/build_abacus_gcc-mkl.sh index f57dfacdd97..ebb9e8b0a05 100755 --- a/toolchain/build_abacus_gcc-mkl.sh +++ b/toolchain/build_abacus_gcc-mkl.sh @@ -25,7 +25,7 @@ PREFIX="${ABACUS_DIR}" LIBRI="${LIBRI_ROOT}" LIBCOMM="${LIBCOMM_ROOT}" USE_CUDA=OFF # set ON to enable gpu-abacus -# NEP_DIR="${INSTALL_DIR}/NEP_CPU-main" +ENABLE_NEP=OFF # set ON to enable NEP # LIBTORCH="${INSTALL_DIR}/libtorch-2.1.2/share/cmake/Torch" # LIBNPY="${INSTALL_DIR}/libnpy-1.0.1/include" # DEEPMD="${HOME}/apps/anaconda3/envs/deepmd" @@ -71,7 +71,7 @@ cmake_args=( -DLIBRI_DIR="${LIBRI}" -DLIBCOMM_DIR="${LIBCOMM}" -DUSE_CUDA="${USE_CUDA}" - # -DNEP_DIR="${NEP_DIR}" + -DENABLE_NEP="${ENABLE_NEP}" # -DTorch_DIR="${LIBTORCH}" # -DDeePMD_DIR="${DEEPMD}" # -DENABLE_MLALGO=1 diff --git a/toolchain/build_abacus_gnu.sh b/toolchain/build_abacus_gnu.sh index 6973b3c2855..6dfcdd85a15 100755 --- a/toolchain/build_abacus_gnu.sh +++ b/toolchain/build_abacus_gnu.sh @@ -25,7 +25,7 @@ FFTW3="${FFTW_ROOT}" LIBRI="${LIBRI_ROOT}" LIBCOMM="${LIBCOMM_ROOT}" USE_CUDA=OFF # set ON to enable gpu-abacus -# NEP_DIR="${INSTALL_DIR}/NEP_CPU-main" +ENABLE_NEP=OFF # set ON to enable NEP # LIBTORCH="${INSTALL_DIR}/libtorch-2.1.2/share/cmake/Torch" # LIBNPY="${INSTALL_DIR}/libnpy-1.0.1/include" # DEEPMD="${HOME}/apps/anaconda3/envs/deepmd" # @@ -71,7 +71,7 @@ cmake_args=( -DLIBRI_DIR="${LIBRI}" -DLIBCOMM_DIR="${LIBCOMM}" -DUSE_CUDA="${USE_CUDA}" - # -DNEP_DIR="${NEP_DIR}" + -DENABLE_NEP="${ENABLE_NEP}" # -DTorch_DIR="${LIBTORCH}" # -DDeePMD_DIR="${DEEPMD}" # -DENABLE_MLALGO=1 diff --git a/toolchain/build_abacus_intel.sh b/toolchain/build_abacus_intel.sh index 40fa99492f8..cd897e5b118 100755 --- a/toolchain/build_abacus_intel.sh +++ b/toolchain/build_abacus_intel.sh @@ -25,7 +25,7 @@ PREFIX="${ABACUS_DIR}" LIBRI="${LIBRI_ROOT}" LIBCOMM="${LIBCOMM_ROOT}" USE_CUDA=OFF # set ON to enable gpu-abacus -# NEP_DIR="${INSTALL_DIR}/NEP_CPU-main" +ENABLE_NEP=OFF # set ON to enable NEP # LIBTORCH="${INSTALL_DIR}/libtorch-2.1.2/share/cmake/Torch" # LIBNPY="${INSTALL_DIR}/libnpy-1.0.1/include" # DEEPMD="${HOME}/apps/anaconda3/envs/deepmd" # v3.0 might have problem @@ -72,7 +72,7 @@ cmake_args=( -DLIBRI_DIR="${LIBRI}" -DLIBCOMM_DIR="${LIBCOMM}" -DUSE_CUDA="${USE_CUDA}" - # -DNEP_DIR="${NEP_DIR}" + -DENABLE_NEP="${ENABLE_NEP}" # -DTorch_DIR="${LIBTORCH}" # -DDeePMD_DIR="${DEEPMD}" # -DENABLE_MLALGO=1 diff --git a/toolchain/scripts/package_versions.sh b/toolchain/scripts/package_versions.sh index e5471da0f7c..36e492c15c2 100644 --- a/toolchain/scripts/package_versions.sh +++ b/toolchain/scripts/package_versions.sh @@ -117,8 +117,8 @@ json_ver="3.12.0" json_sha256="42f6e95cad6ec532fd372391373363b62a14af6d771056dbfc86160e6dfff7aa" # NEP (Neural Evolution Potential) - CPU version -nep_ver="629ec5d" -nep_sha256="4d4d3c64211a2a39e5d5c795b77befbba987cc809786e0cd6abfa46d0f3bf8cb" +nep_ver="1.5.1" +nep_sha256="2479cf350554a3a1a958891e8681f4bdcde5e146b9b357fcfa2bf2b3e6dbb05c" # ============================================================================= # Package Variable Loading Function diff --git a/toolchain/scripts/stage4/install_nep.sh b/toolchain/scripts/stage4/install_nep.sh index 4d956ac38d0..cbbd8cf2d0c 100755 --- a/toolchain/scripts/stage4/install_nep.sh +++ b/toolchain/scripts/stage4/install_nep.sh @@ -31,8 +31,8 @@ case "$with_nep" in dirname="NEP_CPU-${nep_ver}" pkg_install_dir="${INSTALLDIR}/${dirname}" install_lock_file="${pkg_install_dir}/install_successful" - filename="nep-${nep_ver}.tar.gz" - url="https://codeload.github.com/brucefan1983/NEP_CPU/tar.gz/${nep_ver}" + filename="NEP_CPU-${nep_ver}.tar.gz" + url="https://github.com/brucefan1983/NEP_CPU/archive/v${nep_ver}/NEP_CPU-${nep_ver}.tar.gz" if verify_checksums "${install_lock_file}"; then echo "$dirname is already installed, skipping it." @@ -47,51 +47,13 @@ case "$with_nep" in [ -d $dirname ] && rm -rf $dirname tar -xzf $filename cd $dirname - - cat <Makefile -CXX ?= g++ - -# Compiler flags -CXXFLAGS = -O2 -fPIC -std=c++11 - -# Include directories -INCLUDES = -I./src - -# Source files -SRCS = ./src/nep.cpp ./src/ewald_nep.cpp ./src/neighbor_nep.cpp - -# Object files -OBJS = \$(SRCS:.cpp=.o) - -# Target shared library -TARGET = libnep.so - -# Default target -all: \$(TARGET) - -# Rule to build the shared library -\$(TARGET): \$(OBJS) - \$(CXX) -shared \$(OBJS) -o \$(TARGET) - -# Rule to compile source files into object files -%.o: %.cpp - \$(CXX) \$(CXXFLAGS) \$(INCLUDES) -c \$< -o \$@ - -# Clean up build files -clean: - rm -f \$(OBJS) \$(TARGET) - -# Install target -install: - mkdir -p \$(PREFIX)/lib - mkdir -p \$(PREFIX)/include - cp \$(TARGET) \$(PREFIX)/lib/ - cp src/*.h \$(PREFIX)/include/ -EOF - - make >make.log 2>&1 || tail -n ${LOG_LINES} make.log - make PREFIX="${pkg_install_dir}" install >install.log 2>&1 || tail -n ${LOG_LINES} install.log - + cmake -Bbuild \ + -DCMAKE_INSTALL_PREFIX="${pkg_install_dir}" \ + -DCMAKE_INSTALL_LIBDIR="lib" \ + -DCMAKE_BUILD_TYPE="Release" \ + -DNEP_CPU_OPENMP=ON \ + > cmake.log 2>&1 || tail -n ${LOG_LINES} cmake.log + cmake --build build -t install -j "$(get_nprocs)" > build.log 2>&1 || tail -n ${LOG_LINES} build.log cd .. write_checksums "${install_lock_file}" "${SCRIPT_DIR}/stage4/$(basename ${SCRIPT_NAME})" fi @@ -101,9 +63,9 @@ EOF __SYSTEM__) echo "==================== Finding NEP_CPU from system paths ====================" - check_lib -lnep "nep" + check_lib -lnep_cpu "nep" add_include_from_paths NEP_CFLAGS "nep.h" $INCLUDE_PATHS - add_lib_from_paths NEP_LDFLAGS "libnep.*" $LIB_PATHS + add_lib_from_paths NEP_LDFLAGS "libnep_cpu.*" $LIB_PATHS ;; __DONTUSE__) ;; *) @@ -123,7 +85,6 @@ if [ "$with_nep" != "__DONTUSE__" ]; then prepend_path LD_LIBRARY_PATH "${pkg_install_dir}/lib" prepend_path LD_RUN_PATH "${pkg_install_dir}/lib" prepend_path LIBRARY_PATH "${pkg_install_dir}/lib" -prepend_path CPATH "${pkg_install_dir}/include" prepend_path CMAKE_PREFIX_PATH "${pkg_install_dir}" EOF fi From 90ea0a1e954ac36434c8874dcb706ff617398684 Mon Sep 17 00:00:00 2001 From: SY Wang Date: Thu, 19 Nov 2026 19:05:39 +0800 Subject: [PATCH 2/4] Update NEP module file --- tests/PP_ORB/nep_hfo2.txt | 777 +++++++++++++++++++------------------- 1 file changed, 391 insertions(+), 386 deletions(-) diff --git a/tests/PP_ORB/nep_hfo2.txt b/tests/PP_ORB/nep_hfo2.txt index 9fdcc26c3af..f5cad2c09f9 100644 --- a/tests/PP_ORB/nep_hfo2.txt +++ b/tests/PP_ORB/nep_hfo2.txt @@ -1,10 +1,14 @@ -nep4_zbl 2 O Hf +nep 2 O Hf +format_version 1 +model nep zbl 0.75 1.5 cutoff 8 4 250 44 n_max 4 4 basis_size 12 12 l_max 4 2 0 -ANN 30 0 +ann 30 0 +energy_reference 0 0 +@ parameters 2441 -1.5533842e+00 -1.3961171e+00 3.3405685e+00 @@ -1927,525 +1931,526 @@ ANN 30 0 2.8927937e+00 3.9155262e+00 1.4099131e+00 - -2.2940616e-01 - -2.3978636e-01 - -2.3748500e+00 2.8657326e-01 - 1.9563338e-02 - -9.0910614e-02 - -2.5686588e+00 9.5408869e-01 - -1.3727081e+00 - -1.6112269e+00 - 2.0881071e+00 -9.1908938e-01 - -3.5890895e-01 - -2.6843009e+00 - 6.2789547e-01 5.8642173e-01 - 1.5076664e-02 - 4.0120059e-01 - 4.1221350e-01 -4.4466174e-01 - 2.1918561e+00 - 1.7434669e+00 - 4.5529962e-01 6.8173546e-01 - -2.0915875e+00 - -9.0331662e-01 - 2.6639309e+00 4.4237590e-01 - -5.5111068e-01 - -6.4363921e-01 - -1.2755105e+00 -8.9477026e-01 - 5.1817203e-01 - 2.6136322e+00 - -1.1172168e+00 -1.0446937e-01 - -7.5461930e-01 - 1.5463486e+00 - 3.7316844e-01 -1.2297275e-01 - -1.8357255e+00 - 3.5172743e-01 - 6.5976131e-01 -9.3726027e-01 - 1.8453962e+00 - -7.4409175e-01 - 1.1922665e+00 -9.3923581e-01 - 1.9594451e+00 - 4.7260043e-01 - 2.1009294e-02 2.4724874e-01 - -3.0114096e-01 - -2.5038543e+00 - 3.0408671e+00 -8.0764284e-03 - -9.3323708e-02 - -1.5286725e+00 - 1.0986918e+00 -5.2158380e-01 - -1.4115039e-01 - 1.4201791e+00 - -1.9050267e+00 6.1161137e-01 - -7.7248119e-02 - 3.1418616e-01 - 1.0913959e+00 3.0320907e-01 - -9.3435459e-03 - -3.1722436e+00 - 2.2108128e+00 -7.1060014e-01 - -2.6849186e-02 - -3.5458228e-01 - -4.3493447e-01 1.0016899e+00 - -4.5686325e-01 - -9.1456942e-02 - 4.3866372e-01 4.5825163e-01 - 9.5142975e-02 - 2.0926287e+00 - 9.9394280e-01 -2.9810932e-02 - -5.2124584e-01 - 9.2470419e-01 - 8.0457723e-01 1.2161284e-01 - -2.3214631e-01 - 6.4427666e-02 - 2.7944240e-01 3.8537703e-02 - -2.5530109e-02 - -3.9351457e-01 - 2.9069493e+00 4.1782182e-02 - -4.5735043e-02 - -4.0495887e-01 - 9.4710332e-01 1.1381063e+00 - 3.5268404e-02 - -8.6834326e-02 - 3.9066190e-01 5.6377345e-01 - -7.3526132e-01 - -4.5397755e-02 - -1.0005380e+00 6.8412679e-01 - -3.4439933e+00 - 1.6043544e+00 - 4.5449706e-03 -1.0303997e+00 - 3.8943484e+00 - -2.7824140e+00 - 2.5553635e-01 7.1907926e-01 - -4.6824656e-02 - 3.4129581e-01 - 1.3005282e-01 1.6339422e+00 - -3.6333210e+00 - 8.7921940e-02 - 1.4450583e-03 7.2421896e-01 - -2.5398893e+00 - 6.3356566e-01 - 3.1766063e-01 -1.0837486e+00 - -5.5443758e-01 - 2.2252049e-02 - -3.6091042e-01 -5.6914908e-01 - 5.6063231e-02 - 1.0298314e-03 - 2.4238717e-02 9.6030992e-01 - -9.6268421e-01 - 2.3460650e+00 - -1.2383690e-02 7.6861513e-01 - -1.9391581e+00 - 1.6428167e+00 - -3.4467268e-01 2.0037541e+00 - -4.6746913e-01 - 1.8533632e-01 - 1.9925807e-02 1.6490299e+00 - -1.7445420e+00 - -1.2992331e+00 - -1.8981735e-03 -7.4854843e-02 - -5.1788747e-01 - -8.7893617e-01 - -1.2539268e+00 1.0828738e+00 - 1.3129176e+00 - 8.9214385e-01 - 2.1309783e+00 -3.2122394e-01 - 1.7049128e+00 - 2.0584841e+00 - -8.9311349e-01 2.7157090e+00 - -2.7663317e+00 - -1.1899577e+00 - 5.2453309e-01 -3.6286643e-01 - 7.0048344e-01 - -1.5496627e+00 - -1.0139318e+00 -1.0544126e+00 - 2.6645690e-01 - 3.2083485e+00 - -2.2817013e+00 -1.1081134e+00 - -3.3196729e-01 - 7.3396498e-01 - 2.3466904e+00 -2.8135803e-02 - 2.4156838e-03 - -1.2590913e+00 - 7.0327646e-01 -2.7724099e-01 - 8.1643122e-01 - 6.6101395e-02 - -2.3891058e-02 4.8915258e-01 - -1.4709608e-01 - 1.4207890e+00 - -1.1855311e+00 -1.6165118e-01 - 1.2200035e+00 - 1.4572439e+00 - -1.3971887e+00 1.9258641e+00 - 2.0958705e-01 - -7.2139484e-01 - -7.2869855e-01 -9.9423409e-01 - -1.2502786e+00 - -1.5623587e+00 - -1.7265791e+00 -1.4523365e-01 - -1.0325271e+00 - -1.3077756e+00 - 1.2025254e-02 -4.0335053e-01 - -1.1523438e+00 - -1.7147996e+00 - -6.5376842e-01 2.9556179e+00 - -2.3046103e+00 - -1.5913094e+00 - -4.1656005e-03 -1.5665205e+00 - 5.1338243e+00 - 1.2152119e+00 - 8.0084456e-03 -2.5743428e-01 - -2.0259600e+00 - -6.0789630e-02 - 2.3534586e+00 2.7328367e+00 - -4.9503961e+00 - -1.5224886e+00 - 2.7951398e-01 9.1023594e-01 - -8.7686402e-01 - -2.8532007e+00 - -1.6088476e-02 -4.0433988e-01 - 1.9681743e+00 - -6.2602729e-01 - 1.2792153e+00 -2.5801936e-01 - -1.0092305e-01 - 1.7260052e-01 - 8.4814884e-02 8.2048684e-01 - -4.2905843e-01 - 7.4386853e-01 - 5.4550028e-01 1.6546834e+00 - 9.3235427e-01 - -2.3978453e-02 - 5.6542766e-01 2.6399046e-01 - -5.8003461e-01 - -4.2401415e-01 - -4.1585934e-01 -2.3292341e+00 - 2.8095278e-01 - -3.7381209e-02 - 4.8540604e-01 -4.3058190e-01 + -2.2940616e-01 + 1.9563338e-02 + -1.3727081e+00 + -3.5890895e-01 + 1.5076664e-02 + 2.1918561e+00 + -2.0915875e+00 + -5.5111068e-01 + 5.1817203e-01 + -7.5461930e-01 + -1.8357255e+00 + 1.8453962e+00 + 1.9594451e+00 + -3.0114096e-01 + -9.3323708e-02 + -1.4115039e-01 + -7.7248119e-02 + -9.3435459e-03 + -2.6849186e-02 + -4.5686325e-01 + 9.5142975e-02 + -5.2124584e-01 + -2.3214631e-01 + -2.5530109e-02 + -4.5735043e-02 + 3.5268404e-02 + -7.3526132e-01 + -3.4439933e+00 + 3.8943484e+00 + -4.6824656e-02 + -3.6333210e+00 + -2.5398893e+00 + -5.5443758e-01 + 5.6063231e-02 + -9.6268421e-01 + -1.9391581e+00 + -4.6746913e-01 + -1.7445420e+00 + -5.1788747e-01 + 1.3129176e+00 + 1.7049128e+00 + -2.7663317e+00 + 7.0048344e-01 + 2.6645690e-01 + -3.3196729e-01 + 2.4156838e-03 + 8.1643122e-01 + -1.4709608e-01 + 1.2200035e+00 + 2.0958705e-01 + -1.2502786e+00 + -1.0325271e+00 + -1.1523438e+00 + -2.3046103e+00 + 5.1338243e+00 + -2.0259600e+00 + -4.9503961e+00 + -8.7686402e-01 + 1.9681743e+00 + -1.0092305e-01 + -4.2905843e-01 + 9.3235427e-01 + -5.8003461e-01 + 2.8095278e-01 3.0663306e-02 + -2.3978636e-01 + -9.0910614e-02 + -1.6112269e+00 + -2.6843009e+00 + 4.0120059e-01 + 1.7434669e+00 + -9.0331662e-01 + -6.4363921e-01 + 2.6136322e+00 + 1.5463486e+00 + 3.5172743e-01 + -7.4409175e-01 + 4.7260043e-01 + -2.5038543e+00 + -1.5286725e+00 + 1.4201791e+00 + 3.1418616e-01 + -3.1722436e+00 + -3.5458228e-01 + -9.1456942e-02 + 2.0926287e+00 + 9.2470419e-01 + 6.4427666e-02 + -3.9351457e-01 + -4.0495887e-01 + -8.6834326e-02 + -4.5397755e-02 + 1.6043544e+00 + -2.7824140e+00 + 3.4129581e-01 + 8.7921940e-02 + 6.3356566e-01 + 2.2252049e-02 + 1.0298314e-03 + 2.3460650e+00 + 1.6428167e+00 + 1.8533632e-01 + -1.2992331e+00 + -8.7893617e-01 + 8.9214385e-01 + 2.0584841e+00 + -1.1899577e+00 + -1.5496627e+00 + 3.2083485e+00 + 7.3396498e-01 + -1.2590913e+00 + 6.6101395e-02 + 1.4207890e+00 + 1.4572439e+00 + -7.2139484e-01 + -1.5623587e+00 + -1.3077756e+00 + -1.7147996e+00 + -1.5913094e+00 + 1.2152119e+00 + -6.0789630e-02 + -1.5224886e+00 + -2.8532007e+00 + -6.2602729e-01 + 1.7260052e-01 + 7.4386853e-01 + -2.3978453e-02 + -4.2401415e-01 + -3.7381209e-02 -1.6223869e-01 + -2.3748500e+00 + -2.5686588e+00 + 2.0881071e+00 + 6.2789547e-01 + 4.1221350e-01 + 4.5529962e-01 + 2.6639309e+00 + -1.2755105e+00 + -1.1172168e+00 + 3.7316844e-01 + 6.5976131e-01 + 1.1922665e+00 + 2.1009294e-02 + 3.0408671e+00 + 1.0986918e+00 + -1.9050267e+00 + 1.0913959e+00 + 2.2108128e+00 + -4.3493447e-01 + 4.3866372e-01 + 9.9394280e-01 + 8.0457723e-01 + 2.7944240e-01 + 2.9069493e+00 + 9.4710332e-01 + 3.9066190e-01 + -1.0005380e+00 + 4.5449706e-03 + 2.5553635e-01 + 1.3005282e-01 + 1.4450583e-03 + 3.1766063e-01 + -3.6091042e-01 + 2.4238717e-02 + -1.2383690e-02 + -3.4467268e-01 + 1.9925807e-02 + -1.8981735e-03 + -1.2539268e+00 + 2.1309783e+00 + -8.9311349e-01 + 5.2453309e-01 + -1.0139318e+00 + -2.2817013e+00 + 2.3466904e+00 + 7.0327646e-01 + -2.3891058e-02 + -1.1855311e+00 + -1.3971887e+00 + -7.2869855e-01 + -1.7265791e+00 + 1.2025254e-02 + -6.5376842e-01 + -4.1656005e-03 + 8.0084456e-03 + 2.3534586e+00 + 2.7951398e-01 + -1.6088476e-02 + 1.2792153e+00 + 8.4814884e-02 + 5.4550028e-01 + 5.6542766e-01 + -4.1585934e-01 + 4.8540604e-01 1.0673543e+00 -3.2270724e-01 + -8.6658448e-01 + -4.8507249e-01 + -7.8170061e-01 + -1.1520298e+00 + 1.2422403e+00 + 5.5944973e-01 + -6.7864263e-01 + -1.8522002e+00 + -8.9412475e-01 + -1.3485178e+00 + -1.4263954e+00 + -7.7234089e-01 + -1.2952981e+00 + -2.2568528e-02 + 1.7096540e+00 + -9.2771471e-01 + -1.0045508e-02 + -6.1810076e-01 + 1.0606502e-01 + 1.5824664e-01 + 9.2054254e-01 + 3.9360362e-01 + 5.3959233e-01 + 3.7539884e-01 + 1.8888235e-01 + -9.9117738e-01 + -6.5255439e-01 + 6.6553319e-01 + -1.0562721e+00 + -1.5344197e+00 + 2.9541078e+00 + -1.2878127e+00 + -2.4095502e+00 + -9.5952678e-01 + 9.8164451e-01 + -1.2405845e+00 + -1.9599315e+00 + -9.5725805e-01 + -7.6509431e-02 + 5.4049317e-02 + -5.1446116e-01 + 1.3117826e-01 + 1.7163970e+00 + -1.5993770e+00 + 4.7730151e-01 + 1.1395724e+00 + 3.8936225e-01 + -3.0346897e-01 + 4.2881086e-01 + 9.9328347e-03 + -2.2609261e-01 + 7.2406143e-02 + -1.1794700e-01 + 1.8234780e+00 + 7.2431898e-01 + -2.4203742e+00 + 1.4702298e-02 + 2.2277474e+00 + -1.8962531e+00 + -1.2740175e+00 + 1.5537256e+00 + 1.3044652e+00 + -7.4026924e-01 + -6.1715835e-01 1.6096928e+00 + 1.6230518e+00 + 4.5344341e-01 + 1.3807112e+00 + 2.0514281e+00 + 1.1010884e+00 + -4.9849726e-02 + 6.7467374e-01 + 1.1910535e+00 + -1.5555643e-02 + -2.2061069e-01 + -4.8576653e-02 + 9.3939744e-02 + -2.2496290e+00 + -5.0419599e-01 + 2.0812116e+00 + -5.9655833e-01 + 3.5521922e-01 + -7.2760032e-03 + -2.1872017e+00 + -6.9883293e-01 + -3.1092903e-01 + -5.3563565e-01 + -1.3020818e+00 + -7.9382402e-01 + -3.7149054e-01 + 1.2416965e-01 + -2.8357333e-02 + 2.6627953e+00 + 5.1625454e-01 + 5.0960559e-01 + 7.8359121e-01 + -2.3101887e-01 + 5.7583090e-02 + 9.8995632e-01 + 2.2056359e-01 + -1.1847482e-02 + 8.6801358e-02 + 1.7035109e-01 + 6.1647040e-01 + -1.2632349e+00 + 1.7515757e+00 + -1.4545732e+00 + -2.1161871e+00 + 2.5635638e+00 + -1.1859236e+00 + -1.5923337e+00 + -2.4042067e-01 + -4.4122183e-01 + -1.5606081e+00 + -1.2500426e+00 + -1.7763856e-01 + -7.9275995e-01 + -2.7929199e-01 + 3.6582991e-02 + -4.3476064e-02 + -1.8088571e+00 + 8.5589492e-01 + 6.4718942e-03 + 9.2306399e-01 + -8.4185861e-02 + -2.9375482e-01 + -1.8310229e+00 + -1.0798825e+00 + -7.9118240e-01 7.0881331e-01 - -1.3262657e+00 - -8.6658448e-01 - 1.6230518e+00 1.2062315e+00 - 3.0736292e-02 - -4.8507249e-01 - 4.5344341e-01 -1.7728055e+00 - -5.8851665e-01 - -7.8170061e-01 - 1.3807112e+00 9.6331704e-01 - -7.3222792e-01 - -1.1520298e+00 - 2.0514281e+00 2.6125135e+00 - -1.5638385e+00 - 1.2422403e+00 - 1.1010884e+00 -1.8981603e+00 - 4.6118131e-01 - 5.5944973e-01 - -4.9849726e-02 8.7087512e-01 - -3.2569520e+00 - -6.7864263e-01 - 6.7467374e-01 2.2641261e-01 - 5.7670671e-01 - -1.8522002e+00 - 1.1910535e+00 1.4858695e+00 - -1.4665792e+00 - -8.9412475e-01 - -1.5555643e-02 4.9453866e-01 - -4.9826938e-01 - -1.3485178e+00 - -2.2061069e-01 1.9170229e-01 - 1.3705933e-02 - -1.4263954e+00 - -4.8576653e-02 9.5411420e-02 - -5.1099718e-01 - -7.7234089e-01 - 9.3939744e-02 -7.5306031e-03 - -8.4642690e-01 - -1.2952981e+00 - -2.2496290e+00 -9.5707327e-01 - -7.8080469e-01 - -2.2568528e-02 - -5.0419599e-01 -1.5813330e-01 - 1.2654436e-02 - 1.7096540e+00 - 2.0812116e+00 -9.0956151e-01 - -2.7438506e-01 - -9.2771471e-01 - -5.9655833e-01 -2.1653114e-01 - -2.0754540e-02 - -1.0045508e-02 - 3.5521922e-01 -4.9730367e-03 - -3.0306621e-02 - -6.1810076e-01 - -7.2760032e-03 -2.4689667e-01 - -9.3479287e-03 - 1.0606502e-01 - -2.1872017e+00 -2.3451116e+00 - -5.4334048e-03 - 1.5824664e-01 - -6.9883293e-01 -1.0507596e+00 - -1.2689747e-01 - 9.2054254e-01 - -3.1092903e-01 -1.7526303e-01 - -2.2519223e-02 - 3.9360362e-01 - -5.3563565e-01 3.8229361e-01 - -4.3745410e-02 - 5.3959233e-01 - -1.3020818e+00 -2.7115783e-01 - -2.8851228e-03 - 3.7539884e-01 - -7.9382402e-01 -7.2198820e-01 - -1.5458927e-02 - 1.8888235e-01 - -3.7149054e-01 -7.6774979e-01 - -6.1468780e-01 - -9.9117738e-01 - 1.2416965e-01 -3.5376068e-02 - 1.4645875e-01 - -6.5255439e-01 - -2.8357333e-02 -1.6877948e+00 - 1.2905836e-02 - 6.6553319e-01 - 2.6627953e+00 2.2042987e+00 - 6.0230404e-01 - -1.0562721e+00 - 5.1625454e-01 -1.3156476e+00 - -8.4150290e-01 - -1.5344197e+00 - 5.0960559e-01 -1.1831834e+00 - 1.4424776e+00 - 2.9541078e+00 - 7.8359121e-01 3.1802005e-01 - -9.7326213e-01 - -1.2878127e+00 - -2.3101887e-01 -8.3778602e-01 - 3.0522365e-02 - -2.4095502e+00 - 5.7583090e-02 -8.2950598e-01 - 3.4058121e-01 - -9.5952678e-01 - 9.8995632e-01 1.6555600e-01 - -4.8826955e-02 - 9.8164451e-01 - 2.2056359e-01 6.1222214e-01 - -2.2871600e-02 - -1.2405845e+00 - -1.1847482e-02 -7.0693541e-01 - 3.5584363e-01 - -1.9599315e+00 - 8.6801358e-02 -9.8468047e-01 - -4.7543454e-01 - -9.5725805e-01 - 1.7035109e-01 -6.1086416e-01 - 9.6900873e-03 - -7.6509431e-02 - 6.1647040e-01 -8.5837252e-02 - -1.0432316e+00 - 5.4049317e-02 - -1.2632349e+00 1.7477356e-02 - -7.1644142e-02 - -5.1446116e-01 - 1.7515757e+00 4.4124016e-01 - -1.0891576e-01 - 1.3117826e-01 - -1.4545732e+00 1.5600188e-01 - -1.0264823e+00 - 1.7163970e+00 - -2.1161871e+00 -2.7659209e+00 - 1.1914859e-02 - -1.5993770e+00 - 2.5635638e+00 1.2586774e+00 - -2.1482437e+00 - 4.7730151e-01 - -1.1859236e+00 1.6749135e+00 - -4.9972497e-02 - 1.1395724e+00 - -1.5923337e+00 -1.3794301e+00 - -1.8817082e-01 - 3.8936225e-01 - -2.4042067e-01 -8.5450149e-01 - -5.9953374e-01 - -3.0346897e-01 - -4.4122183e-01 8.8261575e-01 - -8.0668241e-01 - 4.2881086e-01 - -1.5606081e+00 4.2859793e-01 - -1.3742676e+00 - 9.9328347e-03 - -1.2500426e+00 -1.0895256e+00 - -7.3715031e-01 - -2.2609261e-01 - -1.7763856e-01 -1.1882263e+00 - 1.6049725e-01 - 7.2406143e-02 - -7.9275995e-01 1.9274653e+00 - -1.0577695e+00 - -1.1794700e-01 - -2.7929199e-01 3.0877551e-01 - -1.2493926e-01 - 1.8234780e+00 - 3.6582991e-02 -1.1440312e+00 - -1.6081604e-01 - 7.2431898e-01 - -4.3476064e-02 5.7223046e-01 - -3.0296910e+00 - -2.4203742e+00 - -1.8088571e+00 7.9032326e-01 - 3.2279447e-02 - 1.4702298e-02 - 8.5589492e-01 -4.4538689e-01 - -1.6863515e+00 - 2.2277474e+00 - 6.4718942e-03 -5.3397065e-01 - -5.3375709e-01 - -1.8962531e+00 - 9.2306399e-01 6.1104411e-01 - -9.9028684e-03 - -1.2740175e+00 - -8.4185861e-02 2.9369900e-01 - -3.2829079e-01 - 1.5537256e+00 - -2.9375482e-01 1.9377233e-02 - -7.7071440e-01 - 1.3044652e+00 - -1.8310229e+00 -5.2994013e-01 - -3.1108278e-01 - -7.4026924e-01 - -1.0798825e+00 4.3720734e-01 - -7.8779936e-01 - -6.1715835e-01 - -7.9118240e-01 1.4634629e-01 + -1.3262657e+00 + 3.0736292e-02 + -5.8851665e-01 + -7.3222792e-01 + -1.5638385e+00 + 4.6118131e-01 + -3.2569520e+00 + 5.7670671e-01 + -1.4665792e+00 + -4.9826938e-01 + 1.3705933e-02 + -5.1099718e-01 + -8.4642690e-01 + -7.8080469e-01 + 1.2654436e-02 + -2.7438506e-01 + -2.0754540e-02 + -3.0306621e-02 + -9.3479287e-03 + -5.4334048e-03 + -1.2689747e-01 + -2.2519223e-02 + -4.3745410e-02 + -2.8851228e-03 + -1.5458927e-02 + -6.1468780e-01 + 1.4645875e-01 + 1.2905836e-02 + 6.0230404e-01 + -8.4150290e-01 + 1.4424776e+00 + -9.7326213e-01 + 3.0522365e-02 + 3.4058121e-01 + -4.8826955e-02 + -2.2871600e-02 + 3.5584363e-01 + -4.7543454e-01 + 9.6900873e-03 + -1.0432316e+00 + -7.1644142e-02 + -1.0891576e-01 + -1.0264823e+00 + 1.1914859e-02 + -2.1482437e+00 + -4.9972497e-02 + -1.8817082e-01 + -5.9953374e-01 + -8.0668241e-01 + -1.3742676e+00 + -7.3715031e-01 + 1.6049725e-01 + -1.0577695e+00 + -1.2493926e-01 + -1.6081604e-01 + -3.0296910e+00 + 3.2279447e-02 + -1.6863515e+00 + -5.3375709e-01 + -9.9028684e-03 + -3.2829079e-01 + -7.7071440e-01 + -3.1108278e-01 + -7.8779936e-01 -1.3045032e+00 +@ q_scaler 30 4.9530282e-03 4.9530282e-03 4.9530282e-03 From 3f033708728df0b46ef0f67170c44d9fc92e7a9a Mon Sep 17 00:00:00 2001 From: SY Wang Date: Wed, 25 Nov 2026 03:41:21 +0800 Subject: [PATCH 3/4] Test NEP in CI --- .github/workflows/test.yml | 3 ++- tests/04_FF/CASES_CPU.txt | 2 +- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index 652b1907378..da102ea6d13 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -77,7 +77,7 @@ jobs: - name: Install external tools from toolchain run: | cd toolchain - ./install_abacus_toolchain_new.sh --with-dftd4=install --dry-run -j8 + ./install_abacus_toolchain_new.sh --with-dftd4 --with-nep --dry-run -j8 ./scripts/stage4/install_stage4.sh cd .. @@ -131,6 +131,7 @@ jobs: -DENABLE_FLOAT_FFTW=ON \ -DENABLE_DFTD4=ON \ -DENABLE_PEXSI=ON \ + -DENABLE_NEP=ON \ -Werror=dev - name: Build diff --git a/tests/04_FF/CASES_CPU.txt b/tests/04_FF/CASES_CPU.txt index 4f66a60ae0a..1a297373a67 100644 --- a/tests/04_FF/CASES_CPU.txt +++ b/tests/04_FF/CASES_CPU.txt @@ -19,7 +19,7 @@ 19_LJ_RE_stop 20_LJ_dry_run #50_DP_Al -#101_NEP_HfO2 +101_NEP_HfO2 102_SNAP_base 103_SNAP_pbc 104_SNAP_inner From 64bb58dd55f688dff0dbd58c24ec21fd858352a1 Mon Sep 17 00:00:00 2001 From: SY Wang Date: Wed, 25 Nov 2026 04:20:33 +0800 Subject: [PATCH 4/4] Fix CI failure --- source/source_md/unittests/CMakeLists.txt | 1 + source/source_md/unittests/test_nep_forcefield.cpp | 6 +----- 2 files changed, 2 insertions(+), 5 deletions(-) diff --git a/source/source_md/unittests/CMakeLists.txt b/source/source_md/unittests/CMakeLists.txt index e99f3f0856e..a323110e6d6 100644 --- a/source/source_md/unittests/CMakeLists.txt +++ b/source/source_md/unittests/CMakeLists.txt @@ -147,6 +147,7 @@ addtest( set(_md_nep_test_libs parameter psi device) if(ENABLE_NEP) list(APPEND _md_nep_test_libs nep::nep_cpu) + configure_file("${ABACUS_TEST_DIR}/PP_ORB/nep_hfo2.txt" nep_hfo2.txt COPYONLY) endif() addtest( diff --git a/source/source_md/unittests/test_nep_forcefield.cpp b/source/source_md/unittests/test_nep_forcefield.cpp index 9038a344e56..cba5df324aa 100644 --- a/source/source_md/unittests/test_nep_forcefield.cpp +++ b/source/source_md/unittests/test_nep_forcefield.cpp @@ -11,11 +11,7 @@ TEST(NEPPotential, UnitCellCalculationOrMissingBackend) { - const std::string source_file = __FILE__; - const std::string marker = "/source/source_md/"; - const std::size_t marker_pos = source_file.find(marker); - ASSERT_NE(marker_pos, std::string::npos); - const std::string model_file = source_file.substr(0, marker_pos) + "/tests/PP_ORB/nep_hfo2.txt"; + const std::string model_file = "nep_hfo2.txt"; UnitCell cell; Setcell::setupcell(cell);