Skip to content

Commit e930cf7

Browse files
committed
Merge branch 'develop' of https://github.com/deepmodeling/abacus-develop into develop
2 parents a75d970 + 146a509 commit e930cf7

File tree

200 files changed

+3301
-2996
lines changed

Some content is hidden

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

200 files changed

+3301
-2996
lines changed

.github/workflows/coverage.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -15,10 +15,10 @@ 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

CMakeLists.txt

Lines changed: 27 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -436,22 +436,6 @@ if(ENABLE_FLOAT_FFTW)
436436
endif()
437437

438438
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})
455439
target_link_libraries(${ABACUS_BIN_NAME} deepks)
456440

457441
find_path(libnpy_SOURCE_DIR npy.hpp HINTS ${libnpy_INCLUDE_DIR})
@@ -470,6 +454,25 @@ if(ENABLE_DEEPKS)
470454
add_compile_definitions(__DEEPKS)
471455
endif()
472456

457+
# Torch uses outdated components to detect CUDA arch, causing failure on
458+
# latest CUDA kits. Set CMake variable TORCH_CUDA_ARCH_LIST in the form of
459+
# "major.minor" if required.
460+
if(ENABLE_DEEPKS OR DEFINED Torch_DIR)
461+
find_package(Torch REQUIRED)
462+
if(NOT Torch_VERSION VERSION_LESS "2.1.0")
463+
set_if_higher(CMAKE_CXX_STANDARD 17)
464+
elseif(NOT Torch_VERSION VERSION_LESS "1.5.0")
465+
set_if_higher(CMAKE_CXX_STANDARD 14)
466+
endif()
467+
include_directories(${TORCH_INCLUDE_DIRS})
468+
if(MKL_FOUND)
469+
list(PREPEND math_libs ${TORCH_LIBRARIES})
470+
else()
471+
list(APPEND math_libs ${TORCH_LIBRARIES})
472+
endif()
473+
add_compile_options(${TORCH_CXX_FLAGS})
474+
endif()
475+
473476
if (ENABLE_CNPY)
474477
find_path(cnpy_SOURCE_DIR
475478
cnpy.h
@@ -590,13 +593,14 @@ if(DEFINED DeePMD_DIR)
590593
add_compile_definitions(__DPMDC)
591594
else()
592595
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()
596+
endif()
597+
endif()
598+
599+
if(DEFINED TensorFlow_DIR)
600+
find_package(TensorFlow REQUIRED)
601+
include_directories(${TensorFlow_DIR}/include)
602+
if(TensorFlow_FOUND)
603+
target_link_libraries(${ABACUS_BIN_NAME} TensorFlow::tensorflow_cc)
600604
endif()
601605
endif()
602606

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.

docs/advanced/input_files/input-main.md

Lines changed: 1 addition & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,6 @@
3939
- [pw\_diag\_thr](#pw_diag_thr)
4040
- [pw\_diag\_nmax](#pw_diag_nmax)
4141
- [pw\_diag\_ndim](#pw_diag_ndim)
42-
- [diago\_full\_acc](#diago_full_acc)
4342
- [erf\_ecut](#erf_ecut)
4443
- [fft\_mode](#fft_mode)
4544
- [erf\_height](#erf_height)
@@ -779,12 +778,6 @@ These variables are used to control the plane wave related parameters.
779778
- **Description**: Only useful when you use `ks_solver = dav` or `ks_solver = dav_subspace`. It indicates dimension of workspace(number of wavefunction packets, at least 2 needed) for the Davidson method. A larger value may yield a smaller number of iterations in the algorithm but uses more memory and more CPU time in subspace diagonalization.
780779
- **Default**: 4
781780

782-
### diago_full_acc
783-
784-
- **Type**: bool
785-
- **Description**: Only useful when you use `ks_solver = dav_subspace`. If `TRUE`, all the empty states are diagonalized at the same level of accuracy of the occupied ones. Otherwise the empty states are diagonalized using a larger threshold (10-5) (this should not affect total energy, forces, and other ground-state properties).
786-
- **Default**: false
787-
788781
### erf_ecut
789782

790783
- **Type**: Real
@@ -925,7 +918,7 @@ calculations.
925918
- **cg**: cg method.
926919
- **bpcg**: bpcg method, which is a block-parallel Conjugate Gradient (CG) method, typically exhibits higher acceleration in a GPU environment.
927920
- **dav**: the Davidson algorithm.
928-
- **dav_subspace**: subspace Davidson algorithm
921+
- **dav_subspace**: Davidson algorithm without orthogonalization operation, this method is the most recommended for efficiency. `pw_diag_ndim` can be set to 2 for this method.
929922

930923
For atomic orbitals basis,
931924

docs/advanced/install.md

Lines changed: 25 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -38,13 +38,22 @@ cmake -B build -DENABLE_DEEPKS=1 -DTorch_DIR=~/libtorch/share/cmake/Torch/ -Dlib
3838
If the Deep Potential model is employed in Molecule Dynamics calculations, the following prerequisites and steps are needed:
3939

4040
- [DeePMD-kit](https://github.com/deepmodeling/deepmd-kit)
41-
- [TensorFlow](https://www.tensorflow.org/)
41+
- [TensorFlow](https://www.tensorflow.org/) (optional)
42+
- [LibTorch](https://pytorch.org/) (optional)
4243

44+
In the simplest case, the `tensorflow_cc` and `torch` libraries are in the same directory as the `deepmd_c`/`deepmd_cc` libraries, then
4345
```bash
44-
cmake -B build -DDeePMD_DIR=~/deepmd-kit -DTensorFlow_DIR=~/tensorflow
46+
cmake -B build -DDeePMD_DIR=/dir_to_deepmd-kit
4547
```
48+
DeePMD-kit supports TensorFlow backend but its libraries are placed at another directory, then
4649

47-
> `deepmd_c`/`deepmd_cc` and `tensorflow_cc` libraries would be called according to `DeePMD_DIR` and `TensorFlow_DIR`, which is showed in detail in [this page](https://github.com/deepmodeling/deepmd-kit/blob/master/doc/inference/cxx.md). If `TensorFlow_DIR` is not defined, it will be the same as `DeePMD_DIR`. Note that `tensorflow_cc` is not required if `deepmd_c` is found.
50+
```bash
51+
cmake -B build -DDeePMD_DIR=/dir_to_deepmd-kit -DTensorFlow_DIR=/dir_to_tensorflow
52+
```
53+
Similarly, DeePMD-kit supports PyTorch backend but its libraries are placed at another directory, then
54+
```bash
55+
cmake -B build -DDeePMD_DIR=/dir_to_deepmd-kit -DTorch_DIR=/dir_to_pytorch
56+
```
4857

4958
## Build with LibRI and LibComm
5059

@@ -93,9 +102,9 @@ cmake -B build -DUSE_CUDA=1 -DCMAKE_CUDA_COMPILER=${path to cuda toolkit}/bin/nv
93102

94103
## Build math library from source
95104

96-
> Note: This flag is **enabled by default**. It will get better performance than the standard implementation on `gcc` and `clang`. But it **will be disabled** when using `Intel Compiler` since the math functions will get wrong results and the performance is also unexpectly poor.
105+
> Note: We recommend using the latest available compiler sets, since they offer faster implementations of math functions.
97106
98-
To build math functions from source code, instead of using c++ standard implementation, define `USE_ABACUS_LIBM` flag.
107+
This flag is disabled by default. To build math functions from source code, define `USE_ABACUS_LIBM` flag. It is expected to get a better performance on legacy versions of `gcc` and `clang`.
99108

100109
Currently supported math functions:
101110
`sin`, `cos`, `sincos`, `exp`, `cexp`
@@ -282,15 +291,21 @@ directly.
282291

283292
> Note: This part is only required if you want to load a trained DeeP Potential and run molecular dynamics with that. To train the DeeP Potential with DP-GEN, no extra prerequisite is needed and please refer to [this page](http://abacus.deepmodeling.com/en/latest/advanced/interface/dpgen.html) for ABACUS interface with DP-GEN.
284293
285-
To compile ABACUS with DeePMD-kit, you need to define `DeePMD_DIR` and `TensorFlow_DIR` in the file `Makefile.vars` or use
294+
To compile ABACUS with DeePMD-kit, you need to define `DeePMD_DIR` and `TensorFlow_DIR` (TensorFlow Backend, optional) and/or `LIBTORCH_DIR` (PyTorch Backend, optional) in the file `Makefile.vars`.
286295

296+
Or the `tensorflow_cc` and `torch` libraries are in the same directory as the `deepmd_c`/`deepmd_cc` libraries, then
287297
```makefile
288-
make DeePMD_DIR=~/deepmd-kit TensorFlow_DIR=~/tensorflow
298+
make DeePMD_DIR=/dir_to_deepmd-kit
289299
```
300+
DeePMD-kit supports TensorFlow backend but its libraries are placed at another directory, then
290301

291-
directly.
292-
293-
> `deepmd_c`/`deepmd_cc` and `tensorflow_cc` libraries would be called according to `DeePMD_DIR` and `TensorFlow_DIR`, which is showed in detail in [this page](https://github.com/deepmodeling/deepmd-kit/blob/master/doc/inference/cxx.md). If `TensorFlow_DIR` is not defined, it will be the same as `DeePMD_DIR`. Note that `tensorflow_cc` is not required if `deepmd_c` is found.
302+
```makefile
303+
make DeePMD_DIR=/dir_to_deepmd-kit TensorFlow_DIR=/dir_to_tensorflow
304+
```
305+
Similarly, DeePMD-kit supports PyTorch backend but its libraries are placed at another directory, then
306+
```makefile
307+
make DeePMD_DIR=/dir_to_deepmd-kit Torch_DIR=/dir_to_pytorch
308+
```
294309

295310
### Add LibRI Support
296311
To use new EXX, you need two libraries: [LibRI](https://github.com/abacusmodeling/LibRI) and [LibComm](https://github.com/abacusmodeling/LibComm) and need to define `LIBRI_DIR` and `LIBCOMM_DIR` in the file `Makefile.vars` or use

docs/advanced/pp_orb.md

Lines changed: 57 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,20 @@ Inside ABACUS, orbitals in LCAO basis are arranged lexicographically by species-
1919

2020
## Generating atomic orbital bases
2121

22-
Users may also choose to generate their own atomic obitals. In ABACUS, the atomic orbital bases are generated using a scheme developed in the [paper](https://iopscience.iop.org/article/10.1088/0953-8984/22/44/445501). A detailed description of the procedure for generating orbitals will be provided later.
22+
Users may also generate ABACUS numerical atomic obitals based on their own flavor. The theoretical background of orbital generation can be found in following works:
23+
24+
- Spillage: [Chen M, Guo G C, He L. Systematically improvable optimized atomic basis sets for ab initio calculations[J]. Journal of Physics: Condensed Matter, 2010, 22(44): 445501.](https://iopscience.iop.org/article/10.1088/0953-8984/22/44/445501)
25+
- PTG DPSI: [Lin P, Ren X, He L. Strategy for constructing compact numerical atomic orbital basis sets by incorporating the gradients of reference wavefunctions[J]. Physical Review B, 2021, 103(23): 235131.](https://journals.aps.org/prb/abstract/10.1103/PhysRevB.103.235131)
26+
27+
Guidelines for generating atomic orbital bases are as follows:
28+
29+
- [Numerical Atomic Orbitals 1: the nomenclature and usage of numerical atomic orbitals in ABACUS](https://mcresearch.github.io/abacus-user-guide/abacus-nac1.html) (Chinese)
30+
- [Numerical Atomic Orbitals 2: generate numerical atomic orbitals based on given norm-conserving pseudopotential](https://mcresearch.github.io/abacus-user-guide/abacus-nac1.html) (Chinese)
31+
- [Numerical Atomic Orbitals 3: generate high-precision numerical atomic orbitals](https://mcresearch.github.io/abacus-user-guide/abacus-nac1.html) (Chinese)
32+
33+
Stable orbital generation programs can be found in guidelines above, there is also another developing version of orbital generation program, in which algorithms are consecutively improved: [Github repository of ABACUS ORBGEN project](https://github.com/kirk0830/ABACUS-ORBGEN), the usage of which can be found in README (in English) file.
34+
35+
*NOTE*: users are encouraged to cite the above works when numerical atomic orbitals and its generation codes are used in their research.
2336

2437
## BSSE Correction
2538

@@ -51,16 +64,46 @@ $$
5164
$$
5265

5366
## Pseudopotentials
54-
55-
In ABACUS, we support norm-conserving and ultrasoft pseudopotentials.
56-
For norm-conserving pseudopotentials, we support four different formats of the pseudopotential files: UPF, UPF2, VWR, and BLPS.
57-
For ultrasoft pseudopotentials, currently we support only one format of the pseudopotential files: UPF2.
58-
59-
For more information, check the `ATOMIC_SPECIES` section in the specification of the [STRU file](./input_files/stru.md).
60-
61-
Here we list some common sources of the pseudopotential files:
62-
63-
1. [Quantum ESPRESSO](http://www.quantum-espresso.org/pseudopotentials/).
64-
2. [SG15-ONCV](http://quantum-simulation.org/potentials/sg15_oncv/upf/).
65-
3. [DOJO](http://www.pseudo-dojo.org/).
66-
4. [BLPS](https://github.com/PrincetonUniversity/BLPSLibrary).
67+
### Supported formats
68+
ABACUS supports both norm-conserving and ultrasoft pseudopotentials. For norm-conserving pseudopotentials, UPF, UPF2, VWR, and BLPS formats are supported. For ultrasoft pseudopotentials, UPF and UPF2 formats are supported.
69+
70+
### Usage
71+
For more information about pseudopotential usage, check the `ATOMIC_SPECIES` section in the specification of the [STRU file](./input_files/stru.md).
72+
73+
### Download
74+
Users can find pseudopotentials in the following links:
75+
76+
**Website**
77+
- [Quantum ESPRESSO](https://www.quantum-espresso.org/pseudopotentials): the official website of Quantum ESPRESSO, where you can find a large number of pseudopotential files.
78+
- [Stantard Solid State Pseudopotential library](https://www.materialscloud.org/sssp): a library of **high-quality** pseudopotentials for solid-state calculations, with **a large number of tests on efficiency and precison**.
79+
- [PWmat](http://www.pwmat.com/potential-download): a website that provides a large number of pseudopotential files, various kinds of semi-core constructed pseudopotentials are included. **Several sets (with or without f-electrons/noncolinear core correction) of Lanthanide pseudopotentials are also available**.
80+
- [THEOS](http://theossrv1.epfl.ch/Main/Pseudopotentials): PSlibrary 0.3.1, a library of pseudopotentials for DFT calculations, including ultrasoft, paw, norm-conserving both full-relativistic and scalar-relativistic pseudopotentials.
81+
- [ABACUS@USTC](https://abacus.ustc.edu.cn/pseudo/list.htm): **ABACUS official website** where you can find a large number of pseudopotential files and numerical atomic orbital files.
82+
- [BLPS](https://github.com/PrincetonUniversity/BLPSLibrary): BLPS format pseudopotential library
83+
84+
**Norm-conserving pseudopotentials**
85+
- [SG15](http://www.quantum-simulation.org/potentials/sg15_oncv/): **vastly used in ABACUS** DFT calculation and numerical atomic orbital generation.
86+
- [PseudoDOJO](http://www.pseudo-dojo.org/): another widely used pseudopotential database, developed by Abinit group, **including Lanthanide pseudopotentials (f-electrons frozen)**.
87+
- [The Rappe group](https://www.sas.upenn.edu/rappegroup/research/pseudo-potential-gga.html): a collection of GGA pseudopotentials which are generated with Opium code, several tests proves that are out-performing in alloy systems.
88+
- [Matteo Giantomassi's Github repo](https://github.com/gmatteo/pseudos_ac_she): a Github repository that contains norm-conserving pseudopotentials for **Actinides and superheavy elements to 120-th element**.
89+
90+
**Ultrasoft pseudopotentials**
91+
- [Vanderbilt](http://www.physics.rutgers.edu/~dhv/uspp/): a collection of ultrasoft pseudopotentials generated by Vanderbilt group.
92+
- [GBRV](https://www.physics.rutgers.edu/gbrv/) by Kevin F. Garrity, Joseph W. Bennett, Karin M. Rabe, and David Vanderbilt: presently the most popular ultrasoft pseudpotentials in Quantum ESPRESSO user community.
93+
94+
### Pseudopotential Generation
95+
For pseudopotential generation, please refer to the following links for more information:
96+
- [Quantum ESPRESSO](http://www.quantum-espresso.org/pseudopotentials/)
97+
- [ONCVPSP](http://www.mat-simresearch.com/)
98+
- [Opium](https://opium.sourceforge.net/)
99+
100+
A Chinese guideline is also available here: [A brief introduction of norm-conserving pseudopotential generation](https://mcresearch.github.io/abacus-user-guide/abacus-upf.html)
101+
102+
# ABACUS Pseudopotential-Numerical atomic orbital Square (APNS) project
103+
For the purpose of providing high-quality pseudopotentials and numerical atomic orbitals, we have initiated the APNS project. The project is aimed at providing a large number of high-quality pseudopotentials and numerical atomic orbitals, along with diverse test data for the ABACUS user community, reduce the cost of generating and testing pseudopotentials and numerical atomic orbitals by users, and promote the development of ABACUS software. The project is currently in the development stage, and we welcome contributions from the community. For more information, please refer to the following links:
104+
- [APNS website: test data and results](https://kirk0830.github.io/ABACUS-Pseudopot-Nao-Square/)
105+
- [APNS workflow (Github repository): high-throughput test of pseudopotentials and numerical atomic orbitals](https://github.com/kirk0830/ABACUS-Pseudopot-Nao-Square)
106+
107+
There are also other excellent projects that provide high-quality pseudopotentials along with test data:
108+
- [Solid State Pseudopotential library](https://www.materialscloud.org/sssp)
109+
- [Verification of the precision of DFT implementation via AiiDA common workflows](https://acwf-verification.materialscloud.org/)

docs/conf.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@
1818
# -- Project information -----------------------------------------------------
1919

2020
project = 'ABACUS'
21-
copyright = '2022, ABACUS'
21+
copyright = '2024, ABACUS'
2222
author = 'ABACUS'
2323

2424
# The full version, including alpha/beta/rc tags

examples/berryphase/lcao_PbTiO3/INPUT-nscf-a

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ pseudo_dir ../../../tests/PP_ORB
33
orbital_dir ../../../tests/PP_ORB
44
ntype 3
55
ecutwfc 50
6-
symmetry 0
6+
symmetry -1
77
calculation nscf
88
basis_type lcao
99
init_chg file

examples/berryphase/lcao_PbTiO3/INPUT-nscf-b

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ pseudo_dir ../../../tests/PP_ORB
33
orbital_dir ../../../tests/PP_ORB
44
ntype 3
55
ecutwfc 50
6-
symmetry 0
6+
symmetry -1
77
calculation nscf
88
basis_type lcao
99
init_chg file

examples/berryphase/lcao_PbTiO3/INPUT-nscf-c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ pseudo_dir ../../../tests/PP_ORB
33
orbital_dir ../../../tests/PP_ORB
44
ntype 3
55
ecutwfc 50
6-
symmetry 0
6+
symmetry -1
77
calculation nscf
88
basis_type lcao
99
init_chg file

0 commit comments

Comments
 (0)