Skip to content

Commit 7fa2722

Browse files
authored
Merge branch 'develop' into refactor
2 parents c853656 + e43b1cd commit 7fa2722

File tree

255 files changed

+12431
-3880
lines changed

Some content is hidden

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

255 files changed

+12431
-3880
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'"

.gitignore

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,4 +23,5 @@ __pycache__
2323
abacus.json
2424
*.npy
2525
toolchain/install/
26-
toolchain/abacus_env.sh
26+
toolchain/abacus_env.sh
27+
.trae

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: 6 additions & 2 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,12 +268,12 @@ 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\
273275
esolver_of_interface.o\
274276
pw_others.o\
275-
pw_setup.o\
276277

277278
OBJS_ESOLVER_LCAO=esolver_ks_lcao.o\
278279
esolver_ks_lcao_tddft.o\
@@ -545,7 +546,7 @@ OBJS_IO=input_conv.o\
545546
cal_test.o\
546547
write_dos_pw.o\
547548
nscf_fermi_surf.o\
548-
nscf_band.o\
549+
write_bands.o\
549550
cal_dos.o\
550551
cal_pdos_gamma.o\
551552
cal_pdos_multik.o\
@@ -578,6 +579,7 @@ OBJS_IO=input_conv.o\
578579
write_elecstat_pot.o\
579580
write_elf.o\
580581
write_dipole.o\
582+
write_init.o\
581583
td_current_io.o\
582584
write_libxc_r.o\
583585
output_log.o\
@@ -723,6 +725,7 @@ OBJS_SRCPW=H_Ewald_pw.o\
723725
fp_energy.o\
724726
setup_pot.o\
725727
setup_pwrho.o\
728+
setup_pwwfc.o\
726729
forces.o\
727730
forces_us.o\
728731
forces_nl.o\
@@ -764,6 +767,7 @@ OBJS_SRCPW=H_Ewald_pw.o\
764767
of_stress_pw.o\
765768
symmetry_rho.o\
766769
symmetry_rhog.o\
770+
setup_psi.o\
767771
psi_init.o\
768772
elecond.o\
769773
sto_tool.o\

source/source_cell/module_neighbor/test/prepare_unitcell.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -98,7 +98,7 @@ class UcellTestPrepare
9898
}
9999
//lattice info
100100
ucell->lat0 = this->lat0;
101-
ucell->lat0_angstrom = ucell->lat0 * 0.529177;
101+
ucell->lat0_angstrom = ucell->lat0 * ModuleBase::BOHR_TO_A;
102102
ucell->tpiba = ModuleBase::TWO_PI/ucell->lat0;
103103
ucell->tpiba2 = ucell->tpiba * ucell->tpiba;
104104
ucell->latvec.e11 = this->latvec[0];

source/source_cell/read_atom_species.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -150,7 +150,7 @@ bool read_lattice_constant(std::ifstream& ifa,
150150
{
151151
ModuleBase::WARNING_QUIT("read_atom_species","Lattice constant <= 0.0");
152152
}
153-
lat0_angstrom = lat0 * 0.529177;
153+
lat0_angstrom = lat0 * ModuleBase::BOHR_TO_A;
154154
ModuleBase::GlobalFunc::OUT(ofs_running,"Lattice constant (Bohr)",lat0);
155155
ModuleBase::GlobalFunc::OUT(ofs_running,"Lattice constant (Angstrom)",lat0_angstrom);
156156
lat.tpiba = ModuleBase::TWO_PI / lat0;

0 commit comments

Comments
 (0)