Skip to content

Commit ac1c5a8

Browse files
committed
Merge branch 'develop' of https://github.com/sunliang98/abacus-develop into cell
2 parents f42edfa + 9bc8960 commit ac1c5a8

File tree

1,177 files changed

+32297
-24579
lines changed

Some content is hidden

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

1,177 files changed

+32297
-24579
lines changed

.github/workflows/coverage.yml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -15,17 +15,17 @@ 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
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
3030
uses: codecov/codecov-action@v4
3131
if: ${{ ! cancelled() }}

.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: 44 additions & 33 deletions
Original file line numberDiff line numberDiff line change
@@ -39,6 +39,7 @@ option(ENABLE_RAPIDJSON "Enable rapid-json usage." OFF)
3939
option(ENABLE_CNPY "Enable cnpy usage." OFF)
4040
option(ENABLE_PEXSI "Enable support for PEXSI." OFF)
4141
option(ENABLE_CUSOLVERMP "Enable cusolvermp." OFF)
42+
option(USE_DSP "Enable DSP usage." OFF)
4243

4344
# enable json support
4445
if(ENABLE_RAPIDJSON)
@@ -119,6 +120,12 @@ elseif(ENABLE_LCAO AND NOT ENABLE_MPI)
119120
set(ABACUS_BIN_NAME abacus_serial)
120121
endif()
121122

123+
if (USE_DSP)
124+
set(USE_ELPA OFF)
125+
set(ENABLE_LCAO OFF)
126+
set(ABACUS_BIN_NAME abacus_dsp)
127+
endif()
128+
122129
list(APPEND CMAKE_MODULE_PATH ${CMAKE_CURRENT_SOURCE_DIR}/cmake)
123130

124131
if(ENABLE_COVERAGE)
@@ -240,6 +247,11 @@ if(ENABLE_MPI)
240247
list(APPEND math_libs MPI::MPI_CXX)
241248
endif()
242249

250+
if (USE_DSP)
251+
target_link_libraries(${ABACUS_BIN_NAME} ${DIR_MTBLAS_LIBRARY})
252+
add_compile_definitions(__DSP)
253+
endif()
254+
243255
find_package(Threads REQUIRED)
244256
target_link_libraries(${ABACUS_BIN_NAME} Threads::Threads)
245257

@@ -436,22 +448,6 @@ if(ENABLE_FLOAT_FFTW)
436448
endif()
437449

438450
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})
455451
target_link_libraries(${ABACUS_BIN_NAME} deepks)
456452

457453
find_path(libnpy_SOURCE_DIR npy.hpp HINTS ${libnpy_INCLUDE_DIR})
@@ -470,6 +466,25 @@ if(ENABLE_DEEPKS)
470466
add_compile_definitions(__DEEPKS)
471467
endif()
472468

469+
# Torch uses outdated components to detect CUDA arch, causing failure on
470+
# latest CUDA kits. Set CMake variable TORCH_CUDA_ARCH_LIST in the form of
471+
# "major.minor" if required.
472+
if(ENABLE_DEEPKS OR DEFINED Torch_DIR)
473+
find_package(Torch REQUIRED)
474+
if(NOT Torch_VERSION VERSION_LESS "2.1.0")
475+
set_if_higher(CMAKE_CXX_STANDARD 17)
476+
elseif(NOT Torch_VERSION VERSION_LESS "1.5.0")
477+
set_if_higher(CMAKE_CXX_STANDARD 14)
478+
endif()
479+
include_directories(${TORCH_INCLUDE_DIRS})
480+
if(MKL_FOUND)
481+
list(PREPEND math_libs ${TORCH_LIBRARIES})
482+
else()
483+
list(APPEND math_libs ${TORCH_LIBRARIES})
484+
endif()
485+
add_compile_options(${TORCH_CXX_FLAGS})
486+
endif()
487+
473488
if (ENABLE_CNPY)
474489
find_path(cnpy_SOURCE_DIR
475490
cnpy.h
@@ -523,13 +538,10 @@ endif()
523538
if(ENABLE_LIBRI)
524539
set_if_higher(CMAKE_CXX_STANDARD 14)
525540
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)
530541
else()
531-
message(FATAL_ERROR "Must provide LIBRI_DIR for RI related features.")
542+
find_package(LibRI REQUIRED)
532543
endif()
544+
include_directories(${LIBRI_DIR}/include)
533545
target_link_libraries(${ABACUS_BIN_NAME} ri module_exx_symmetry)
534546
add_compile_definitions(__EXX EXX_DM=3 EXX_H_COMM=2 TEST_EXX_LCAO=0
535547
TEST_EXX_RADIAL=1)
@@ -540,13 +552,10 @@ if(ENABLE_LIBRI OR DEFINED LIBCOMM_DIR)
540552
endif()
541553
if(ENABLE_LIBCOMM)
542554
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)
547555
else()
548-
message(FATAL_ERROR "Must provide LIBCOMM_DIR for RI related features.")
556+
find_package(LibComm REQUIRED)
549557
endif()
558+
include_directories(${LIBCOMM_DIR}/include)
550559
endif()
551560

552561
if(ENABLE_PAW)
@@ -590,13 +599,14 @@ if(DEFINED DeePMD_DIR)
590599
add_compile_definitions(__DPMDC)
591600
else()
592601
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()
602+
endif()
603+
endif()
604+
605+
if(DEFINED TensorFlow_DIR)
606+
find_package(TensorFlow REQUIRED)
607+
include_directories(${TensorFlow_DIR}/include)
608+
if(TensorFlow_FOUND)
609+
target_link_libraries(${ABACUS_BIN_NAME} TensorFlow::tensorflow_cc)
600610
endif()
601611
endif()
602612

@@ -699,6 +709,7 @@ target_link_libraries(
699709
hamilt_stodft
700710
psi
701711
psi_initializer
712+
psi_overall_init
702713
esolver
703714
vdw
704715
device

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)

deps/LibComm

Lines changed: 0 additions & 1 deletion
This file was deleted.

deps/LibRI

Lines changed: 0 additions & 1 deletion
This file was deleted.

docs/CITATIONS.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@ The following references are required to be cited when using ABACUS. Specificall
2626

2727
- **If DeePKS is used:**
2828

29-
Wenfei Li, Qi Ou, et al. "DeePKS+ABACUS as a Bridge between Expensive Quantum Mechanical Models and Machine Learning Potentials." <https://arxiv.org/abs/2206.10093>.
29+
Wenfei Li, Qi Ou, et al. "DeePKS+ABACUS as a Bridge between Expensive Quantum Mechanical Models and Machine Learning Potentials." J. Phys. Chem. A 126.49 (2022): 9154-9164.
3030

3131
- **If hybrid functional is used:**
3232

docs/advanced/elec_properties/Berry_phase.md

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ pseudo_dir ../../../tests/PP_ORB //the path to locate the pesudopotential
2323
orbital_dir ../../../tests/PP_ORB //the path to locate the numerical orbital files
2424
ntype 3
2525
ecutwfc 50 // Ry
26-
symmetry 0 // turn off symmetry
26+
symmetry -1 // turn off symmetry
2727
calculation nscf // non-self-consistent calculation
2828
basis_type lcao // atomic basis
2929
init_chg file // read charge from files
@@ -70,4 +70,6 @@ The results are shown as follows:
7070
P = 0.8906925 (mod 2.1748536) ( 0.0000000, 0.0000000, 0.8906925) C/m^2
7171
```
7272

73-
The electric polarization **P** is multivalued, which modulo a quantum e**R**/V~cell~. Note: the values in parentheses are the components of the **P** along the c axis in the x, y, z Cartesian coordinates when set gdir = 3 in INPUT file.
73+
The electric polarization **P** is multivalued, which modulo a quantum e**R**/V~cell~.
74+
75+
Note: The vectors R1, R2, and R3 refer to the three lattice vectors of the unit cell. When gdir=3, the calculated polarization is along the R3 direction. The three values in parentheses represent the re-projection of the polarization along the R3 direction onto the Cartesian coordinate system (i.e., the xyz coordinate system). To obtain the full polarization components in the Cartesian system, you need to calculate the polarization for R1, R2, and R3 separately, and then sum their respective x, y, and z components.

0 commit comments

Comments
 (0)