Skip to content

Commit 3c80ac0

Browse files
committed
Merge branch 'develop' of github.com:deepmodeling/abacus-develop into HSolver
2 parents 517125c + 68d3aaa commit 3c80ac0

File tree

455 files changed

+80849
-8700
lines changed

Some content is hidden

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

455 files changed

+80849
-8700
lines changed

.github/workflows/performance.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@ jobs:
2626
cmake --install build
2727
- name: Test
2828
run: |
29-
. /opt/intel/oneapi/setvars.sh 2> /dev/null || :
29+
test -e /opt/intel/oneapi/setvars.sh && . /opt/intel/oneapi/setvars.sh
3030
cd examples/performance/
3131
bash run.sh
3232
- name: Show Result

CMakeLists.txt

Lines changed: 26 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,11 @@
11
########################################
22
# CMake build system
33
# This file is part of ABACUS
4-
cmake_minimum_required(VERSION 3.18)
4+
cmake_minimum_required(VERSION 3.16)
55
########################################
66

77
project(ABACUS
8-
VERSION 2.2.0
8+
VERSION 2.2.3
99
DESCRIPTION "ABACUS is an electronic structure package based on DFT."
1010
HOMEPAGE_URL "https://github.com/deepmodeling/abacus-develop"
1111
LANGUAGES CXX
@@ -22,14 +22,16 @@ option(BUILD_TESTING "Build ABACUS unit tests" OFF)
2222
option(GENERATE_TEST_REPORTS "Enable test report generation" OFF)
2323

2424
set(ABACUS_BIN_NAME abacus)
25-
set(CMAKE_MODULE_PATH ${CMAKE_CURRENT_SOURCE_DIR}/modules)
25+
list(APPEND CMAKE_MODULE_PATH ${CMAKE_CURRENT_SOURCE_DIR}/modules)
2626
set(ABACUS_SOURCE_DIR ${CMAKE_CURRENT_SOURCE_DIR}/source)
2727
set(ABACUS_TEST_DIR ${CMAKE_CURRENT_SOURCE_DIR}/tests)
2828
set(ABACUS_BIN_PATH ${CMAKE_CURRENT_BINARY_DIR}/${ABACUS_BIN_NAME})
2929
include_directories(${ABACUS_SOURCE_DIR})
3030
add_executable(${ABACUS_BIN_NAME} source/main.cpp)
31+
set(CMAKE_CXX_STANDARD 11)
32+
set(CMAKE_CXX_STANDARD_REQUIRED ON)
3133
add_compile_options(-O2 -g)
32-
SET(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wno-write-strings" )
34+
add_compile_options(-Wno-write-strings)
3335

3436
find_package(Cereal REQUIRED)
3537
include_directories(${Cereal_INCLUDE_DIR})
@@ -52,10 +54,9 @@ if(USE_OPENMP)
5254
find_package(OpenMP REQUIRED)
5355
target_link_libraries(${ABACUS_BIN_NAME} OpenMP::OpenMP_CXX)
5456
add_compile_options(${OpenMP_CXX_FLAGS})
55-
#add_compile_definitions(_OPENMP)
57+
add_link_options(${OpenMP_CXX_LIBRARIES})
5658
endif()
5759

58-
set(CMAKE_CXX_STANDARD 11)
5960
include(CheckLanguage)
6061
check_language(CUDA)
6162
if(CMAKE_CUDA_COMPILER)
@@ -71,7 +72,7 @@ if(CMAKE_CUDA_COMPILER)
7172
endif()
7273
else()
7374
if(NOT USE_CUDA AND NOT USE_CUSOLVER_LCAO)
74-
message(WARNING "CUDA components detected, but both USE_CUDA and USE_CUSOLVER_LCAO set to OFF. \nNOT building CUDA version of ABACUS.")
75+
message(STATUS "CUDA components detected, but both USE_CUDA and USE_CUSOLVER_LCAO set to OFF. NOT building CUDA version of ABACUS.")
7576
elseif (USE_CUDA AND USE_CUSOLVER_LCAO)
7677
message(FATAL_ERROR "USE_CUDA and USE_CUSOLVER_LCAO set, but now they not allowed to coexist.")
7778
endif()
@@ -85,10 +86,10 @@ else() # CUDA not found
8586
endif()
8687

8788
if(USE_CUDA OR USE_CUSOLVER_LCAO)
89+
cmake_minimum_required(VERSION 3.18) # required by `CUDA_ARCHITECTURES` below
8890
set(CMAKE_CXX_STANDARD 14)
8991
set(CMAKE_CXX_EXTENSIONS ON)
90-
set(CMAKE_CXX_STANDARD_REQUIRED ON)
91-
set(CMAKE_CUDA_STANDARD 14)
92+
set(CMAKE_CUDA_STANDARD ${CMAKE_CXX_STANDARD})
9293
set(CMAKE_CUDA_STANDARD_REQUIRED ON)
9394
set(CMAKE_CUDA_HOST_COMPILER ${CMAKE_CXX_COMPILER})
9495
enable_language(CUDA)
@@ -119,9 +120,7 @@ endif()
119120
# Warning: CMake add support to HIP in version 3.21. This is rather a new version.
120121
# Use cmake with AMD-ROCm: https://rocmdocs.amd.com/en/latest/Installation_Guide/Using-CMake-with-AMD-ROCm.html
121122
if(USE_ROCM)
122-
set(CMAKE_CXX_STANDARD 11)
123-
SET(CMAKE_HIP_STANDARD 11)
124-
# set(CMAKE_CXX_STANDARD_REQUIRED True)
123+
SET(CMAKE_HIP_STANDARD ${CMAKE_CXX_STANDARD})
125124
list(APPEND CMAKE_PREFIX_PATH /opt/rocm/hip /opt/rocm)
126125
list(APPEND CMAKE_SYSTEM_PREFIX_PATH "/opt/rocm/hip")
127126

@@ -144,6 +143,9 @@ if(USE_ROCM)
144143
endif()
145144

146145
if(ENABLE_ASAN)
146+
if (CMAKE_CXX_COMPILER_ID STREQUAL "Intel")
147+
message(FATAL_ERROR "Address Sanitizer is not supported on Intel compiler.")
148+
endif()
147149
add_compile_options(
148150
-fsanitize=address
149151
-fno-omit-frame-pointer
@@ -205,13 +207,16 @@ if(ENABLE_DEEPKS)
205207
FetchContent_Declare(
206208
libnpy
207209
GIT_REPOSITORY https://github.com/llohse/libnpy.git
210+
GIT_SHALLOW TRUE
211+
GIT_PROGRESS TRUE
208212
)
209213
FetchContent_MakeAvailable(libnpy)
210214
endif()
211215
include_directories(${libnpy_SOURCE_DIR}/include)
212216
add_compile_definitions(__DEEPKS)
213217
endif()
214218

219+
list(APPEND math_libs m)
215220
target_link_libraries(${ABACUS_BIN_NAME} ${math_libs})
216221

217222
if(DEFINED Libxc_DIR)
@@ -243,17 +248,18 @@ add_compile_definitions(
243248
)
244249

245250
IF (BUILD_TESTING)
251+
set(CMAKE_CXX_STANDARD 14) # Required in orbital
246252
include(CTest)
247253
enable_testing()
248-
find_package(Threads)
249-
set(CMAKE_CXX_STANDARD_REQUIRED ON)
250254
find_package(GTest HINTS /usr/local/lib/ ${GTEST_DIR})
251255
if(NOT ${GTest_FOUND})
252256
include(FetchContent)
253257
FetchContent_Declare(
254258
googletest
255259
GIT_REPOSITORY https://github.com/google/googletest.git
256260
GIT_TAG "origin/main"
261+
GIT_SHALLOW TRUE
262+
GIT_PROGRESS TRUE
257263
)
258264
FetchContent_MakeAvailable(googletest)
259265
endif()
@@ -266,8 +272,11 @@ IF (BUILD_TESTING)
266272
add_executable(${UT_TARGET} ${UT_SOURCES})
267273
#dependencies & link library
268274
target_link_libraries(${UT_TARGET} ${UT_LIBS}
269-
OpenMP::OpenMP_CXX pthread GTest::gtest_main GTest::gmock_main)
270-
install(TARGETS ${UT_TARGET} DESTINATION ${CMAKE_CURRENT_BINARY_DIR}/../../../tests )
275+
Threads::Threads GTest::gtest_main GTest::gmock_main)
276+
if(USE_OPENMP)
277+
target_link_libraries(${UT_TARGET} OpenMP::OpenMP_CXX)
278+
endif()
279+
install(TARGETS ${UT_TARGET} DESTINATION ${CMAKE_BINARY_DIR}/tests )
271280
add_test(NAME ${UT_TARGET}
272281
COMMAND ${UT_TARGET}
273282
WORKING_DIRECTORY $<TARGET_FILE_DIR:${UT_TARGET}>
@@ -289,6 +298,7 @@ target_link_libraries(${ABACUS_BIN_NAME}
289298
io
290299
ions
291300
lcao
301+
gint
292302
parallel
293303
mrrr
294304
pdiag
@@ -301,7 +311,6 @@ target_link_libraries(${ABACUS_BIN_NAME}
301311
hamilt
302312
psi
303313
esolver
304-
-lm
305314
)
306315

307316
install(PROGRAMS ${ABACUS_BIN_PATH}

Dockerfile

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
1-
# To build this docker file, run `docker build -t abacus - < Dockerfile`.
1+
# To build this Dockerfile, run `docker build -t abacus - < Dockerfile`.
2+
# Pull image with `docker pull ghcr.io/deepmodeling/abacus:latest`.
23
FROM ubuntu:latest
34
RUN apt update && apt install -y --no-install-recommends libopenblas-dev liblapack-dev libscalapack-mpi-dev libelpa-dev libfftw3-dev libcereal-dev libxc-dev g++ make cmake bc time sudo vim git
45
# If you wish to use the LLVM compiler, replace 'g++' above with 'clang libomp-dev'.

Dockerfile.gnu

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,9 @@
11
FROM debian:bullseye-slim
22

3-
RUN apt-get update && apt-get install -y --no-install-recommends git g++ gfortran libssl-dev make cmake vim wget bc unzip \
3+
RUN apt-get update && apt-get install -y --no-install-recommends git g++ gfortran libssl-dev make cmake vim wget bc unzip python3-numpy\
44
&& apt-get install -y --no-install-recommends mpich libmpich-dev
55

6-
ENV GIT_SSL_NO_VERIFY 1
6+
ENV GIT_SSL_NO_VERIFY=1 TERM=xterm-256color
77

88
RUN cd /tmp \
99
&& git clone https://github.com/USCiLab/cereal.git \

docs/CONTRIBUTING.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,6 @@ This file provides a guideline for it.
66
## Table of Contents
77

88
- [Got a question?](#got-a-question)
9-
- [Before getting started](#before-getting-started)
109
- [Structure of the package](#structure-of-the-package)
1110
- [Submitting an Issue](#submitting-an-issue)
1211
- [Comment Style for documentation](#comment-style-for-documentation)
@@ -23,6 +22,7 @@ If you would like to implement a new feature, please submit an issue with a prop
2322

2423
## Structure of the package
2524

25+
Please refer to [our instructions](./install.md) on how to installing ABACUS.
2626
The source code of ABACUS is based on several modules. Under the ABACUS root directory, there are the following folders:
2727

2828
- `cmake`: relevant files for finding required packages when compiling the code with cmake;

docs/input-main.md

Lines changed: 34 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,11 @@
2424

2525
- [Electronic structure](#electronic-structure)
2626

27-
[basis_type](#basis-type) | [ks_solver](#ks-solver) | [nbands](#nbands) | [nbands_sto](#nbands_sto) | [nbands_istate](#nbands-istate) | [nspin](#nspin) | [occupations](#occupations) | [smearing_method](#smearing_method) | [smearing_sigma](#smearing_sigma) | [mixing_type](#mixing-type) | [mixing_beta](#mixing-beta) | [mixing_ndim](#mixing-ndim) | [mixing_gg0](#mixing-gg0) | [gamma_only](#gamma-only) | [printe](#printe) | [scf_nmax](#scf_nmax) | [scf_thr](#scf_thr) | [chg_extrap](#chg_extrap) | [nche_sto](#nche_sto) | [emin_sto](#emin_sto) | [emax_sto](#emax_sto) | [seed_sto](#seed_sto)
27+
[basis_type](#basis-type) | [ks_solver](#ks-solver) | [nbands](#nbands) | [nbands_istate](#nbands-istate) | [nspin](#nspin) | [occupations](#occupations) | [smearing_method](#smearing_method) | [smearing_sigma](#smearing_sigma) | [mixing_type](#mixing-type) | [mixing_beta](#mixing-beta) | [mixing_ndim](#mixing-ndim) | [mixing_gg0](#mixing-gg0) | [gamma_only](#gamma-only) | [printe](#printe) | [scf_nmax](#scf_nmax) | [scf_thr](#scf_thr) | [chg_extrap](#chg_extrap)
28+
29+
- [Electronic structure (SDFT)](#electronic-structure-sdft)
30+
31+
[nbands_sto](#nbands_sto) | [nche_sto](#nche_sto) | [emin_sto](#emin_sto) | [emax_sto](#emax_sto) | [seed_sto](#seed_sto)
2832

2933
- [Geometry relaxation](#geometry-relaxation)
3034

@@ -72,7 +76,7 @@
7276

7377
- [Electric field and dipole correction](#Electric-field-and-dipole-correction)
7478

75-
[efield](#efield) | [dipole](#dipole) | [edir](#edir) | [emaxpos](#emaxpos) | [eopreg](#eopreg) | [eamp](#eamp)
79+
[efield_flag](#efield_flag) | [dip_cor_flag](#dip_cor_flag) | [efield_dir](#efield_dir) | [efield_pos_max](#efield_pos_max) | [efield_pos_dec](#efield_pos_dec) | [efield_amp ](#efield_amp )
7680

7781
[back to main page](../README.md)
7882

@@ -464,14 +468,6 @@ calculations.
464468
- nspin=1: 1.2\*occupied_bands, occupied_bands+10)
465469
- nspin=2: max(1.2\*nelec, nelec+20)
466470
467-
#### nbands_sto
468-
469-
- **Type**: Integer
470-
- **Description**:
471-
- nbands_sto>0: Number of stochastic orbitals to calculate in stochastic DFT (SDFT) or mix stochastic-deterministic (MDFT). More bands obtain more precise results or smaller stochastic errors ($ \propto 1/\sqrt{N_{\chi}}$);
472-
- nbands_sto=0: Complete basis will be used to replace stochastic orbitals with the Chebyshev method (CT) and it will get the results the same as KSDFT without stochastic errors.
473-
- **Default**: 0
474-
475471
#### nbands_istate
476472
477473
- **Type**: Integer
@@ -570,6 +566,21 @@ calculations.
570566
- second-order: second-order extrapolation
571567
- **Default**:atomic
572568
569+
by time(NULL).
570+
- **Default**:0
571+
572+
### Electronic structure (SDFT)
573+
574+
This part of variables are used to control the parameters of stochastic DFT (SDFT), mix stochastic-deterministic DFT (MDFT), or complete-basis Chebyshev method (CT).
575+
576+
#### nbands_sto
577+
578+
- **Type**: Integer
579+
- **Description**:
580+
- nbands_sto>0: Number of stochastic orbitals to calculate in SDFT and MDFT. More bands obtain more precise results or smaller stochastic errors ($ \propto 1/\sqrt{N_{\chi}}$);
581+
- nbands_sto=0: Complete basis will be used to replace stochastic orbitals with the Chebyshev method (CT) and it will get the results the same as KSDFT without stochastic errors.
582+
- **Default**: 0
583+
573584
#### nche_sto
574585
575586
- **Type**: Integer
@@ -593,8 +604,7 @@ calculations.
593604
- **Type**: Integer
594605
- **Description**: The random seed to generate stochastic orbitals.
595606
- seed_sto>=0: Stochastic orbitals have the form of $\exp(i2\pi\theta(G))$, where $\theta$ is a uniform distribution in $(0,1)$. If seed_sto=0, the seed is decided by time(NULL).
596-
- seed_sto<=-1: Stochastic orbitals have the form of $\pm1$ with the equal probability. If seed_sto=-1, the seed is decided by time(NULL).
597-
- **Default**:0
607+
- seed_sto<=-1: Stochastic orbitals have the form of $\pm1$ with the equal probability. If seed_sto=-1, the seed is decided
598608
599609
### Geometry relaxation
600610
@@ -918,42 +928,42 @@ Warning: this function is not robust enough for version 2.2.0. Please try these
918928
919929
This part of variables are relevant to electric field and dipole correction
920930
921-
#### efield
931+
#### efield_flag
922932
923933
- **Type**: Boolean
924934
- **Description**: If set to true, a saw-like potential simulating an electric field
925935
is added to the bare ionic potential.
926936
- **Default**: false
927937
928-
#### dipole
938+
#### dip_cor_flag
929939
930940
- **Type**: Boolean
931-
- **Description**: If dipole == true and efield == true, a dipole correction is also
932-
added to the bare ionic potential. If you want no electric field, parameter eamp should be zero. Must be used ONLY in a slab geometry for surface calculations, with the discontinuity FALLING IN THE EMPTY SPACE.
941+
- **Description**: If dip_cor_flag == true and efield_flag == true, a dipole correction is also
942+
added to the bare ionic potential. If you want no electric field, parameter efield_amp should be zero. Must be used ONLY in a slab geometry for surface calculations, with the discontinuity FALLING IN THE EMPTY SPACE.
933943
- **Default**: false
934944
935-
#### edir
945+
#### efield_dir
936946
937947
- **Type**: Integer
938-
- **Description**: The direction of the electric field or dipole correction is parallel to the reciprocal lattice vector, so the potential is constant in planes defined by FFT grid points, edir = 0, 1 or 2. Used only if efield == true.
948+
- **Description**: The direction of the electric field or dipole correction is parallel to the reciprocal lattice vector, so the potential is constant in planes defined by FFT grid points, efield_dir = 0, 1 or 2. Used only if efield_flag == true.
939949
- **Default**: 2
940950
941-
#### emaxpos
951+
#### efield_pos_max
942952
943953
- **Type**: Real
944-
- **Description**: Position of the maximum of the saw-like potential along crystal axis edir, within the unit cell, 0 < emaxpos < 1. Used only if efield == true.
954+
- **Description**: Position of the maximum of the saw-like potential along crystal axis efield_dir, within the unit cell, 0 < efield_pos_max < 1. Used only if efield_flag == true.
945955
- **Default**: 0.5
946956
947-
#### eopreg
957+
#### efield_pos_dec
948958
949959
- **Type**: Real
950-
- **Description**: Zone in the unit cell where the saw-like potential decreases, 0 < eopreg < 1. Used only if efield == true.
960+
- **Description**: Zone in the unit cell where the saw-like potential decreases, 0 < efield_pos_dec < 1. Used only if efield_flag == true.
951961
- **Default**: 0.1
952962
953-
#### eamp
963+
#### efield_amp
954964
955965
- **Type**: Real
956-
- **Description**: Amplitude of the electric field, in ***Hartree*** a.u.; 1 a.u. = 51.4220632*10^10 V/m. Used only if efield == true. The saw-like potential increases with slope eamp in the region from (emaxpos+eopreg-1) to (emaxpos), then decreases until (emaxpos+eopreg), in units of the crystal vector edir. Important: the change of slope of this potential must be located in the empty region, or else unphysical forces will result.
966+
- **Description**: Amplitude of the electric field, in ***Hartree*** a.u.; 1 a.u. = 51.4220632*10^10 V/m. Used only if efield_flag == true. The saw-like potential increases with slope efield_amp in the region from (efield_pos_max+efield_pos_dec-1) to (efield_pos_max), then decreases until (efield_pos_max+efield_pos_dec), in units of the crystal vector efield_dir. Important: the change of slope of this potential must be located in the empty region, or else unphysical forces will result.
957967
- **Default**: 0.0
958968
959969
### Exact Exchange

0 commit comments

Comments
 (0)