forked from abacusmodeling/abacus-develop
-
Notifications
You must be signed in to change notification settings - Fork 153
Labels
DiagoIssues related to diagonalizaiton methodsIssues related to diagonalizaiton methodsRefactorRefactor ABACUS codesRefactor ABACUS codes
Description
Describe the Code Quality Issue
All KS solvers (cg,dav,etc.) need hpsi, spsi, preconditioning, etc.
Now each makes a copy of hpsi_func and spsi_func, which can be collected into one.
// source_hsolver/hsolver_pw.cpp
// hpsi_func (X, HX, ld, nvec) -> HX = H(X), X and HX blockvectors of size ld x nvec
auto hpsi_func = [hm, cur_nbasis](T* psi_in, T* hpsi_out, const int ld_psi, const int nvec) {
// Convert "pointer data stucture" to a psi::Psi object
auto psi_iter_wrapper = psi::Psi<T, Device>(psi_in, 1, nvec, ld_psi, cur_nbasis);
psi::Range bands_range(true, 0, 0, nvec - 1);
using hpsi_info = typename hamilt::Operator<T, Device>::hpsi_info;
hpsi_info info(&psi_iter_wrapper, bands_range, hpsi_out);
hm->ops->hPsi(info);
};
bool scf = this->calculation_type == "nscf" ? false : true;
auto spsi_func = [hm](T* psi_in, T* spsi_out, const int ld_psi, const int nvec) {
hm->sPsi(psi_in, spsi_out, ld_psi, ld_psi, nvec);
};Additional Context
No response
Task list for Issue attackers (only for developers)
- Identify the specific code file or section with the code quality issue.
- Investigate the issue and determine the root cause.
- Research best practices and potential solutions for the identified issue.
- Refactor the code to improve code quality, following the suggested solution.
- Ensure the refactored code adheres to the project's coding standards.
- Test the refactored code to ensure it functions as expected.
- Update any relevant documentation, if necessary.
- Submit a pull request with the refactored code and a description of the changes made.
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
DiagoIssues related to diagonalizaiton methodsIssues related to diagonalizaiton methodsRefactorRefactor ABACUS codesRefactor ABACUS codes