Skip to content

Commit a92b7fa

Browse files
MoseyQAQmohanchen
authored andcommitted
[Feature] Add NEP as esolver (deepmodeling#6603)
* update NEP_CPU * update toolchain and document * update cmake file * update cmake file * update test * update toolchain script * remove nep_cpu; update test case and toolchain script * update unit test * update test.yml * update related doc. --------- Co-authored-by: Mohan Chen <[email protected]>
1 parent 0683497 commit a92b7fa

File tree

119 files changed

+6925
-709
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

119 files changed

+6925
-709
lines changed

.github/workflows/test.yml

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -126,12 +126,12 @@ jobs:
126126
run: |
127127
cmake --build build --target test ARGS="-V --timeout 1700 -R 03_NAO_multik"
128128
129-
- name: 04_LJ_DP Test
129+
- name: 04_FF Test
130130
env:
131131
GTEST_COLOR: 'yes'
132132
OMP_NUM_THREADS: '2'
133133
run: |
134-
cmake --build build --target test ARGS="-V --timeout 1700 -R 04_LJ_DP"
134+
cmake --build build --target test ARGS="-V --timeout 1700 -R 04_FF"
135135
136136
- name: 05_rtTDDFT Test
137137
env:
@@ -180,4 +180,8 @@ jobs:
180180
GTEST_COLOR: 'yes'
181181
OMP_NUM_THREADS: '2'
182182
run: |
183+
<<<<<<< HEAD
183184
cmake --build build --target test ARGS="-V --timeout 1700 -E 'integrate_test|01_PW|02_NAO_Gamma|03_NAO_multik|04_LJ_DP|05_rtTDDFT|06_SDFT|07_OFDFT|08_EXX|09_DeePKS|10_others|11_PW_GPU|12_NAO_Gamma_GPU|13_NAO_multik_GPU|15_rtTDDFT_GPU|16_SDFT_GPU|MODULE_BASE|MODULE_IO|MODULE_HSOLVER|MODULE_CELL|MODULE_MD|MODULE_PSI|MODULE_RI'"
185+
=======
186+
cmake --build build --target test ARGS="-V --timeout 1700 -E 'integrate_test|01_PW|02_NAO_Gamma|03_NAO_multik|04_FF|05_rtTDDFT|06_SDFT|07_OFDFT|08_EXX|09_DeePKS|10_others|11_PW_GPU|12_NAO_Gamma_GPU|13_NAO_multik_GPU|15_rtTDDFT_GPU|16_SDFT_GPU|MODULE_BASE|MODULE_IO|MODULE_HSOLVER|MODULE_CELL|MODULE_MD|source_psi|MODULE_RI'"
187+
>>>>>>> f6e15df90 ([Feature] Add NEP as esolver (#6603))

CMakeLists.txt

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -629,6 +629,15 @@ if(DEFINED DeePMD_DIR)
629629
endif()
630630
endif()
631631

632+
if(DEFINED NEP_DIR)
633+
find_package(NEP REQUIRED)
634+
635+
if(NEP_FOUND)
636+
add_compile_definitions(__NEP)
637+
target_link_libraries(${ABACUS_BIN_NAME} NEP::nep)
638+
endif()
639+
endif()
640+
632641
if(DEFINED TensorFlow_DIR)
633642
find_package(TensorFlow REQUIRED)
634643
include_directories(${TensorFlow_DIR}/include)

cmake/FindNEP.cmake

Lines changed: 49 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,49 @@
1+
###############################################################################
2+
# - Find NEP
3+
# Finds the NEP header and library.
4+
#
5+
# This module will search for the NEP library, looking for a hint
6+
# from the NEP_DIR environment variable or CMake variable.
7+
#
8+
# This module defines the following variables:
9+
#
10+
# NEP_FOUND - True if the NEP library and headers were found.
11+
# NEP_INCLUDE_DIR - The directory where nep.h is located.
12+
# NEP_LIBRARY - The full path to the NEP library.
13+
#
14+
# It also defines the following imported target:
15+
#
16+
# NEP::nep - The NEP library target.
17+
#
18+
###############################################################################
19+
# Note: Currently only CPU version is supported, Since the NEP interface with GPU support is not available yet.
20+
# In feature, if available, we can use USE_CUDA to switch between CPU and GPU version.
21+
22+
find_path(NEP_INCLUDE_DIR nep.h
23+
HINTS ${NEP_DIR}
24+
PATH_SUFFIXES "include"
25+
)
26+
27+
find_library(NEP_LIBRARY
28+
NAMES nep
29+
HINTS ${NEP_DIR}
30+
PATH_SUFFIXES "lib"
31+
)
32+
33+
include(FindPackageHandleStandardArgs)
34+
find_package_handle_standard_args(NEP
35+
DEFAULT_MSG
36+
NEP_LIBRARY NEP_INCLUDE_DIR)
37+
38+
if(NEP_FOUND)
39+
if(NOT TARGET NEP::nep)
40+
add_library(NEP::nep UNKNOWN IMPORTED)
41+
set_target_properties(NEP::nep PROPERTIES
42+
IMPORTED_LINK_INTERFACE_LANGUAGES "C"
43+
IMPORTED_LOCATION "${NEP_LIBRARY}"
44+
INTERFACE_INCLUDE_DIRECTORIES "${NEP_INCLUDE_DIR}"
45+
)
46+
endif()
47+
endif()
48+
49+
mark_as_advanced(NEP_INCLUDE_DIR NEP_LIBRARY)

0 commit comments

Comments
 (0)