Skip to content

Commit 06494a7

Browse files
authored
Merge branch 'deepmodeling:develop' into feature
2 parents cd72d9e + 7620b59 commit 06494a7

File tree

2,124 files changed

+43358
-26453
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,124 files changed

+43358
-26453
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: 1 addition & 1 deletion
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.

.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: 15 additions & 29 deletions
Original file line numberDiff line numberDiff line change
@@ -21,8 +21,11 @@ option(USE_DSP "Enable DSP" OFF)
2121
option(USE_ABACUS_LIBM "Build libmath from source to speed up" OFF)
2222
option(ENABLE_LIBXC "Enable using the LibXC package" OFF)
2323
option(ENABLE_FLOAT_FFTW "Enable using single-precision FFTW library." OFF)
24-
option(ENABLE_DEEPKS "Enable the DeePKS algorithm" OFF)
25-
option(ENABLE_MLKEDF "Enable the Machine-Learning-based KEDF for OFDFT" OFF)
24+
25+
# option(ENABLE_DEEPKS "Enable the DeePKS algorithm" OFF)
26+
# option(ENABLE_MLKEDF "Enable the Machine-Learning-based KEDF for OFDFT" OFF)
27+
28+
option(ENABLE_MLALGO "Enable the machine learning algorithms" OFF)
2629

2730
option(ENABLE_LCAO "Enable LCAO algorithm" ON)
2831
option(USE_ELPA "Enable ELPA for LCAO" ON)
@@ -115,7 +118,7 @@ endif()
115118
# Serial version of ABACUS will not use ELPA
116119
if(NOT ENABLE_MPI)
117120
set(USE_ELPA OFF)
118-
set(ENABLE_DEEPKS OFF)
121+
set(ENABLE_MLALGO OFF)
119122
endif()
120123

121124
# Different exe files of ABACUS
@@ -164,12 +167,12 @@ set(ABACUS_SOURCE_DIR ${CMAKE_CURRENT_SOURCE_DIR}/source)
164167
set(ABACUS_TEST_DIR ${CMAKE_CURRENT_SOURCE_DIR}/tests)
165168
set(ABACUS_BIN_PATH ${CMAKE_CURRENT_BINARY_DIR}/${ABACUS_BIN_NAME})
166169
include_directories(${ABACUS_SOURCE_DIR})
167-
include_directories(${ABACUS_SOURCE_DIR}/module_base/module_container)
170+
include_directories(${ABACUS_SOURCE_DIR}/source_base/module_container)
168171

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

172-
add_executable(${ABACUS_BIN_NAME} source/main.cpp)
175+
add_executable(${ABACUS_BIN_NAME} source/source_main/main.cpp)
173176
if(ENABLE_COVERAGE)
174177
add_coverage(${ABACUS_BIN_NAME})
175178
endif()
@@ -253,7 +256,7 @@ if(ENABLE_LCAO)
253256
add_compile_definitions(__NEW_GINT)
254257
endif()
255258
else()
256-
set(ENABLE_DEEPKS OFF)
259+
set(ENABLE_MLALGO OFF)
257260
set(ENABLE_LIBRI OFF)
258261
endif()
259262

@@ -480,8 +483,9 @@ if(ENABLE_FLOAT_FFTW)
480483
add_definitions(-D__ENABLE_FLOAT_FFTW)
481484
endif()
482485

483-
if(ENABLE_DEEPKS)
484-
target_link_libraries(${ABACUS_BIN_NAME} deepks)
486+
if(ENABLE_MLALGO)
487+
target_link_libraries(${ABACUS_BIN_NAME} deepks) # deepks
488+
target_link_libraries(${ABACUS_BIN_NAME} hamilt_mlkedf) # mlkedf
485489

486490
find_path(libnpy_SOURCE_DIR npy.hpp HINTS ${libnpy_INCLUDE_DIR})
487491
if(NOT libnpy_SOURCE_DIR)
@@ -496,32 +500,14 @@ if(ENABLE_DEEPKS)
496500
include_directories(${libnpy_INCLUDE_DIR})
497501
endif()
498502
include_directories(${libnpy_SOURCE_DIR}/include)
499-
add_compile_definitions(__DEEPKS)
500-
endif()
501-
502-
if(ENABLE_MLKEDF)
503-
target_link_libraries(${ABACUS_BIN_NAME} hamilt_mlkedf)
504-
505-
find_path(libnpy_SOURCE_DIR npy.hpp HINTS ${libnpy_INCLUDE_DIR})
506-
if(NOT libnpy_SOURCE_DIR)
507-
include(FetchContent)
508-
FetchContent_Declare(
509-
libnpy
510-
GIT_REPOSITORY https://github.com/llohse/libnpy.git
511-
GIT_SHALLOW TRUE
512-
GIT_PROGRESS TRUE)
513-
FetchContent_MakeAvailable(libnpy)
514-
else()
515-
include_directories(${libnpy_INCLUDE_DIR})
516-
endif()
517-
include_directories(${libnpy_SOURCE_DIR}/include)
518-
add_compile_definitions(__MLKEDF)
503+
504+
add_compile_definitions(__MLALGO)
519505
endif()
520506

521507
# Torch uses outdated components to detect CUDA arch, causing failure on
522508
# latest CUDA kits. Set CMake variable TORCH_CUDA_ARCH_LIST in the form of
523509
# "major.minor" if required.
524-
if(ENABLE_DEEPKS OR ENABLE_MLKEDF OR DEFINED Torch_DIR)
510+
if(ENABLE_MLALGO OR DEFINED Torch_DIR)
525511
find_package(Torch REQUIRED)
526512
if(NOT Torch_VERSION VERSION_LESS "2.1.0")
527513
set_if_higher(CMAKE_CXX_STANDARD 17)

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: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,7 @@ 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;
@@ -57,7 +57,7 @@ For those who are interested in the source code, the following figure shows the
5757
|-- module_elecstate 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.
6262
|-- module_hamilt_general 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.
@@ -77,7 +77,7 @@ For those who are interested in the source code, the following figure shows the
7777
| |-- hamilt_pwdft The module for defining the Hamiltonian in PW-DFT calculations.
7878
| | |-- operator_pw The module for defining the operators in PW-DFT calculations.
7979
| `-- 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+
|-- source_hsolver The module for solving the Hamiltonian with different diagonalization methods, including CG, Davidson in PW
8181
| | calculations, and scalapack and genelpa in LCAO calculations.
8282
|-- module_io The module for reading of INPUT files and output properties including band structure, density of states, charge density, etc.
8383
|-- module_md The module for performing molecular dynamics.
@@ -183,7 +183,7 @@ pre-commit install
183183

184184
## Adding a unit test
185185

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.
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. `source_base` provides a simple demonstration.
187187

188188
- Add a folder named `test` under the module.
189189
- Append the content below to `CMakeLists.txt` of the module:

0 commit comments

Comments
 (0)