Skip to content

Commit bcf492f

Browse files
committed
Change code to fit new bpcg init interface
1 parent d7c66b1 commit bcf492f

File tree

2 files changed

+4
-2
lines changed

2 files changed

+4
-2
lines changed

source/module_hsolver/hsolver_pw.cpp

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -483,6 +483,7 @@ void HSolverPW<T, Device>::hamiltSolvePsiK(hamilt::Hamilt<T, Device>* hm,
483483
{
484484
const int nband = psi.get_nbands();
485485
const int nbasis = psi.get_nbasis();
486+
const int ndim = psi.get_current_ngk();
486487
// hpsi_func (X, HX, ld, nvec) -> HX = H(X), X and HX blockvectors of size ld x nvec
487488
auto hpsi_func = [hm, cur_nbasis](T* psi_in, T* hpsi_out, const int ld_psi, const int nvec) {
488489
ModuleBase::timer::tick("DavSubspace", "hpsi_func");
@@ -499,7 +500,7 @@ void HSolverPW<T, Device>::hamiltSolvePsiK(hamilt::Hamilt<T, Device>* hm,
499500
ModuleBase::timer::tick("DavSubspace", "hpsi_func");
500501
};
501502
DiagoBPCG<T, Device> bpcg(pre_condition.data());
502-
bpcg.init_iter(nband, nbasis);
503+
bpcg.init_iter(nband, nbasis, ndim);
503504
bpcg.diag(hpsi_func, psi.get_pointer(), eigenvalue, this->ethr_band);
504505
}
505506
else if (this->method == "dav_subspace")

source/module_hsolver/test/diago_bpcg_test.cpp

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -151,7 +151,8 @@ class DiagoBPCGPrepare
151151
zero_,
152152
hpsi_out, ld_psi);
153153
};
154-
bpcg.init_iter(nband, npw);
154+
const int ndim = psi_local.get_current_ngk();
155+
bpcg.init_iter(nband, npw, ndim);
155156
std::vector<double> ethr_band(nband, 1e-5);
156157
bpcg.diag(hpsi_func, psi_local.get_pointer(), en, ethr_band);
157158
bpcg.diag(hpsi_func, psi_local.get_pointer(), en, ethr_band);

0 commit comments

Comments
 (0)