Skip to content

Commit fb8b16f

Browse files
Merge remote-tracking branch 'upstream/develop' into develop
# Conflicts: # source/module_psi/psi_initializer.h
2 parents bd474b2 + 0b77de9 commit fb8b16f

File tree

2,206 files changed

+93895
-60056
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,206 files changed

+93895
-60056
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_LIBRI=1 -DENABLE_PAW=1"
20+
build_args: "-DENABLE_LIBXC=1 -DENABLE_DEEPKS=1 -DENABLE_MLKEDF=1 -DENABLE_LIBRI=1 -DENABLE_PAW=1"
2121
name: "Build extra components with GNU toolchain"
2222
- tag: intel
23-
build_args: "-DENABLE_LIBXC=1 -DENABLE_DEEPKS=1 -DENABLE_LIBRI=1"
23+
build_args: "-DENABLE_LIBXC=1 -DENABLE_DEEPKS=1 -DENABLE_MLKEDF=1 -DENABLE_LIBRI=1"
2424
name: "Build extra components with Intel toolchain"
2525

2626
- tag: cuda

.github/workflows/coverage.yml

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -15,20 +15,22 @@ jobs:
1515
uses: actions/checkout@v4
1616
- name: Install Requirements for Coverage Testing
1717
run: |
18-
apt update && apt install -y lcov
18+
apt update && apt install -y lcov gpg curl jq ca-certificates
1919
- name: Building
2020
run: |
21-
cmake -B build -DENABLE_DEEPKS=ON -DENABLE_LIBXC=ON -DBUILD_TESTING=ON -DENABLE_COVERAGE=ON
21+
cmake -B build -DENABLE_COVERAGE=ON -DBUILD_TESTING=ON -DENABLE_DEEPKS=ON -DENABLE_LIBXC=ON -DENABLE_LIBRI=ON -DENABLE_PAW=ON -DENABLE_GOOGLEBENCH=ON -DENABLE_RAPIDJSON=ON
2222
cmake --build build -j`nproc`
2323
cmake --install build
2424
- name: Testing
2525
env:
2626
OMP_NUM_THREADS: 1
2727
run: |
28-
cmake --build build --target test ARGS="-V --timeout 21600"
28+
cmake --build build --target test ARGS="-V --timeout 21600" || exit 0
2929
- name: Upload Coverage to Codecov
30-
uses: codecov/codecov-action@v4
30+
uses: codecov/codecov-action@v5
3131
if: ${{ ! cancelled() }}
3232
with:
33-
gcov: true
33+
fail_ci_if_error: true
3434
token: ${{ secrets.CODECOV_TOKEN }}
35+
skip_validation: true
36+
verbose: true

.github/workflows/test.yml

Lines changed: 11 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -31,15 +31,18 @@ jobs:
3131
3232
- name: Configure
3333
run: |
34-
cmake -B build -DBUILD_TESTING=ON -DENABLE_DEEPKS=ON -DENABLE_LIBXC=ON -DENABLE_LIBRI=ON -DENABLE_PAW=ON -DENABLE_GOOGLEBENCH=ON -DENABLE_RAPIDJSON=ON -DCMAKE_EXPORT_COMPILE_COMMANDS=1
34+
cmake -B build -DBUILD_TESTING=ON -DENABLE_DEEPKS=ON -DENABLE_MLKEDF=ON -DENABLE_LIBXC=ON -DENABLE_LIBRI=ON -DENABLE_PAW=ON -DENABLE_GOOGLEBENCH=ON -DENABLE_RAPIDJSON=ON -DCMAKE_EXPORT_COMPILE_COMMANDS=1
3535
36-
- uses: pre-commit/[email protected]
37-
with:
38-
extra_args:
39-
--from-ref ${{ github.event.pull_request.base.sha }}
40-
--to-ref ${{ github.event.pull_request.head.sha }}
41-
continue-on-error: true
42-
- uses: pre-commit-ci/[email protected]
36+
# Temporarily removed because no one maintains this now.
37+
# And it will break the CI test workflow.
38+
39+
# - uses: pre-commit/[email protected]
40+
# with:
41+
# extra_args:
42+
# --from-ref ${{ github.event.pull_request.base.sha }}
43+
# --to-ref ${{ github.event.pull_request.head.sha }}
44+
# continue-on-error: true
45+
# - uses: pre-commit-ci/[email protected]
4346

4447
- name: Build
4548
run: |

.gitignore

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,4 +22,4 @@ time.json
2222
*.pyc
2323
__pycache__
2424
abacus.json
25-
*.npy
25+
*.npy

.gitmodules

Lines changed: 0 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,3 @@
1-
[submodule "deps/LibRI"]
2-
path = deps/LibRI
3-
url = https://github.com/abacusmodeling/LibRI.git
4-
branch = master
5-
[submodule "deps/LibComm"]
6-
path = deps/LibComm
7-
url = https://github.com/abacusmodeling/LibComm.git
8-
branch = master
91
[submodule "deps/libpaw_interface"]
102
path = deps/libpaw_interface
113
url = https://github.com/wenfei-li/libpaw_interface

CMakeLists.txt

Lines changed: 88 additions & 43 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@ project(
1212

1313
option(ENABLE_LCAO "Enable LCAO calculation." ON)
1414
option(ENABLE_DEEPKS "Enable DeePKS functionality" OFF)
15+
option(ENABLE_MLKEDF "Enable Machine Learning based KEDF for OFDFT" OFF)
1516
option(ENABLE_LIBXC "Enable LibXC functionality" OFF)
1617
option(USE_CUDA "Enable support to CUDA for ABACUS." OFF)
1718
option(ENABLE_FLOAT_FFTW "Enable support to single precision FFTW library." OFF)
@@ -39,6 +40,9 @@ option(ENABLE_RAPIDJSON "Enable rapid-json usage." OFF)
3940
option(ENABLE_CNPY "Enable cnpy usage." OFF)
4041
option(ENABLE_PEXSI "Enable support for PEXSI." OFF)
4142
option(ENABLE_CUSOLVERMP "Enable cusolvermp." OFF)
43+
option(USE_DSP "Enable DSP usage." OFF)
44+
option(USE_CUDA_ON_DCU "Enable CUDA on DCU" OFF)
45+
option(USE_CUDA_MPI "Enable CUDA-aware MPI" OFF)
4246

4347
# enable json support
4448
if(ENABLE_RAPIDJSON)
@@ -119,6 +123,20 @@ elseif(ENABLE_LCAO AND NOT ENABLE_MPI)
119123
set(ABACUS_BIN_NAME abacus_serial)
120124
endif()
121125

126+
if (USE_DSP)
127+
set(USE_ELPA OFF)
128+
set(ENABLE_LCAO OFF)
129+
set(ABACUS_BIN_NAME abacus_dsp)
130+
endif()
131+
132+
if (USE_CUDA_ON_DCU)
133+
add_compile_definitions(__CUDA_ON_DCU)
134+
endif()
135+
136+
if (USE_CUDA_MPI)
137+
add_compile_definitions(__CUDA_MPI)
138+
endif()
139+
122140
list(APPEND CMAKE_MODULE_PATH ${CMAKE_CURRENT_SOURCE_DIR}/cmake)
123141

124142
if(ENABLE_COVERAGE)
@@ -223,6 +241,9 @@ if(ENABLE_LCAO)
223241
add_compile_definitions(__PEXSI)
224242
set(CMAKE_CXX_STANDARD 14)
225243
endif()
244+
if(NEW_GINT)
245+
add_compile_definitions(__NEW_GINT)
246+
endif()
226247
else()
227248
set(ENABLE_DEEPKS OFF)
228249
set(ENABLE_LIBRI OFF)
@@ -240,6 +261,15 @@ if(ENABLE_MPI)
240261
list(APPEND math_libs MPI::MPI_CXX)
241262
endif()
242263

264+
if (USE_DSP)
265+
add_compile_definitions(__DSP)
266+
target_link_libraries(${ABACUS_BIN_NAME} ${OMPI_LIBRARY1})
267+
include_directories(${MTBLAS_FFT_DIR}/libmtblas/include)
268+
include_directories(${MT_HOST_DIR}/include)
269+
target_link_libraries(${ABACUS_BIN_NAME} ${MT_HOST_DIR}/hthreads/lib/libhthread_device.a)
270+
target_link_libraries(${ABACUS_BIN_NAME} ${MT_HOST_DIR}/hthreads/lib/libhthread_host.a)
271+
endif()
272+
243273
find_package(Threads REQUIRED)
244274
target_link_libraries(${ABACUS_BIN_NAME} Threads::Threads)
245275

@@ -408,12 +438,8 @@ else()
408438
find_package(Lapack REQUIRED)
409439
include_directories(${FFTW3_INCLUDE_DIRS})
410440
list(APPEND math_libs FFTW3::FFTW3 LAPACK::LAPACK BLAS::BLAS)
411-
412-
if(ENABLE_LCAO)
413-
find_package(ScaLAPACK REQUIRED)
414-
list(APPEND math_libs ScaLAPACK::ScaLAPACK)
415-
endif()
416-
441+
find_package(ScaLAPACK REQUIRED)
442+
list(APPEND math_libs ScaLAPACK::ScaLAPACK)
417443
if(USE_OPENMP)
418444
list(APPEND math_libs FFTW3::FFTW3_OMP)
419445
endif()
@@ -436,22 +462,6 @@ if(ENABLE_FLOAT_FFTW)
436462
endif()
437463

438464
if(ENABLE_DEEPKS)
439-
# Torch uses outdated components to detect CUDA arch, causing failure on
440-
# latest CUDA kits. Set CMake variable TORCH_CUDA_ARCH_LIST in the form of
441-
# "major.minor" if required.
442-
find_package(Torch REQUIRED)
443-
if(NOT Torch_VERSION VERSION_LESS "2.1.0")
444-
set_if_higher(CMAKE_CXX_STANDARD 17)
445-
elseif(NOT Torch_VERSION VERSION_LESS "1.5.0")
446-
set_if_higher(CMAKE_CXX_STANDARD 14)
447-
endif()
448-
include_directories(${TORCH_INCLUDE_DIRS})
449-
if(MKL_FOUND)
450-
list(PREPEND math_libs ${TORCH_LIBRARIES})
451-
else()
452-
list(APPEND math_libs ${TORCH_LIBRARIES})
453-
endif()
454-
add_compile_options(${TORCH_CXX_FLAGS})
455465
target_link_libraries(${ABACUS_BIN_NAME} deepks)
456466

457467
find_path(libnpy_SOURCE_DIR npy.hpp HINTS ${libnpy_INCLUDE_DIR})
@@ -470,6 +480,44 @@ if(ENABLE_DEEPKS)
470480
add_compile_definitions(__DEEPKS)
471481
endif()
472482

483+
if(ENABLE_MLKEDF)
484+
target_link_libraries(${ABACUS_BIN_NAME} hamilt_mlkedf)
485+
486+
find_path(libnpy_SOURCE_DIR npy.hpp HINTS ${libnpy_INCLUDE_DIR})
487+
if(NOT libnpy_SOURCE_DIR)
488+
include(FetchContent)
489+
FetchContent_Declare(
490+
libnpy
491+
GIT_REPOSITORY https://github.com/llohse/libnpy.git
492+
GIT_SHALLOW TRUE
493+
GIT_PROGRESS TRUE)
494+
FetchContent_MakeAvailable(libnpy)
495+
else()
496+
include_directories(${libnpy_INCLUDE_DIR})
497+
endif()
498+
include_directories(${libnpy_SOURCE_DIR}/include)
499+
add_compile_definitions(__MLKEDF)
500+
endif()
501+
502+
# Torch uses outdated components to detect CUDA arch, causing failure on
503+
# latest CUDA kits. Set CMake variable TORCH_CUDA_ARCH_LIST in the form of
504+
# "major.minor" if required.
505+
if(ENABLE_DEEPKS OR ENABLE_MLKEDF OR DEFINED Torch_DIR)
506+
find_package(Torch REQUIRED)
507+
if(NOT Torch_VERSION VERSION_LESS "2.1.0")
508+
set_if_higher(CMAKE_CXX_STANDARD 17)
509+
elseif(NOT Torch_VERSION VERSION_LESS "1.5.0")
510+
set_if_higher(CMAKE_CXX_STANDARD 14)
511+
endif()
512+
include_directories(${TORCH_INCLUDE_DIRS})
513+
if(MKL_FOUND)
514+
list(PREPEND math_libs ${TORCH_LIBRARIES})
515+
else()
516+
list(APPEND math_libs ${TORCH_LIBRARIES})
517+
endif()
518+
add_compile_options(${TORCH_CXX_FLAGS})
519+
endif()
520+
473521
if (ENABLE_CNPY)
474522
find_path(cnpy_SOURCE_DIR
475523
cnpy.h
@@ -523,13 +571,10 @@ endif()
523571
if(ENABLE_LIBRI)
524572
set_if_higher(CMAKE_CXX_STANDARD 14)
525573
if(LIBRI_DIR)
526-
include_directories(${LIBRI_DIR}/include)
527-
elseif(GIT_SUBMODULE)
528-
git_submodule_update()
529-
include_directories(${CMAKE_CURRENT_SOURCE_DIR}/deps/LibRI/include)
530574
else()
531-
message(FATAL_ERROR "Must provide LIBRI_DIR for RI related features.")
575+
find_package(LibRI REQUIRED)
532576
endif()
577+
include_directories(${LIBRI_DIR}/include)
533578
target_link_libraries(${ABACUS_BIN_NAME} ri module_exx_symmetry)
534579
add_compile_definitions(__EXX EXX_DM=3 EXX_H_COMM=2 TEST_EXX_LCAO=0
535580
TEST_EXX_RADIAL=1)
@@ -540,13 +585,10 @@ if(ENABLE_LIBRI OR DEFINED LIBCOMM_DIR)
540585
endif()
541586
if(ENABLE_LIBCOMM)
542587
if(LIBCOMM_DIR)
543-
include_directories(${LIBCOMM_DIR}/include)
544-
elseif(GIT_SUBMODULE)
545-
git_submodule_update()
546-
include_directories(${CMAKE_CURRENT_SOURCE_DIR}/deps/LibComm/include)
547588
else()
548-
message(FATAL_ERROR "Must provide LIBCOMM_DIR for RI related features.")
589+
find_package(LibComm REQUIRED)
549590
endif()
591+
include_directories(${LIBCOMM_DIR}/include)
550592
endif()
551593

552594
if(ENABLE_PAW)
@@ -590,13 +632,14 @@ if(DEFINED DeePMD_DIR)
590632
add_compile_definitions(__DPMDC)
591633
else()
592634
target_link_libraries(${ABACUS_BIN_NAME} DeePMD::deepmd_cc)
593-
if(NOT DEFINED TensorFlow_DIR)
594-
set(TensorFlow_DIR ${DeePMD_DIR})
595-
endif()
596-
find_package(TensorFlow REQUIRED)
597-
if(TensorFlow_FOUND)
598-
target_link_libraries(${ABACUS_BIN_NAME} TensorFlow::tensorflow_cc)
599-
endif()
635+
endif()
636+
endif()
637+
638+
if(DEFINED TensorFlow_DIR)
639+
find_package(TensorFlow REQUIRED)
640+
include_directories(${TensorFlow_DIR}/include)
641+
if(TensorFlow_FOUND)
642+
target_link_libraries(${ABACUS_BIN_NAME} TensorFlow::tensorflow_cc)
600643
endif()
601644
endif()
602645

@@ -699,22 +742,24 @@ target_link_libraries(
699742
hamilt_stodft
700743
psi
701744
psi_initializer
745+
psi_overall_init
702746
esolver
703747
vdw
704748
device
705-
container)
749+
container
750+
dftu
751+
deltaspin)
706752
if(ENABLE_LCAO)
707753
target_link_libraries(
708754
${ABACUS_BIN_NAME}
709755
hamilt_lcao
710756
tddft
711757
orb
712758
gint
713-
dftu
714759
hcontainer
715-
deltaspin
716760
numerical_atomic_orbitals
717-
lr)
761+
lr
762+
rdmft)
718763
if(USE_ELPA)
719764
target_link_libraries(${ABACUS_BIN_NAME} genelpa)
720765
endif()

README.md

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,9 @@
1212

1313
# About ABACUS
1414

15-
ABACUS (Atomic-orbital Based Ab-initio Computation at UStc) is an open-source package based on density functional theory (DFT). The package utilizes both plane wave and numerical atomic basis sets with the usage of norm-conserving pseudopotentials to describe the interactions between nuclear ions and valence electrons. ABACUS supports LDA, GGA, meta-GGA, and hybrid functionals. Apart from single-point calculations, the package allows geometry optimizations and ab-initio molecular dynamics with various ensembles. The package also provides a variety of advanced functionalities for simulating materials, including the DFT+U, VdW corrections, and implicit solvation model, etc. In addition, ABACUS strives to provide a general infrastructure to facilitate the developments and applications of novel machine-learning-assisted DFT methods (DeePKS, DP-GEN, DeepH, etc.) in molecular and material simulations.
15+
ABACUS (Atomic-orbital Based Ab-initio Computation at UStc) is an open-source package based on density functional theory (DFT). The package utilizes both plane wave and numerical atomic basis sets with the usage of norm-conserving pseudopotentials to describe the interactions between nuclear ions and valence electrons. ABACUS supports LDA, GGA, meta-GGA, and hybrid functionals. Apart from single-point calculations, the package allows geometry optimizations and ab-initio molecular dynamics with various ensembles. The package also provides a variety of advanced functionalities for simulating materials, including the DFT+U, VdW corrections, and implicit solvation model, etc. In addition, ABACUS strives to provide a general infrastructure to facilitate the developments and applications of novel machine-learning-assisted DFT methods (DeePKS, DP-GEN, DeepH, DeePTB etc.) in molecular and material simulations.
1616

1717
# Online Documentation
1818
For detailed documentation, please refer to [our documentation website](https://abacus.deepmodeling.com/).
19+
20+
See our [Github Pages](https://mcresearch.github.io/abacus-user-guide/) for more tutorials and developer guides.

cmake/FindLibComm.cmake

Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,30 @@
1+
###############################################################################
2+
# - Find LibComm
3+
# Find the native LibComm files.
4+
#
5+
# LIBCOMM_FOUND - True if LibComm is found.
6+
# LIBCOMM_DIR - Where to find LibComm files.
7+
8+
find_path(LIBCOMM_DIR
9+
include/Comm/Comm_Tools.h
10+
HINTS ${LIBCOMM_DIR}
11+
HINTS ${LibComm_DIR}
12+
HINTS ${libcomm_DIR}
13+
)
14+
15+
if(NOT LIBCOMM_DIR)
16+
include(FetchContent)
17+
FetchContent_Declare(
18+
LibComm
19+
URL https://github.com/abacusmodeling/LibComm/archive/refs/tags/v0.1.1.tar.gz
20+
)
21+
FetchContent_Populate(LibComm)
22+
set(LIBCOMM_DIR ${libcomm_SOURCE_DIR})
23+
endif()
24+
# Handle the QUIET and REQUIRED arguments and
25+
# set LIBCOMM_FOUND to TRUE if all variables are non-zero.
26+
include(FindPackageHandleStandardArgs)
27+
find_package_handle_standard_args(LibComm DEFAULT_MSG LIBCOMM_DIR)
28+
29+
# Copy the results to the output variables and target.
30+
mark_as_advanced(LIBCOMM_DIR)

cmake/FindLibRI.cmake

Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,30 @@
1+
###############################################################################
2+
# - Find LibRI
3+
# Find the native LibRI files.
4+
#
5+
# LIBRI_FOUND - True if LibRI is found.
6+
# LIBRI_DIR - Where to find LibRI files.
7+
8+
find_path(LIBRI_DIR
9+
include/RI/version.h
10+
HINTS ${LIBRI_DIR}
11+
HINTS ${LibRI_DIR}
12+
HINTS ${libri_DIR}
13+
)
14+
15+
if(NOT LIBRI_DIR)
16+
include(FetchContent)
17+
FetchContent_Declare(
18+
LibRI
19+
URL https://github.com/abacusmodeling/LibRI/archive/refs/tags/v0.2.1.1.tar.gz
20+
)
21+
FetchContent_Populate(LibRI)
22+
set(LIBRI_DIR ${libri_SOURCE_DIR})
23+
endif()
24+
# Handle the QUIET and REQUIRED arguments and
25+
# set LIBRI_FOUND to TRUE if all variables are non-zero.
26+
include(FindPackageHandleStandardArgs)
27+
find_package_handle_standard_args(LibRI DEFAULT_MSG LIBRI_DIR)
28+
29+
# Copy the results to the output variables and target.
30+
mark_as_advanced(LIBRI_DIR)

0 commit comments

Comments
 (0)