Skip to content

Commit 6632e07

Browse files
authored
Merge branch 'develop' into convert_vtxc_v
2 parents 1e79ca3 + a5c35d9 commit 6632e07

File tree

225 files changed

+2662
-3148
lines changed

Some content is hidden

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

225 files changed

+2662
-3148
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

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: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -93,9 +93,9 @@ cmake -B build -DUSE_CUDA=1 -DCMAKE_CUDA_COMPILER=${path to cuda toolkit}/bin/nv
9393

9494
## Build math library from source
9595

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.
96+
> Note: We recommend using the latest available compiler sets, since they offer faster implementations of math functions.
9797
98-
To build math functions from source code, instead of using c++ standard implementation, define `USE_ABACUS_LIBM` flag.
98+
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`.
9999

100100
Currently supported math functions:
101101
`sin`, `cos`, `sincos`, `exp`, `cexp`

examples/lr-tddft/lcao_Si2/INPUT

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -37,4 +37,3 @@ out_alllog 1
3737

3838
nvirt 19
3939
abs_wavelen_range 100 175
40-
#diago_full_acc 1

python/pyabacus/src/py_diago_dav_subspace.hpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -106,7 +106,7 @@ class PyDiagoDavSubspace
106106
double tol,
107107
int max_iter,
108108
bool need_subspace,
109-
std::vector<bool> is_occupied,
109+
std::vector<double> diag_ethr,
110110
bool scf_type,
111111
hsolver::diag_comm_info comm_info
112112
) {
@@ -141,7 +141,7 @@ class PyDiagoDavSubspace
141141
comm_info
142142
);
143143

144-
return obj->diag(hpsi_func, psi, nbasis, eigenvalue, is_occupied, scf_type);
144+
return obj->diag(hpsi_func, psi, nbasis, eigenvalue, diag_ethr.data(), scf_type);
145145
}
146146

147147
private:

python/pyabacus/src/py_diago_david.hpp

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -132,7 +132,6 @@ class PyDiagoDavid
132132
const std::complex<double> *psi_in,
133133
std::complex<double> *spsi_out,
134134
const int nrow,
135-
const int npw,
136135
const int nbands
137136
) {
138137
syncmem_op()(this->ctx, this->ctx, spsi_out, psi_in, static_cast<size_t>(nbands * nrow));

python/pyabacus/src/py_hsolver.cpp

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -59,8 +59,8 @@ void bind_hsolver(py::module& m)
5959
The maximum number of iterations.
6060
need_subspace : bool
6161
Whether to use the subspace function.
62-
is_occupied : list[bool]
63-
A list of boolean values indicating whether the band is occupied,
62+
diag_ethr : list[float]
63+
A list of float values indicating the thresholds of each band for the diagonalization,
6464
meaning that the corresponding eigenvalue is to be calculated.
6565
scf_type : bool
6666
Whether to use the SCF type, which is used to determine the
@@ -76,7 +76,7 @@ void bind_hsolver(py::module& m)
7676
"tol"_a,
7777
"max_iter"_a,
7878
"need_subspace"_a,
79-
"is_occupied"_a,
79+
"diag_ethr"_a,
8080
"scf_type"_a,
8181
"comm_info"_a)
8282
.def("set_psi", &py_hsolver::PyDiagoDavSubspace::set_psi, R"pbdoc(

python/pyabacus/src/pyabacus/hsolver/_hsolver.py

Lines changed: 6 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ def dav_subspace(
2525
tol: float = 1e-2,
2626
max_iter: int = 1000,
2727
need_subspace: bool = False,
28-
is_occupied: Union[List[bool], None] = None,
28+
diag_ethr: Union[List[float], None] = None,
2929
scf_type: bool = False
3030
) -> Tuple[NDArray[np.float64], NDArray[np.complex128]]:
3131
""" A function to diagonalize a matrix using the Davidson-Subspace method.
@@ -52,10 +52,8 @@ def dav_subspace(
5252
The maximum number of iterations, by default 1000.
5353
need_subspace : bool, optional
5454
Whether to use subspace function, by default False.
55-
is_occupied : List[bool] | None, optional
56-
The list of occupied bands, by default None. This indicates how many eigenvalues
57-
need to be calculated, starting from the smallest eigenvalue. Only the energy levels
58-
occupied by electrons (occupied) need to be calculated.
55+
diag_ethr : List[float] | None, optional
56+
The list of thresholds of bands, by default None.
5957
scf_type : bool, optional
6058
Indicates whether the calculation is a self-consistent field (SCF) calculation.
6159
If True, the initial precision of eigenvalue calculation can be coarse.
@@ -72,8 +70,8 @@ def dav_subspace(
7270
if not callable(mvv_op):
7371
raise TypeError("mvv_op must be a callable object.")
7472

75-
if is_occupied is None:
76-
is_occupied = [True] * num_eigs
73+
if diag_ethr is None:
74+
diag_ethr = [tol] * num_eigs
7775

7876
if init_v.ndim != 1 or init_v.dtype != np.complex128:
7977
init_v = init_v.flatten().astype(np.complex128, order='C')
@@ -93,7 +91,7 @@ def dav_subspace(
9391
tol,
9492
max_iter,
9593
need_subspace,
96-
is_occupied,
94+
diag_ethr,
9795
scf_type,
9896
comm_info
9997
)
@@ -113,7 +111,6 @@ def davidson(
113111
tol: float = 1e-2,
114112
max_iter: int = 1000,
115113
use_paw: bool = False,
116-
# is_occupied: Union[List[bool], None] = None,
117114
# scf_type: bool = False
118115
) -> Tuple[NDArray[np.float64], NDArray[np.complex128]]:
119116
""" A function to diagonalize a matrix using the Davidson-Subspace method.

source/Makefile.Objects

Lines changed: 3 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -568,12 +568,9 @@ OBJS_LCAO=evolve_elec.o\
568568
FORCE_STRESS.o\
569569
FORCE_gamma.o\
570570
FORCE_k.o\
571-
fvl_dphi_gamma.o\
572-
fvl_dphi_k.o\
573-
fedm_gamma.o\
574-
fedm_k.o\
575-
ftvnl_dphi_gamma.o\
576-
ftvnl_dphi_k.o\
571+
stress_tools.o\
572+
edm.o\
573+
pulay_force_stress_center2.o\
577574
fvnl_dbeta_gamma.o\
578575
fvnl_dbeta_k.o\
579576
grid_init.o\

source/driver.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,7 @@ void Driver::init()
4141

4242
// (3) output information
4343
time_t time_finish = std::time(nullptr);
44-
Print_Info::print_time(time_start, time_finish);
44+
ModuleIO::print_time(time_start, time_finish);
4545

4646
// (4) close all of the running logs
4747
ModuleBase::Global_File::close_all_log(GlobalV::MY_RANK, PARAM.inp.out_alllog,PARAM.inp.calculation);

0 commit comments

Comments
 (0)