Skip to content

Commit 365fb4a

Browse files
authored
Ultrasoft pseudopotentials (#3122)
* Feature: PW_Basis_Sup class * Refactor: class PW_Basis_Sup * Feature: enable energy calculation of uspp * Feature: cal force in uspp * Featrue: stress calculation of uspp in pw * Refactor: update GPU interface of some functions * Test: add unittests * Docs: add docs and examples
1 parent 5541227 commit 365fb4a

File tree

103 files changed

+29657
-761
lines changed

Some content is hidden

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

103 files changed

+29657
-761
lines changed

docs/advanced/input_files/input-main.md

Lines changed: 10 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,7 @@
3939
- [ecutwfc](#ecutwfc)
4040
- [ecutrho](#ecutrho)
4141
- [nx, ny, nz](#nx-ny-nz)
42-
- [nsx, nsy, nsz](#nsx-nsy-nsz)
42+
- [ndx, ndy, ndz](#ndx-ndy-ndz)
4343
- [pw\_seed](#pw_seed)
4444
- [pw\_diag\_thr](#pw_diag_thr)
4545
- [pw\_diag\_nmax](#pw_diag_nmax)
@@ -699,13 +699,19 @@ These variables are used to control the plane wave related parameters.
699699
### nx, ny, nz
700700

701701
- **Type**: Integer
702-
- **Description**: If set to a positive number, then the three variables specify the numbers of FFT grid points in x, y, z directions, respectively. If set to 0, the number will be calculated from ecutrho. Note: you must specify all three dimensions for this setting to be used.
702+
- **Description**: If set to a positive number, then the three variables specify the numbers of FFT grid points in x, y, z directions, respectively. If set to 0, the number will be calculated from ecutrho.
703+
704+
Note: You must specify all three dimensions for this setting to be used.
703705
- **Default**: 0
704706

705-
### nsx, nsy, nsz
707+
### ndx, ndy, ndz
706708

707709
- **Type**: Integer
708-
- **Description**: If set to a positive number, then the three variables specify the numbers of FFT grid (for the smooth part of charge density in ultrasoft pseudopotential) points in x, y, z directions, respectively. If set to 0, the number will be calculated from ecutwfc. Note: you must specify all three dimensions for this setting to be used.
710+
- **Description**: If set to a positive number, then the three variables specify the numbers of FFT grid (for the dense part of charge density in ultrasoft pseudopotential) points in x, y, z directions, respectively. If set to 0, the number will be calculated from ecutwfc.
711+
712+
Note: You must specify all three dimensions for this setting to be used.
713+
714+
Note: These parameters must be used combined with [nx,ny,nz](#nx-ny-nz). If [nx,ny,nz](#nx-ny-nz) are unset, ndx,ndy,ndz are used as [nx,ny,nz](#nx-ny-nz).
709715
- **Default**: 0
710716

711717
### pw_seed

docs/advanced/pp_orb.md

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,11 @@ $$
4545

4646
## Pseudopotentials
4747

48-
In ABACUS, we only support norm-conserving pseudopotentials. We support four different formats of the pseudopotential files: UPF, UPF2, VWR, and BLPS. For more information, check the `ATOMIC_SPECIES` section in the specification of the [STRU file](./input_files/stru.md).
48+
In ABACUS, we support norm-conserving and ultrasoft pseudopotentials.
49+
For norm-conserving pseudopotentials, we support four different formats of the pseudopotential files: UPF, UPF2, VWR, and BLPS.
50+
For ultrasoft pseudopotentials, currently we support only one format of the pseudopotential files: UPF2.
51+
52+
For more information, check the `ATOMIC_SPECIES` section in the specification of the [STRU file](./input_files/stru.md).
4953

5054
Here we list some common sources of the pseudopotential files:
5155

examples/ultrasoft/README

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
/*******************************************************************************/
2+
/
3+
/ These are the examples of ABACUS program.
4+
/
5+
/*******************************************************************************/
6+
7+
ABACUS supports density functional theory calculations using ultrasoft pseudopotentials
8+
9+
First one should prepare corresponding ultrasoft pseudopotentials and other input files.
10+
11+
`ecutrho` should be no less than 4 times of `ecutwfc`. (`ecutrho` = 8 to 12 times `ecutwfc`, typically)
12+
13+
```
14+
INPUT_PARAMETERS
15+
ecutwfc 40
16+
ecutrho 240
17+
```
18+
19+
Detailed explaination of these keywords can be found [here](https://github.com/deepmodeling/abacus-develop/blob/develop/docs/input-main.md#plane-wave-related-variables).
20+
21+

examples/ultrasoft/bcc_Fe/INPUT

Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,31 @@
1+
INPUT_PARAMETERS
2+
#Parameters (1.General)
3+
calculation scf
4+
nbands 10
5+
symmetry 0
6+
latname bcc
7+
nspin 2
8+
pseudo_dir ../../../tests/PP_ORB
9+
10+
#Parameters (2.Iteration)
11+
ecutwfc 40
12+
ecutrho 240
13+
scf_thr 1e-7
14+
scf_nmax 100
15+
16+
#Parameters (3.Basis)
17+
basis_type pw
18+
19+
#Parameters (4.Smearing)
20+
smearing_method gaussian
21+
smearing_sigma 0.02
22+
23+
#parameters (5.Mixing)
24+
mixing_type pulay
25+
mixing_beta 0.4
26+
27+
pseudo_mesh 1
28+
pseudo_rcut 10
29+
30+
cal_force 1
31+
cal_stress 1

examples/ultrasoft/bcc_Fe/KPT

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
K_POINTS
2+
0
3+
Gamma
4+
8 8 8 0 0 0

examples/ultrasoft/bcc_Fe/STRU

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
ATOMIC_SPECIES
2+
Fe 55.845 Fe.pbe-nd-rrkjus.UPF
3+
4+
LATTICE_CONSTANT
5+
5.6
6+
7+
ATOMIC_POSITIONS
8+
Direct
9+
10+
Fe
11+
8
12+
1
13+
0 0 0
14+

examples/ultrasoft/bcc_Fe/run.sh

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
#!/bin/bash
2+
3+
ABACUS_PATH=$(awk -F "=" '$1=="ABACUS_PATH"{print $2}' ../../SETENV)
4+
ABACUS_NPROCS=$(awk -F "=" '$1=="ABACUS_NPROCS"{print $2}' ../../SETENV)
5+
ABACUS_THREADS=$(awk -F "=" '$1=="ABACUS_THREADS"{print $2}' ../../SETENV)
6+
7+
OMP_NUM_THREADS=${ABACUS_THREADS} mpirun -np ${ABACUS_NPROCS} ${ABACUS_PATH} | tee scf.output
8+
9+
if [[ ! -f scf.output ]] ||
10+
[[ ! -f OUT.ABACUS/running_scf.log ]] ||
11+
[[ ! ( "$(tail -1 OUT.ABACUS/running_scf.log)" == " Total Time :"* ) ]]
12+
then
13+
echo "job is failed!"
14+
exit 1
15+
else
16+
echo "job is successed!"
17+
exit 0
18+
fi

examples/ultrasoft/runall.sh

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
#!/bin/bash
2+
3+
for ii in *
4+
do
5+
if [ -d $ii ];then
6+
cd ${ii}
7+
echo "RUN: ${ii}"
8+
bash run.sh
9+
cd ..
10+
fi
11+
done

source/Makefile.Objects

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -340,6 +340,7 @@ OBJS_PSI_INITIALIZER=psi_initializer.o\
340340
OBJS_PW=fft.o\
341341
pw_basis.o\
342342
pw_basis_k.o\
343+
pw_basis_sup.o\
343344
pw_distributeg.o\
344345
pw_distributeg_method1.o\
345346
pw_distributeg_method2.o\
@@ -507,6 +508,7 @@ OBJS_SRCPW=H_Ewald_pw.o\
507508
charge_mixing.o\
508509
fp_energy.o\
509510
forces.o\
511+
forces_us.o\
510512
force_op.o\
511513
stress_op.o\
512514
wf_op.o\
@@ -532,6 +534,7 @@ OBJS_SRCPW=H_Ewald_pw.o\
532534
stress_func_kin.o\
533535
stress_func_loc.o\
534536
stress_func_nl.o\
537+
stress_func_us.o\
535538
stress_pw.o\
536539
of_stress_pw.o\
537540
symmetry_rho.o\

source/module_base/blas_connector.h

Lines changed: 19 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -54,10 +54,26 @@ extern "C"
5454
const double *beta, double *y, const int *incy);
5555

5656
// A := alpha x * y.T + A
57-
void dger_(int *m, int *n, double *alpha, double *x, int *incx, double *y, int *incy, double *a, int *lda);
58-
void zgerc_(int *m, int *n, std::complex<double> *alpha,std::complex<double> *x, int *incx, std::complex<double> *y, int *incy,std::complex<double> *a, int *lda);
57+
void dger_(const int* m,
58+
const int* n,
59+
const double* alpha,
60+
const double* x,
61+
const int* incx,
62+
const double* y,
63+
const int* incy,
64+
double* a,
65+
const int* lda);
66+
void zgerc_(const int* m,
67+
const int* n,
68+
const std::complex<double>* alpha,
69+
const std::complex<double>* x,
70+
const int* incx,
71+
const std::complex<double>* y,
72+
const int* incy,
73+
std::complex<double>* a,
74+
const int* lda);
5975

60-
// level 3: matrix-matrix operations, O(n^2) data and O(n^3) work.
76+
// level 3: matrix-matrix operations, O(n^2) data and O(n^3) work.
6177

6278
// Peize Lin add ?gemm 2017-10-27, to compute C = a * A.? * B.? + b * C
6379
// A is general

0 commit comments

Comments
 (0)