Skip to content

Commit 2a2442d

Browse files
authored
Merge branch 'develop' into nep
2 parents e0d5242 + 4cfd8f5 commit 2a2442d

File tree

110 files changed

+6024
-2167
lines changed

Some content is hidden

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

110 files changed

+6024
-2167
lines changed

CMakeLists.txt

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -481,8 +481,12 @@ else()
481481
find_package(Lapack REQUIRED)
482482
include_directories(${FFTW3_INCLUDE_DIRS})
483483
list(APPEND math_libs FFTW3::FFTW3 LAPACK::LAPACK BLAS::BLAS)
484+
if(USE_DSP)
485+
target_link_libraries(${ABACUS_BIN_NAME} ${SCALAPACK_LIBRARY_DIR})
486+
else()
484487
find_package(ScaLAPACK REQUIRED)
485488
list(APPEND math_libs ScaLAPACK::ScaLAPACK)
489+
endif()
486490
if(USE_OPENMP)
487491
list(APPEND math_libs FFTW3::FFTW3_OMP)
488492
endif()

docs/advanced/input_files/input-main.md

Lines changed: 37 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -147,7 +147,6 @@
147147
- [out\_band](#out_band)
148148
- [out\_proj\_band](#out_proj_band)
149149
- [out\_stru](#out_stru)
150-
- [out\_bandgap](#out_bandgap)
151150
- [out\_level](#out_level)
152151
- [out\_alllog](#out_alllog)
153152
- [out\_mat\_hs](#out_mat_hs)
@@ -256,6 +255,9 @@
256255
- [of\_ml\_chi\_pnl](#of_ml_chi_pnl)
257256
- [of\_ml\_chi\_qnl](#of_ml_chi_qnl)
258257
- [of\_ml\_local\_test](#of_ml_local_test)
258+
- [TD-OFDFT: time dependent orbital free density functional theory](#tdofdft-time-dependent-orbital-free-density-functional-theory)
259+
- [of\_cd](#of_cd)
260+
- [of\_mcd\_alpha](#of_mcd_alpha)
259261
- [Electric Field and Dipole Correction](#electric-field-and-dipole-correction)
260262
- [efield\_flag](#efield_flag)
261263
- [dip\_cor\_flag](#dip_cor_flag)
@@ -528,6 +530,7 @@ These variables are used to control general system parameters.
528530
- **Description**: choose the energy solver.
529531
- ksdft: Kohn-Sham density functional theory
530532
- ofdft: orbital-free density functional theory
533+
- tdofdft: time-dependent orbital-free density functional theory
531534
- sdft: [stochastic density functional theory](#electronic-structure-sdft)
532535
- tddft: real-time time-dependent density functional theory (TDDFT)
533536
- lj: Leonard Jones potential
@@ -1074,7 +1077,20 @@ calculations.
10741077

10751078
- **Type**: String
10761079
- **Description**: In our package, the XC functional can either be set explicitly using the `dft_functional` keyword in `INPUT` file. If `dft_functional` is not specified, ABACUS will use the xc functional indicated in the pseudopotential file.
1077-
On the other hand, if dft_functional is specified, it will overwrite the functional from pseudopotentials and performs calculation with whichever functional the user prefers. We further offer two ways of supplying exchange-correlation functional. The first is using 'short-hand' names such as 'LDA', 'PBE', 'SCAN'. A complete list of 'short-hand' expressions can be found in [the source code](../../../source/source_hamilt/module_xc/xc_functional.cpp). The other way is only available when ***compiling with LIBXC***, and it allows for supplying exchange-correlation functionals as combinations of LIBXC keywords for functional components, joined by a plus sign, for example, dft_functional='LDA_X_1D_EXPONENTIAL+LDA_C_1D_CSC'. The list of LIBXC keywords can be found on its [website](https://libxc.gitlab.io/functionals/). In this way, **we support all the LDA,GGA and mGGA functionals provided by LIBXC**.
1080+
On the other hand, if dft_functional is specified, it will overwrite the functional from pseudopotentials and performs calculation with whichever functional the user prefers. We further offer two ways of supplying exchange-correlation functional. The first is using 'short-hand' names. A complete list of 'short-hand' expressions can be found in [the source code](../../../source/source_hamilt/module_xc/xc_functional.cpp). Supported density functionals are:
1081+
- LDA functionals
1082+
- LDA (equivalent with PZ and SLAPZNOGXNOGC), PWLDA
1083+
- GGA functionals
1084+
- PBE (equivalent with SLAPWPBXPBC), PBESOL, REVPBE, WC, BLYP, BP(referred to BP86), PW91, HCTH, OLYP, BLYP_LR
1085+
- meta-GGA functionals
1086+
- SCAN (require LIBXC)
1087+
- Hybrid functionals
1088+
- PBE0, HF
1089+
- If LIBXC is avaliale, additional short-hand names of hybrid functionals are supported: HSE(referred to HSE06), B3LYP, LC_PBE, LC_WPBE, LRC_WPBE, LRC_WPBEH, CAM_PBEH, WP22, CWP22, MULLER (equivalent with POWER)
1090+
- Hybrid meta-GGA functionals
1091+
- SCAN0 (require LIBXC)
1092+
1093+
The other way is only available when ***compiling with LIBXC***, and it allows for supplying exchange-correlation functionals as combinations of LIBXC keywords for functional components, joined by a plus sign, for example, dft_functional='LDA_X_1D_EXPONENTIAL+LDA_C_1D_CSC'. The list of LIBXC keywords can be found on its [website](https://libxc.gitlab.io/functionals/). In this way, **we support all the LDA,GGA and mGGA functionals provided by LIBXC**. Some popular functionals and their usage are: RPBE of [Hammer et al.](https://journals.aps.org/prb/abstract/10.1103/PhysRevB.59.7413), set `dft_functional` to 'GGA_X_RPBE+GGA_C_PBE', and [r$^{2}$SCAN](https://pubs.acs.org/doi/10.1021/acs.jpclett.0c02405), set `dft_functional` to 'MGGA_X_R2SCAN+MGGA_C_R2SCAN'.
10781094

10791095
Furthermore, the old INPUT parameter exx_hybrid_type for hybrid functionals has been absorbed into dft_functional. Options are `hf` (pure Hartree-Fock), `pbe0`(PBE0), `hse` (Note: in order to use HSE functional, LIBXC is required). Note also that HSE has been tested while PBE0 has NOT been fully tested yet, and the maximum CPU cores for running exx in parallel is $N(N+1)/2$, with N being the number of atoms.
10801096

@@ -1828,14 +1844,6 @@ These variables are used to control the output of properties.
18281844
- **Description**: Whether to output structure files per ionic step in geometry relaxation calculations into `OUT.${suffix}/STRU_ION${istep}_D`, where `${istep}` is the ionic step.
18291845
- **Default**: False
18301846

1831-
### out_bandgap
1832-
1833-
- **Type**: Boolean
1834-
- **Description**: Whether to print the bandgap per electronic iteration into `OUT.${suffix}/running_${calculation}.log`. The value of bandgaps can be obtained by searching for the keyword:
1835-
- [nupdown](#nupdown) > 0: `E_bandgap_up` and `E_bandgap_dw`
1836-
- [nupdown](#nupdown) = 0: `E_bandgap`
1837-
- **Default**: False
1838-
18391847
### out_level
18401848

18411849
- **Type**: String
@@ -2735,6 +2743,25 @@ Warning: this function is not robust enough for the current version. Please try
27352743

27362744
[back to top](#full-list-of-input-keywords)
27372745

2746+
## TDOFDFT: time dependent orbital free density functional theory
2747+
2748+
### of_cd
2749+
2750+
- **Type**: Boolean
2751+
- **Availability**: TDOFDFT
2752+
- **Type**: Boolean
2753+
- **Description**: Added the current dependent(CD) potential. (https://doi.org/10.1103/PhysRevB.98.144302)
2754+
- True: Added the CD potential.
2755+
- False: Not added the CD potential.
2756+
- **Default**: False
2757+
2758+
### of_mcd_alpha
2759+
2760+
- **Type**: Real
2761+
- **Availability**: TDOFDFT
2762+
- **Description**: The value of the parameter alpha in modified CD potential method. mCDPotenial=alpha*CDPotenial(proposed in paper PhysRevB.98.144302)
2763+
- **Default**: 1.0
2764+
27382765
## Electric field and dipole correction
27392766

27402767
These variables are relevant to electric field and dipole correction

docs/advanced/interface/TB2J.md

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -66,7 +66,6 @@ out_mul 1
6666
#Parameters (4.Relaxation)
6767
ks_solver genelpa
6868
scf_nmax 200
69-
out_bandgap 0
7069
7170
#Parameters (5.LCAO)
7271
basis_type lcao

examples/03_spin_polarized/ATOM/INPUT

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,6 @@ cal_force 1
4646
cal_stress 1
4747
out_stru 1 # print STRU in OUT
4848
out_chg 0 # print CHG or not
49-
out_bandgap 1 # if bandgap and mul out, chg will out
5049
out_mul 1 # print Mulliken charge and mag of atom in mulliken.txt
5150
# out_wfc_lcao 1
5251
# out_interval 1

examples/19_dftu/NiO/INPUT

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,6 @@ dft_plus_u 1
2828
orbital_corr 2 2 -1
2929
hubbard_u 5.0 5.0 0.0
3030

31-
out_bandgap 1
3231
out_chg 1
3332
out_mul 1
3433

examples/relax/lcao_output/INPUT

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -40,4 +40,3 @@ out_band 0
4040
out_stru 0
4141
out_app_flag 0
4242

43-
out_interval 1

examples/relax/pw_output/INPUT

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,6 @@ out_dos 1 # dos.txt g
3737
out_elf 1 # elf.txt
3838
out_band 1 # eig.txt
3939
out_stru 1 # g
40-
out_bandgap 1
4140

4241
out_app_flag 0
4342

source/Makefile.Objects

Lines changed: 15 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -253,6 +253,7 @@ OBJS_ELECSTAT=elecstate.o\
253253

254254
OBJS_ELECSTAT_LCAO=elecstate_lcao.o\
255255
elecstate_lcao_cal_tau.o\
256+
setup_dm.o\
256257
density_matrix.o\
257258
density_matrix_io.o\
258259
cal_dm_psi.o\
@@ -582,7 +583,9 @@ OBJS_IO=input_conv.o\
582583
write_libxc_r.o\
583584
output_log.o\
584585
output_mat_sparse.o\
585-
ctrl_output_lcao.o\
586+
ctrl_scf_lcao.o\
587+
ctrl_runner_lcao.o\
588+
ctrl_iter_lcao.o\
586589
ctrl_output_fp.o\
587590
ctrl_output_pw.o\
588591
para_json.o\
@@ -653,7 +656,7 @@ OBJS_LCAO=evolve_elec.o\
653656
FORCE_k.o\
654657
stress_tools.o\
655658
edm.o\
656-
pulay_force_stress_center2.o\
659+
pulay_fs_center2.o\
657660
grid_init.o\
658661
spar_dh.o\
659662
spar_exx.o\
@@ -667,6 +670,8 @@ OBJS_LCAO=evolve_elec.o\
667670
LCAO_allocate.o\
668671
LCAO_set_mat2d.o\
669672
LCAO_init_basis.o\
673+
setup_exx.o\
674+
setup_deepks.o\
670675
center2_orb.o\
671676
center2_orb-orb11.o\
672677
center2_orb-orb21.o\
@@ -675,13 +680,13 @@ OBJS_LCAO=evolve_elec.o\
675680
wavefunc_in_pw.o\
676681

677682
OBJS_MODULE_RI=conv_coulomb_pot_k.o\
678-
exx_abfs-abfs_index.o \
679-
exx_abfs-jle.o \
680-
exx_abfs-io.o \
681-
exx_abfs-construct_orbs.o \
682-
ABFs_Construct-PCA.o \
683-
exx_opt_orb.o \
684-
exx_opt_orb-print.o \
683+
exx_abfs-abfs_index.o\
684+
exx_abfs-jle.o\
685+
exx_abfs-io.o\
686+
exx_abfs-construct_orbs.o\
687+
ABFs_Construct-PCA.o\
688+
exx_opt_orb-print.o\
689+
exx_opt_orb.o\
685690
Matrix_Orbs11.o\
686691
Matrix_Orbs21.o\
687692
Matrix_Orbs22.o\
@@ -705,6 +710,7 @@ OBJS_SRCPW=H_Ewald_pw.o\
705710
VL_in_pw.o\
706711
VNL_in_pw.o\
707712
VNL_grad_pw.o\
713+
chgmixing.o\
708714
charge.o\
709715
charge_init.o\
710716
charge_mpi.o\

source/source_base/module_container/base/third_party/lapack.h

Lines changed: 102 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,18 @@
1+
/**
2+
* @file lapack.h
3+
* @brief This is a direct wrapper of some LAPACK routines.
4+
* \b Column-Major version.
5+
* Direct wrapping of standard LAPACK routines. (Column-Major, fortran style)
6+
*
7+
* @warning For Row-major version, please refer to \c source/source_base/module_external/lapack_connector.h.
8+
*
9+
* @note
10+
* Some slight modification are made to fit the C++ style for overloading purpose.
11+
* You can find some function with different parameter list than the original LAPACK routine.
12+
* And some of these parameters are not referred in the function body. They are included just to
13+
* ensure the same parameter list for overloaded functions with a uniform name.
14+
*/
15+
116
#ifndef BASE_THIRD_PARTY_LAPACK_H_
217
#define BASE_THIRD_PARTY_LAPACK_H_
318

@@ -10,6 +25,10 @@
1025
#include <base/third_party/hipsolver.h>
1126
#endif
1227

28+
/// This is a wrapper of some LAPACK routines.
29+
/// Direct wrapping of standard LAPACK routines. (column major, fortran style)
30+
/// with some slight modification to fit the C++ style for overloading purpose.
31+
1332
//Naming convention of lapack subroutines : ammxxx, where
1433
//"a" specifies the data type:
1534
// - d stands for double
@@ -46,6 +65,27 @@ void chegvd_(const int* itype, const char* jobz, const char* uplo, const int* n,
4665
std::complex<float>* work, int* lwork, float* rwork, int* lrwork,
4766
int* iwork, int* liwork, int* info);
4867

68+
void ssygvx_(const int* itype, const char* jobz, const char* range, const char* uplo,
69+
const int* n, float* A, const int* lda, float* B, const int* ldb,
70+
const float* vl, const float* vu, const int* il, const int* iu,
71+
const float* abstol, const int* m, float* w, float* Z, const int* ldz,
72+
float* work, const int* lwork, int* iwork, int* ifail, int* info);
73+
void dsygvx_(const int* itype, const char* jobz, const char* range, const char* uplo,
74+
const int* n, double* A, const int* lda, double* B, const int* ldb,
75+
const double* vl, const double* vu, const int* il, const int* iu,
76+
const double* abstol, const int* m, double* w, double* Z, const int* ldz,
77+
double* work, const int* lwork, int* iwork, int* ifail, int* info);
78+
void chegvx_(const int* itype, const char* jobz, const char* range, const char* uplo,
79+
const int* n, std::complex<float>* A, const int* lda, std::complex<float>* B, const int* ldb,
80+
const float* vl, const float* vu, const int* il, const int* iu,
81+
const float* abstol, const int* m, float* w, std::complex<float>* Z, const int* ldz,
82+
std::complex<float>* work, const int* lwork, float* rwork, int* iwork, int* ifail, int* info);
83+
void zhegvx_(const int* itype, const char* jobz, const char* range, const char* uplo,
84+
const int* n, std::complex<double>* A, const int* lda, std::complex<double>* B, const int* ldb,
85+
const double* vl, const double* vu, const int* il, const int* iu,
86+
const double* abstol, const int* m, double* w, std::complex<double>* Z, const int* ldz,
87+
std::complex<double>* work, const int* lwork, double* rwork, int* iwork, int* ifail, int* info);
88+
4989
void zhegvd_(const int* itype, const char* jobz, const char* uplo, const int* n,
5090
std::complex<double>* a, const int* lda,
5191
const std::complex<double>* b, const int* ldb, double* w,
@@ -190,6 +230,68 @@ void hegvd(const int itype, const char jobz, const char uplo, const int n,
190230
iwork, &liwork, &info);
191231
}
192232

233+
// Note
234+
// rwork is only needed for complex version
235+
// and we include rwork in the function parameter list
236+
// for simplicity of function overloading
237+
// and unification of function parameter list
238+
static inline
239+
void hegvx(const int itype, const char jobz, const char range, const char uplo, const int n,
240+
float* a, const int lda, float* b, const int ldb,
241+
const float vl, const float vu, const int il, const int iu, const float abstol,
242+
const int m, float* w, float* z, const int ldz,
243+
float* work, const int lwork, float* rwork, int* iwork, int* ifail, int& info)
244+
{
245+
ssygvx_(&itype, &jobz, &range, &uplo, &n,
246+
a, &lda, b, &ldb,
247+
&vl, &vu, &il, &iu,
248+
&abstol, &m, w, z, &ldz,
249+
work, &lwork, iwork, ifail, &info);
250+
}
251+
252+
static inline
253+
void hegvx(const int itype, const char jobz, const char range, const char uplo, const int n,
254+
double* a, const int lda, double* b, const int ldb,
255+
const double vl, const double vu, const int il, const int iu, const double abstol,
256+
const int m, double* w, double* z, const int ldz,
257+
double* work, const int lwork, double* rwork, int* iwork, int* ifail, int& info)
258+
{
259+
dsygvx_(&itype, &jobz, &range, &uplo, &n,
260+
a, &lda, b, &ldb,
261+
&vl, &vu, &il, &iu,
262+
&abstol, &m, w, z, &ldz,
263+
work, &lwork, iwork, ifail, &info);
264+
}
265+
266+
static inline
267+
void hegvx(const int itype, const char jobz, const char range, const char uplo, const int n,
268+
std::complex<float>* a, const int lda, std::complex<float>* b, const int ldb,
269+
const float vl, const float vu, const int il, const int iu, const float abstol,
270+
const int m, float* w, std::complex<float>* z, const int ldz,
271+
std::complex<float>* work, const int lwork, float* rwork, int* iwork, int* ifail, int& info)
272+
{
273+
chegvx_(&itype, &jobz, &range, &uplo, &n,
274+
a, &lda, b, &ldb,
275+
&vl, &vu, &il, &iu,
276+
&abstol, &m, w, z, &ldz,
277+
work, &lwork, rwork, iwork, ifail, &info);
278+
}
279+
280+
static inline
281+
void hegvx(const int itype, const char jobz, const char range, const char uplo, const int n,
282+
std::complex<double>* a, const int lda, std::complex<double>* b, const int ldb,
283+
const double vl, const double vu, const int il, const int iu, const double abstol,
284+
const int m, double* w, std::complex<double>* z, const int ldz,
285+
std::complex<double>* work, const int lwork, double* rwork, int* iwork, int* ifail, int& info)
286+
{
287+
zhegvx_(&itype, &jobz, &range, &uplo, &n,
288+
a, &lda, b, &ldb,
289+
&vl, &vu, &il, &iu,
290+
&abstol, &m, w, z, &ldz,
291+
work, &lwork, rwork, iwork, ifail, &info);
292+
}
293+
294+
193295
// wrap function of fortran lapack routine zheevx.
194296
static inline
195297
void heevx( const int itype, const char jobz, const char range, const char uplo, const int n,

0 commit comments

Comments
 (0)