Describe the Code Quality Issue
In hsolver module, the encapsulated interfaces of hpsi_func and spsi_func are different, which is confusing when passing in/out parameters.
auto hpsi_func = [hm, ngk_pointer](T* hpsi_out,
T* psi_in,
const int nband_in,
const int nbasis_in,
const int band_index1,
const int band_index2) {
ModuleBase::timer::tick("David", "hpsi_func");
// Convert "pointer data stucture" to a psi::Psi object
auto psi_iter_wrapper = psi::Psi<T, Device>(psi_in, 1, nband_in, nbasis_in, ngk_pointer);
psi::Range bands_range(true, 0, band_index1, band_index2);
using hpsi_info = typename hamilt::Operator<T, Device>::hpsi_info;
hpsi_info info(&psi_iter_wrapper, bands_range, hpsi_out);
hm->ops->hPsi(info);
ModuleBase::timer::tick("David", "hpsi_func");
};
/// wrap spsi into lambda function, Matrix \times blockvector
/// spsi(X, SX, nrow, npw, nbands)
auto spsi_func = [hm](const T* psi_in, T* spsi_out,
const int nrow, // dimension of spsi: nbands * nrow
const int npw, // number of plane waves
const int nbands // number of bands
){
ModuleBase::timer::tick("David", "spsi_func");
// sPsi determines S=I or not by GlobalV::use_uspp inside
hm->sPsi(psi_in, spsi_out, nrow, npw, nbands);
ModuleBase::timer::tick("David", "spsi_func");
};
The in/out parameters should be in the same order.
Additional Context
No response
Task list for Issue attackers (only for developers)
Describe the Code Quality Issue
In hsolver module, the encapsulated interfaces of
hpsi_funcandspsi_funcare different, which is confusing when passing in/out parameters.The in/out parameters should be in the same order.
Additional Context
No response
Task list for Issue attackers (only for developers)