Skip to content

Commit b772976

Browse files
authored
Merge branch 'develop' into DeleteConstNumber
2 parents b041580 + 5da1df7 commit b772976

File tree

146 files changed

+3726
-469
lines changed

Some content is hidden

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

146 files changed

+3726
-469
lines changed

.github/workflows/test.yml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -132,12 +132,12 @@ jobs:
132132
run: |
133133
cmake --build build --target test ARGS="-V --timeout 1700 -R 03_NAO_multik"
134134
135-
- name: 04_LJ_DP Test
135+
- name: 04_FF Test
136136
env:
137137
GTEST_COLOR: 'yes'
138138
OMP_NUM_THREADS: '2'
139139
run: |
140-
cmake --build build --target test ARGS="-V --timeout 1700 -R 04_LJ_DP"
140+
cmake --build build --target test ARGS="-V --timeout 1700 -R 04_FF"
141141
142142
- name: 05_rtTDDFT Test
143143
env:
@@ -186,4 +186,4 @@ jobs:
186186
GTEST_COLOR: 'yes'
187187
OMP_NUM_THREADS: '2'
188188
run: |
189-
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|source_psi|MODULE_RI'"
189+
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'"

CMakeLists.txt

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -654,6 +654,15 @@ if(DEFINED DeePMD_DIR)
654654
endif()
655655
endif()
656656

657+
if(DEFINED NEP_DIR)
658+
find_package(NEP REQUIRED)
659+
660+
if(NEP_FOUND)
661+
add_compile_definitions(__NEP)
662+
target_link_libraries(${ABACUS_BIN_NAME} NEP::nep)
663+
endif()
664+
endif()
665+
657666
if(DEFINED TensorFlow_DIR)
658667
find_package(TensorFlow REQUIRED)
659668
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)

docs/advanced/input_files/input-main.md

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -535,6 +535,7 @@ These variables are used to control general system parameters.
535535
- tddft: real-time time-dependent density functional theory (TDDFT)
536536
- lj: Leonard Jones potential
537537
- dp: DeeP potential, see details in [md.md](../md.md#dpmd)
538+
- nep: Neuroevolution Potential, see details in [md.md](../md.md#nep)
538539
- ks-lr: Kohn-Sham density functional theory + LR-TDDFT (Under Development Feature)
539540
- lr: LR-TDDFT with given KS orbitals (Under Development Feature)
540541
- **Default**: ksdft
@@ -2310,7 +2311,7 @@ Warning: this function is not robust enough for the current version. Please try
23102311
- 0: Don't include bandgap label
23112312
- 1: Include target bandgap label (see [deepks\_band\_range](#deepks_band_range) for more details)
23122313
- 2: Include multiple bandgap label (see [deepks\_band\_range](#deepks_band_range) for more details)
2313-
- 3: For systems containing H atoms only, HOMO is defined as the max occupation expect H atoms and the bandgap label is the energy between HOMO and (HOMO + 1)
2314+
- 3: Used for systems containing H atoms. Here HOMO is defined as the max occupation except H atoms and the bandgap label is the energy between HOMO and (HOMO + 1)
23142315
- **Default**: 0
23152316

23162317
### deepks_band_range
@@ -3327,7 +3328,7 @@ These variables are used to control molecular dynamics calculations. For more in
33273328
### pot_file
33283329

33293330
- **Type**: String
3330-
- **Description**: The filename of DP potential files, see [md.md](../md.md#dpmd) in detail.
3331+
- **Description**: The filename of DP/NEP potential files, see [md.md](../md.md#dpmd) in detail.
33313332
- **Default**: graph.pb
33323333

33333334
### dp_rescaling

docs/advanced/install.md

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -55,6 +55,17 @@ Similarly, DeePMD-kit supports PyTorch backend but its libraries are placed at a
5555
cmake -B build -DDeePMD_DIR=/dir_to_deepmd-kit -DTorch_DIR=/dir_to_pytorch
5656
```
5757

58+
## Build with NEP
59+
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:
60+
```bash
61+
./install_abacus_toolchain.sh --with-nep=install
62+
```
63+
64+
To build ABACUS:
65+
```bash
66+
cmake -B build -DNEP_DIR=/path/to/nep_cpu
67+
```
68+
5869
## Build with LibRI and LibComm
5970

6071
The new EXX implementation depends on two external libraries:

docs/advanced/md.md

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -87,4 +87,8 @@ ABACUS performs the [Multi-Scale Shock Technique (MSST) integration](https://jou
8787
Compiling ABACUS with [DeePMD-kit](https://github.com/deepmodeling/deepmd-kit), MD calculations based on machine learning DP model is enabled.
8888

8989
To employ DPMD calculations, [esolver_type](./input_files/input-main.md#esolver_type) should be set to `dp`.
90-
And the filename of DP model is specified by keyword [pot_file](./input_files/input-main.md#pot_file).
90+
And the filename of DP model is specified by keyword [pot_file](./input_files/input-main.md#pot_file).
91+
92+
## NEP
93+
94+
If ABACUS is compiled with the Neuroevolution Potential ([NEP](https://gpumd.org/potentials/nep.html)), MD simulations using NEP models are enabled. To use this feature, set [esolver_type](./input_files/input-main.md#esolver_type) to `nep` and specify the potential file path with the [pot_file](./input_files/input-main.md#pot_file) keyword in your INPUT file.

source/Makefile.Objects

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -250,6 +250,7 @@ OBJS_ELECSTAT=elecstate.o\
250250
read_pseudo.o\
251251
cal_wfc.o\
252252
setup_estate_pw.o\
253+
update_pot.o\
253254

254255
OBJS_ELECSTAT_LCAO=elecstate_lcao.o\
255256
elecstate_lcao_cal_tau.o\
@@ -267,6 +268,7 @@ OBJS_ESOLVER=esolver.o\
267268
esolver_sdft_pw.o\
268269
esolver_lj.o\
269270
esolver_dp.o\
271+
esolver_nep.o\
270272
esolver_of.o\
271273
esolver_of_tddft.o\
272274
esolver_of_tool.o\
@@ -764,6 +766,7 @@ OBJS_SRCPW=H_Ewald_pw.o\
764766
of_stress_pw.o\
765767
symmetry_rho.o\
766768
symmetry_rhog.o\
769+
setup_psi.o\
767770
psi_init.o\
768771
elecond.o\
769772
sto_tool.o\

source/source_esolver/CMakeLists.txt

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@ list(APPEND objects
77
esolver_sdft_pw.cpp
88
esolver_lj.cpp
99
esolver_dp.cpp
10+
esolver_nep.cpp
1011
esolver_of.cpp
1112
esolver_of_tddft.cpp
1213
esolver_of_interface.cpp

source/source_esolver/esolver.cpp

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,7 @@ extern "C"
1818
}
1919
#endif
2020
#include "esolver_dp.h"
21+
#include "esolver_nep.h"
2122
#include "esolver_lj.h"
2223
#include "esolver_of.h"
2324
#include "esolver_of_tddft.h"
@@ -97,6 +98,10 @@ std::string determine_type()
9798
{
9899
esolver_type = "dp_pot";
99100
}
101+
else if (PARAM.inp.esolver_type == "nep")
102+
{
103+
esolver_type = "nep_pot";
104+
}
100105
else if (esolver_type == "none")
101106
{
102107
ModuleBase::WARNING_QUIT("ESolver", "No such esolver_type combined with basis_type");
@@ -338,6 +343,10 @@ ESolver* init_esolver(const Input_para& inp, UnitCell& ucell)
338343
{
339344
return new ESolver_DP(PARAM.mdp.pot_file);
340345
}
346+
else if (esolver_type == "nep_pot")
347+
{
348+
return new ESolver_NEP(PARAM.mdp.pot_file);
349+
}
341350
throw std::invalid_argument("esolver_type = " + std::string(esolver_type) + ". Wrong in " + std::string(__FILE__)
342351
+ " line " + std::to_string(__LINE__));
343352
}

0 commit comments

Comments
 (0)