Skip to content

Commit 32ec806

Browse files
committed
Merge branch 'develop' into sunway
2 parents 03c1172 + c873197 commit 32ec806

File tree

2,996 files changed

+61523
-36613
lines changed

Some content is hidden

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

2,996 files changed

+61523
-36613
lines changed

.github/workflows/build_test_cmake.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -17,10 +17,10 @@ jobs:
1717
name: "Build with Intel toolchain"
1818

1919
- tag: gnu
20-
build_args: "-DENABLE_LIBXC=1 -DENABLE_DEEPKS=1 -DENABLE_MLKEDF=1 -DENABLE_LIBRI=1"
20+
build_args: "-DENABLE_LIBXC=1 -DDENABLE_MLALGO=1 -DENABLE_LIBRI=1"
2121
name: "Build extra components with GNU toolchain"
2222
- tag: intel
23-
build_args: "-DENABLE_LIBXC=1 -DENABLE_DEEPKS=1 -DENABLE_MLKEDF=1 -DENABLE_LIBRI=1"
23+
build_args: "-DENABLE_LIBXC=1 -DENABLE_MLALGO=1 -DENABLE_LIBRI=1"
2424
name: "Build extra components with Intel toolchain"
2525

2626
- tag: cuda

.github/workflows/coverage.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ jobs:
1818
apt update && apt install -y lcov gpg curl jq ca-certificates
1919
- name: Building
2020
run: |
21-
cmake -B build -DENABLE_COVERAGE=ON -DBUILD_TESTING=ON -DENABLE_DEEPKS=ON -DENABLE_LIBXC=ON -DENABLE_LIBRI=ON -DENABLE_GOOGLEBENCH=ON -DENABLE_RAPIDJSON=ON
21+
cmake -B build -DENABLE_COVERAGE=ON -DBUILD_TESTING=ON -DENABLE_MLALGO=ON -DENABLE_LIBXC=ON -DENABLE_LIBRI=ON -DENABLE_GOOGLEBENCH=ON -DENABLE_RAPIDJSON=ON
2222
cmake --build build -j`nproc`
2323
cmake --install build
2424
- name: Testing

.github/workflows/dynamic.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ jobs:
1616
uses: actions/checkout@v4
1717
- name: Building
1818
run: |
19-
cmake -B build -DENABLE_ASAN=1 -DENABLE_DEEPKS=1 -DENABLE_LIBXC=1
19+
cmake -B build -DENABLE_ASAN=1 -DENABLE_MLALGO=1 -DENABLE_LIBXC=1
2020
cmake --build build -j8
2121
cmake --install build
2222
- name: Testing

.github/workflows/test.yml

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@ jobs:
3131
3232
- name: Configure
3333
run: |
34-
cmake -B build -DBUILD_TESTING=ON -DENABLE_DEEPKS=ON -DENABLE_MLKEDF=ON -DENABLE_LIBXC=ON -DENABLE_LIBRI=ON -DENABLE_GOOGLEBENCH=ON -DENABLE_RAPIDJSON=ON -DCMAKE_EXPORT_COMPILE_COMMANDS=1 -DENABLE_FLOAT_FFTW=ON
34+
cmake -B build -DBUILD_TESTING=ON -DENABLE_MLALGO=ON -DENABLE_LIBXC=ON -DENABLE_LIBRI=ON -DENABLE_GOOGLEBENCH=ON -DENABLE_RAPIDJSON=ON -DCMAKE_EXPORT_COMPILE_COMMANDS=1 -DENABLE_FLOAT_FFTW=ON
3535
3636
# Temporarily removed because no one maintains this now.
3737
# And it will break the CI test workflow.
@@ -91,12 +91,12 @@ jobs:
9191
run: |
9292
cmake --build build --target test ARGS="-V --timeout 1700 -R MODULE_MD"
9393
94-
- name: Module_Psi Unittests
94+
- name: source_psi Unittests
9595
env:
9696
GTEST_COLOR: 'yes'
9797
OMP_NUM_THREADS: '2'
9898
run: |
99-
cmake --build build --target test ARGS="-V --timeout 1700 -R MODULE_PSI"
99+
cmake --build build --target test ARGS="-V --timeout 1700 -R source_psi"
100100
101101
- name: Module_RI Unittests
102102
env:
@@ -180,4 +180,4 @@ jobs:
180180
GTEST_COLOR: 'yes'
181181
OMP_NUM_THREADS: '2'
182182
run: |
183-
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'"
183+
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'"

.github/workflows/version_check.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -25,10 +25,10 @@ jobs:
2525
# Validate version.h matches the release tag
2626
- name: Assert version increment
2727
run: |
28-
CODE_VERSION=$(grep -oP '#define\s+VERSION\s+"\K\d+(\.\d+){2,3}' source/version.h)
28+
CODE_VERSION=$(grep -oP '#define\s+VERSION\s+"\K\d+(\.\d+){2,3}' source/source_main/version.h)
2929
3030
if [[ -z "$CODE_VERSION" ]]; then
31-
echo "::error::Failed to extract version from source/version.h"
31+
echo "::error::Failed to extract version from source/source_main/version.h"
3232
exit 1
3333
fi
3434

CMakeLists.txt

Lines changed: 25 additions & 35 deletions
Original file line numberDiff line numberDiff line change
@@ -22,8 +22,11 @@ option(USE_SUNWAY "Enable Sunway Architecture" OFF)
2222
option(USE_ABACUS_LIBM "Build libmath from source to speed up" OFF)
2323
option(ENABLE_LIBXC "Enable using the LibXC package" OFF)
2424
option(ENABLE_FLOAT_FFTW "Enable using single-precision FFTW library." OFF)
25-
option(ENABLE_DEEPKS "Enable the DeePKS algorithm" OFF)
26-
option(ENABLE_MLKEDF "Enable the Machine-Learning-based KEDF for OFDFT" OFF)
25+
26+
# option(ENABLE_DEEPKS "Enable the DeePKS algorithm" OFF)
27+
# option(ENABLE_MLKEDF "Enable the Machine-Learning-based KEDF for OFDFT" OFF)
28+
29+
option(ENABLE_MLALGO "Enable the machine learning algorithms" OFF)
2730

2831
option(ENABLE_LCAO "Enable LCAO algorithm" ON)
2932
option(USE_ELPA "Enable ELPA for LCAO" ON)
@@ -116,7 +119,7 @@ endif()
116119
# Serial version of ABACUS will not use ELPA
117120
if(NOT ENABLE_MPI)
118121
set(USE_ELPA OFF)
119-
set(ENABLE_DEEPKS OFF)
122+
set(ENABLE_MLALGO OFF)
120123
endif()
121124

122125
# Different exe files of ABACUS
@@ -165,12 +168,12 @@ set(ABACUS_SOURCE_DIR ${CMAKE_CURRENT_SOURCE_DIR}/source)
165168
set(ABACUS_TEST_DIR ${CMAKE_CURRENT_SOURCE_DIR}/tests)
166169
set(ABACUS_BIN_PATH ${CMAKE_CURRENT_BINARY_DIR}/${ABACUS_BIN_NAME})
167170
include_directories(${ABACUS_SOURCE_DIR})
168-
include_directories(${ABACUS_SOURCE_DIR}/module_base/module_container)
171+
include_directories(${ABACUS_SOURCE_DIR}/source_base/module_container)
169172

170173
set(CMAKE_CXX_STANDARD 11)
171174
set(CMAKE_CXX_STANDARD_REQUIRED ON)
172175

173-
add_executable(${ABACUS_BIN_NAME} source/main.cpp)
176+
add_executable(${ABACUS_BIN_NAME} source/source_main/main.cpp)
174177
if(ENABLE_COVERAGE)
175178
add_coverage(${ABACUS_BIN_NAME})
176179
endif()
@@ -250,11 +253,11 @@ if(ENABLE_LCAO)
250253
add_compile_definitions(__PEXSI)
251254
set(CMAKE_CXX_STANDARD 14)
252255
endif()
253-
if(NEW_GINT)
254-
add_compile_definitions(__NEW_GINT)
256+
if(OLD_GINT)
257+
add_compile_definitions(__OLD_GINT)
255258
endif()
256259
else()
257-
set(ENABLE_DEEPKS OFF)
260+
set(ENABLE_MLALGO OFF)
258261
set(ENABLE_LIBRI OFF)
259262
endif()
260263

@@ -361,7 +364,11 @@ if(USE_CUDA)
361364
# ${ABACUS_BIN_NAME} is added before CUDA is enabled
362365
set_property(TARGET ${ABACUS_BIN_NAME}
363366
PROPERTY CUDA_ARCHITECTURES ${CMAKE_CUDA_ARCHITECTURES})
364-
target_link_libraries(${ABACUS_BIN_NAME} cudart nvToolsExt)
367+
if (CUDAToolkit_VERSION VERSION_GREATER_EQUAL 12.9)
368+
target_link_libraries(${ABACUS_BIN_NAME} cudart)
369+
else ()
370+
target_link_libraries(${ABACUS_BIN_NAME} cudart nvToolsExt)
371+
endif ()
365372
include_directories(${CMAKE_CUDA_TOOLKIT_INCLUDE_DIRECTORIES})
366373
if(USE_CUDA)
367374
add_compile_definitions(__CUDA)
@@ -495,8 +502,9 @@ if(ENABLE_FLOAT_FFTW)
495502
add_definitions(-D__ENABLE_FLOAT_FFTW)
496503
endif()
497504

498-
if(ENABLE_DEEPKS)
499-
target_link_libraries(${ABACUS_BIN_NAME} deepks)
505+
if(ENABLE_MLALGO)
506+
target_link_libraries(${ABACUS_BIN_NAME} deepks) # deepks
507+
target_link_libraries(${ABACUS_BIN_NAME} hamilt_mlkedf) # mlkedf
500508

501509
find_path(libnpy_SOURCE_DIR npy.hpp HINTS ${libnpy_INCLUDE_DIR})
502510
if(NOT libnpy_SOURCE_DIR)
@@ -511,32 +519,14 @@ if(ENABLE_DEEPKS)
511519
include_directories(${libnpy_INCLUDE_DIR})
512520
endif()
513521
include_directories(${libnpy_SOURCE_DIR}/include)
514-
add_compile_definitions(__DEEPKS)
515-
endif()
516-
517-
if(ENABLE_MLKEDF)
518-
target_link_libraries(${ABACUS_BIN_NAME} hamilt_mlkedf)
519-
520-
find_path(libnpy_SOURCE_DIR npy.hpp HINTS ${libnpy_INCLUDE_DIR})
521-
if(NOT libnpy_SOURCE_DIR)
522-
include(FetchContent)
523-
FetchContent_Declare(
524-
libnpy
525-
GIT_REPOSITORY https://github.com/llohse/libnpy.git
526-
GIT_SHALLOW TRUE
527-
GIT_PROGRESS TRUE)
528-
FetchContent_MakeAvailable(libnpy)
529-
else()
530-
include_directories(${libnpy_INCLUDE_DIR})
531-
endif()
532-
include_directories(${libnpy_SOURCE_DIR}/include)
533-
add_compile_definitions(__MLKEDF)
522+
523+
add_compile_definitions(__MLALGO)
534524
endif()
535525

536526
# Torch uses outdated components to detect CUDA arch, causing failure on
537527
# latest CUDA kits. Set CMake variable TORCH_CUDA_ARCH_LIST in the form of
538528
# "major.minor" if required.
539-
if(ENABLE_DEEPKS OR ENABLE_MLKEDF OR DEFINED Torch_DIR)
529+
if(ENABLE_MLALGO OR DEFINED Torch_DIR)
540530
find_package(Torch REQUIRED)
541531
if(NOT Torch_VERSION VERSION_LESS "2.1.0")
542532
set_if_higher(CMAKE_CXX_STANDARD 17)
@@ -760,9 +750,9 @@ target_link_libraries(
760750
hsolver
761751
elecstate
762752
hamilt_general
763-
hamilt_pwdft
764-
hamilt_ofdft
765-
hamilt_stodft
753+
module_pwdft
754+
module_ofdft
755+
module_stodft
766756
psi
767757
psi_initializer
768758
psi_overall_init

Dockerfile.gnu

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@ ADD https://api.github.com/repos/deepmodeling/abacus-develop/git/refs/heads/deve
3434

3535
RUN git clone https://github.com/deepmodeling/abacus-develop.git --depth 1 && \
3636
cd abacus-develop && \
37-
cmake -B build -DENABLE_DEEPKS=ON -DENABLE_LIBXC=ON -DENABLE_LIBRI=ON -DENABLE_RAPIDJSON=ON && \
37+
cmake -B build -DENABLE_MLALGO=ON -DENABLE_LIBXC=ON -DENABLE_LIBRI=ON -DENABLE_RAPIDJSON=ON && \
3838
cmake --build build -j`nproc` && \
3939
cmake --install build && \
4040
rm -rf build

Dockerfile.intel

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -58,7 +58,7 @@ ADD https://api.github.com/repos/deepmodeling/abacus-develop/git/refs/heads/deve
5858
RUN source /opt/intel/oneapi/setvars.sh && \
5959
git clone https://github.com/deepmodeling/abacus-develop.git --depth 1 && \
6060
cd abacus-develop && \
61-
cmake -B build -DENABLE_DEEPKS=ON -DENABLE_LIBXC=ON -DENABLE_LIBRI=ON -DENABLE_RAPIDJSON=ON && \
61+
cmake -B build -DENABLE_MLALGO=ON -DENABLE_LIBXC=ON -DENABLE_LIBRI=ON -DENABLE_RAPIDJSON=ON && \
6262
cmake --build build -j`nproc` && \
6363
cmake --install build && \
6464
rm -rf build && \

conda/meta.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@ build:
2626
skip: true # [not linux]
2727
script: |
2828
export CMAKE_PREFIX_PATH=`python -c "import torch;print(torch.__path__[0])"`/share/cmake:$CMAKE_PREFIX_PATH
29-
cmake -B conda_build ${CMAKE_ARGS} -DCMAKE_BUILD_TYPE=Release -DENABLE_DEEPKS=1 -DENABLE_LIBXC=1
29+
cmake -B conda_build ${CMAKE_ARGS} -DCMAKE_BUILD_TYPE=Release -DENABLE_MLALGO=1 -DENABLE_LIBXC=1
3030
cmake --build conda_build -j`nproc`
3131
cmake --install conda_build
3232
# ${CMAKE_ARGS} applys restrictions for CMake to search libs under conda building env.

docs/CONTRIBUTING.md

Lines changed: 21 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -39,53 +39,51 @@ The source code of ABACUS is based on several modules. Under the ABACUS root dir
3939
For those who are interested in the source code, the following figure shows the structure of the source code.
4040

4141
```text
42-
|-- module_base A basic module including
42+
|-- source_base A basic module including
4343
| | (1) Mathematical library interface functions: BLAS, LAPACK, Scalapack;
4444
| | (2) Custom data classes: matrix, vector definitions and related functions;
4545
| | (3) Parallelization functions: MPI, OpenMP;
4646
| | (4) Utility functions: timer, random number generator, etc.
4747
| | (5) Global parameters: input parameters, element names, mathematical and physical constants.
4848
| |-- module_container The container module for storing data and performing operations on them and on different architectures.
49-
|-- module_basis Basis means the basis set to expand the wave function.
49+
|-- source_basis Basis means the basis set to expand the wave function.
5050
| |-- module_ao Atomic orbital basis set to be refactored.
5151
| |-- module_nao New numerical atomic orbital basis set for two-center integrals in LCAO calculations
5252
| `-- module_pw Data structures and relevant methods for planewave involved calculations
53-
|-- module_cell The module for defining the unit cell and its operations, and reading pseudopotentials.
53+
|-- source_cell The module for defining the unit cell and its operations, and reading pseudopotentials.
5454
| |-- module_neighbor The module for finding the neighbors of each atom in the unit cell.
5555
| |-- module_paw The module for performing PAW calculations.
5656
| |-- module_symmetry The module for finding the symmetry operations of the unit cell.
57-
|-- module_elecstate The module for defining the electronic state and its operations.
57+
|-- source_estate The module for defining the electronic state and its operations.
5858
| |-- module_charge The module for calculating the charge density, charge mixing
5959
| |-- potentials The module for calculating the potentials, including Hartree, exchange-correlation, local pseudopotential, etc.
60-
|-- module_esolver The module defining task-specific driver of corresponding workflow for evaluating energies, forces, etc., including lj, dp, ks, sdft, ofdft, etc.
60+
|-- source_esolver The module defining task-specific driver of corresponding workflow for evaluating energies, forces, etc., including lj, dp, ks, sdft, ofdft, etc.
6161
| | TDDFT, Orbital-free DFT, etc.
62-
|-- module_hamilt_general The module for defining general Hamiltonian that can be used both in PW and LCAO calculations.
62+
|-- source_hamilt The module for defining general Hamiltonian that can be used both in PW and LCAO calculations.
6363
| |-- module_ewald The module for calculating the Ewald summation.
6464
| |-- module_surchem The module for calculating the surface charge correction.
6565
| |-- module_vdw The module for calculating the van der Waals correction.
6666
| |-- module_xc The module for calculating the exchange-correlation energy and potential.
67-
|-- module_hamilt_lcao The module for defining the Hamiltonian in LCAO calculations.
67+
|-- source_lcao The module for defining the Hamiltonian in LCAO calculations.
6868
| |-- hamilt_lcaodft The module for defining the Hamiltonian in LCAO-DFT calculations.
6969
| | |-- operator_lcao The module for defining the operators in LCAO-DFT calculations.
7070
| |-- module_deepks The module for defining the Hamiltonian in DeepKS calculations.
7171
| |-- module_dftu The module for defining the Hamiltonian in DFT+U calculations.
7272
| |-- module_gint The module for performing grid integral in LCAO calculations.
7373
| |-- module_hcontainer The module for storing the Hamiltonian matrix in LCAO calculations.
74-
| `-- module_tddft The module for defining the Hamiltonian in TDDFT calculations.
75-
|-- module_hamilt_pw The module for defining the Hamiltonian in PW calculations.
76-
| |-- hamilt_ofdft The module for defining the Hamiltonian in OFDFT calculations.
77-
| |-- hamilt_pwdft The module for defining the Hamiltonian in PW-DFT calculations.
74+
| |-- module_rt The module for defining the Hamiltonian in TDDFT calculations.
75+
| `-- module_ri The module for performing RI calculations.
76+
|-- source_pw The module for defining the Hamiltonian in PW calculations.
77+
| |-- module_ofdft The module for defining the Hamiltonian in OFDFT calculations.
78+
| |-- module_pwdft The module for defining the Hamiltonian in PW-DFT calculations.
7879
| | |-- operator_pw The module for defining the operators in PW-DFT calculations.
79-
| `-- hamilt_stodft The module for defining the Hamiltonian in STODFT calculations.
80-
|-- module_hsolver The module for solving the Hamiltonian with different diagonalization methods, including CG, Davidson in PW
80+
| `-- module_stodft The module for defining the Hamiltonian in STODFT calculations.
81+
|-- source_hsolver The module for solving the Hamiltonian with different diagonalization methods, including CG, Davidson in PW
8182
| | calculations, and scalapack and genelpa in LCAO calculations.
82-
|-- module_io The module for reading of INPUT files and output properties including band structure, density of states, charge density, etc.
83-
|-- module_md The module for performing molecular dynamics.
84-
|-- module_psi The module for defining the wave function and its operations.
85-
|-- module_relax The module for performing structural optimization.
86-
| |-- relax_new The module for performing structural optimization with new algorithm, optimized for cell and ion simultaneously.
87-
| `-- relax_old The module for performing structural optimization with old algorithm, optimized for cell and ion separately.
88-
|-- module_ri The module for performing RI calculations.
83+
|-- source_io The module for reading of INPUT files and output properties including band structure, density of states, charge density, etc.
84+
|-- source_md The module for performing molecular dynamics.
85+
|-- source_psi The module for defining the wave function and its operations.
86+
`-- source_relax The module for performing structural optimization, optimized for cell and ion simultaneously.
8987
```
9088

9189
## Submitting an Issue
@@ -101,7 +99,7 @@ For comments that need to be shown in documents, these formats should be used --
10199

102100
A helpful VS Code extension -- [Doxygen Documentation Generator](https://marketplace.visualstudio.com/items?itemName=cschlosser.doxdocgen), can help you formating comments.
103101

104-
An practical example is class [LCAO_Deepks](https://github.com/deepmodeling/abacus-develop/blob/deepks/source/module_hamilt_lcao/module_deepks/LCAO_deepks.h), the effects can be seen on [readthedocs page](https://abacus-deepks.readthedocs.io/en/latest/DeePKS_API/classLCAO__Descriptor.html#exhale-class-classLCAO-Descriptor)
102+
An practical example is class [LCAO_Deepks](https://github.com/deepmodeling/abacus-develop/blob/deepks/source/source_lcao/module_deepks/LCAO_deepks.h), the effects can be seen on [readthedocs page](https://abacus-deepks.readthedocs.io/en/latest/DeePKS_API/classLCAO__Descriptor.html#exhale-class-classLCAO-Descriptor)
105103

106104
- Tips
107105
- Only comments in .h file will be visible in generated by Doxygen + Sphinx;
@@ -183,7 +181,7 @@ pre-commit install
183181

184182
## Adding a unit test
185183

186-
We use [GoogleTest](https://github.com/google/googletest) as our test framework. Write your test under the corresponding module folder at `abacus-develop/tests`, then append the test to `tests/CMakeLists.txt`. If there are currently no unit tests provided for the module, do as follows. `module_base` provides a simple demonstration.
184+
We use [GoogleTest](https://github.com/google/googletest) as our test framework. Write your test under the corresponding module folder at `abacus-develop/tests`, then append the test to `tests/CMakeLists.txt`. If there are currently no unit tests provided for the module, do as follows. `source_base` provides a simple demonstration.
187185

188186
- Add a folder named `test` under the module.
189187
- Append the content below to `CMakeLists.txt` of the module:
@@ -257,7 +255,7 @@ To add a unit test:
257255
./cell_unitcell_test
258256
```
259257
260-
under the directory of `build/source/module_cell/test` to run the test `cell_unitcell_test`.
258+
under the directory of `build/source/source_cell/test` to run the test `cell_unitcell_test`.
261259
However, it is more convenient to run unit tests with `ctest` command under the `build` directory. You can check all unit tests by
262260
263261
```bash

0 commit comments

Comments
 (0)