Skip to content

Commit 289036b

Browse files
authored
Merge branch 'deepmodeling:develop' into develop
2 parents 7e3e147 + 4009f6a commit 289036b

File tree

896 files changed

+39053
-21574
lines changed

Some content is hidden

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

896 files changed

+39053
-21574
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/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_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
3636
- uses: pre-commit/[email protected]
3737
with:

CMakeLists.txt

Lines changed: 33 additions & 9 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)
@@ -40,6 +41,7 @@ option(ENABLE_CNPY "Enable cnpy usage." OFF)
4041
option(ENABLE_PEXSI "Enable support for PEXSI." OFF)
4142
option(ENABLE_CUSOLVERMP "Enable cusolvermp." OFF)
4243
option(USE_DSP "Enable DSP usage." OFF)
44+
option(USE_CUDA_ON_DCU "Enable CUDA on DCU" OFF)
4345

4446
# enable json support
4547
if(ENABLE_RAPIDJSON)
@@ -126,6 +128,10 @@ if (USE_DSP)
126128
set(ABACUS_BIN_NAME abacus_dsp)
127129
endif()
128130

131+
if (USE_CUDA_ON_DCU)
132+
add_compile_definitions(__CUDA_ON_DCU)
133+
endif()
134+
129135
list(APPEND CMAKE_MODULE_PATH ${CMAKE_CURRENT_SOURCE_DIR}/cmake)
130136

131137
if(ENABLE_COVERAGE)
@@ -421,10 +427,8 @@ else()
421427
include_directories(${FFTW3_INCLUDE_DIRS})
422428
list(APPEND math_libs FFTW3::FFTW3 LAPACK::LAPACK BLAS::BLAS)
423429

424-
if(ENABLE_LCAO)
425-
find_package(ScaLAPACK REQUIRED)
426-
list(APPEND math_libs ScaLAPACK::ScaLAPACK)
427-
endif()
430+
find_package(ScaLAPACK REQUIRED)
431+
list(APPEND math_libs ScaLAPACK::ScaLAPACK)
428432

429433
if(USE_OPENMP)
430434
list(APPEND math_libs FFTW3::FFTW3_OMP)
@@ -466,10 +470,29 @@ if(ENABLE_DEEPKS)
466470
add_compile_definitions(__DEEPKS)
467471
endif()
468472

473+
if(ENABLE_MLKEDF)
474+
target_link_libraries(${ABACUS_BIN_NAME} hamilt_mlkedf)
475+
476+
find_path(libnpy_SOURCE_DIR npy.hpp HINTS ${libnpy_INCLUDE_DIR})
477+
if(NOT libnpy_SOURCE_DIR)
478+
include(FetchContent)
479+
FetchContent_Declare(
480+
libnpy
481+
GIT_REPOSITORY https://github.com/llohse/libnpy.git
482+
GIT_SHALLOW TRUE
483+
GIT_PROGRESS TRUE)
484+
FetchContent_MakeAvailable(libnpy)
485+
else()
486+
include_directories(${libnpy_INCLUDE_DIR})
487+
endif()
488+
include_directories(${libnpy_SOURCE_DIR}/include)
489+
add_compile_definitions(__MLKEDF)
490+
endif()
491+
469492
# Torch uses outdated components to detect CUDA arch, causing failure on
470493
# latest CUDA kits. Set CMake variable TORCH_CUDA_ARCH_LIST in the form of
471494
# "major.minor" if required.
472-
if(ENABLE_DEEPKS OR DEFINED Torch_DIR)
495+
if(ENABLE_DEEPKS OR ENABLE_MLKEDF OR DEFINED Torch_DIR)
473496
find_package(Torch REQUIRED)
474497
if(NOT Torch_VERSION VERSION_LESS "2.1.0")
475498
set_if_higher(CMAKE_CXX_STANDARD 17)
@@ -713,19 +736,20 @@ target_link_libraries(
713736
esolver
714737
vdw
715738
device
716-
container)
739+
container
740+
dftu
741+
deltaspin)
717742
if(ENABLE_LCAO)
718743
target_link_libraries(
719744
${ABACUS_BIN_NAME}
720745
hamilt_lcao
721746
tddft
722747
orb
723748
gint
724-
dftu
725749
hcontainer
726-
deltaspin
727750
numerical_atomic_orbitals
728-
lr)
751+
lr
752+
rdmft)
729753
if(USE_ELPA)
730754
target_link_libraries(${ABACUS_BIN_NAME} genelpa)
731755
endif()

docs/CITATIONS.md

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -33,3 +33,9 @@ The following references are required to be cited when using ABACUS. Specificall
3333
Peize Lin, Xinguo Ren, and Lixin He. "Efficient Hybrid Density Functional Calculations for Large Periodic Systems Using Numerical Atomic Orbitals." Journal of Chemical Theory and Computation 2021, 17(1), 222–239.
3434

3535
Peize Lin, Xinguo Ren, and Lixin He. "Accuracy of Localized Resolution of the Identity in Periodic Hybrid Functional Calculations with Numerical Atomic Orbitals." Journal of Physical Chemistry Letters 2020, 11, 3082-3088.
36+
37+
- **If ML-KEDF is used:**
38+
39+
Sun, Liang, and Mohan Chen. "Machine learning based nonlocal kinetic energy density functional for simple metals and alloys." Physical Review B 109.11 (2024): 115135.
40+
41+
Sun, Liang, and Mohan Chen. "Multi-channel machine learning based nonlocal kinetic energy density functional for semiconductors." Electronic Structure 6.4 (2024): 045006.

docs/advanced/elec_properties/hs_matrix.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -61,6 +61,11 @@ We also offer the option of only calculating the overlap matrix without running
6161

6262
A file named `SR.csr` will be generated in the working directory, which contains the overlap matrix.
6363

64+
> When `nspin` is set to 1 or 2, the dimension of the overlap matrix is nlocal $\times$ nlocal, where nlocal is the total number of numerical atomic orbitals.
65+
These numerical atomic orbitals are ordered from outer to inner loop as atom, angular quantum number $l$, zeta (multiple radial orbitals corresponding to each $l$), and magnetic quantum number $m$.
66+
When `nspin` is set to 4, the dimension of the overlap matrix is (2 $\times$ nlocal) $\times$ (2 $\times$ nlocal). In this case, the numerical atomic orbitals are ordered from outer to inner loop as atom, angular quantum number $l$, zeta (multiple radial orbitals corresponding to each $l$), magnetic quantum number $m$, and npol (index of spin, ranges from 0 to 1).
67+
68+
6469
## examples
6570
We provide [examples](https://github.com/deepmodeling/abacus-develop/tree/develop/examples/matrix_hs) of outputting the matrices. There are four examples:
6671

docs/advanced/elec_properties/position_matrix.md

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,4 +18,7 @@ Each file or each section of the appended file starts with "STEP: " followed by
1818

1919
Each block here contains the matrix for the corresponding cell. There are three columns in each block, giving the matrix elements in x, y, z directions, respectively. There are altogether nbasis * nbasis lines in each block, which emulates the matrix elements.
2020

21-
In molecular dynamics (MD) calculations, if [out_app_flag](../input_files/input-main.md#out_app_flag) is set to true, then `data-rR-tr` is written in an append manner. Otherwise, output files will be put in a separate directory, `matrix`, and named as `$x`_data-rR-tr, where `$x` is the number of MD step. In addition, The output frequency is controlled by [out_interval](../input_files/input-main.md#out_interval). For example, if we are running a 10-step MD with out_interval = 3, then `$x` will be 0, 3, 6, and 9.
21+
In molecular dynamics (MD) calculations, if [out_app_flag](../input_files/input-main.md#out_app_flag) is set to true, then `data-rR-tr` is written in an append manner. Otherwise, output files will be put in a separate directory, `matrix`, and named as `$x`_data-rR-tr, where `$x` is the number of MD step. In addition, the output frequency is controlled by [out_interval](../input_files/input-main.md#out_interval). For example, if we are running a 10-step MD with out_interval = 3, then `$x` will be 0, 3, 6, and 9.
22+
23+
## get_S
24+
We also offer the option of only calculating the position matrix without running SCF. For that purpose, in `INPUT` file we need to set the keyword [calculation](../input_files/input-main.md#calculation) to `get_S`, and [out_mat_r](../input_files/input-main.md#out_mat_r) to `true`.

0 commit comments

Comments
 (0)