Closed Qianruipku closed 5 months ago
Sorry but probably I don't think so. The initialization of a psi instance should be the event occurs in ESolver_KS_PW workflow (not ESolver_KS because it is the initialization of PW wavefunction), it is the reason why these two functions are there. Similarly, for lcao, the most suitable choice still would be in ESolver_KS_LCAO. The opinion above is based on the fact that the instantiation/allocation/assignment in ABACUS still be ridiculously separated into pieces and always hide their calls somewhere, and I clearly remember in function Init_GlobalC there is one quite funny thing: one must first call function to allocate psi, then call some functions to init other things which seem to be irrelevant at all, and at the end, assign values to psi. If this order is not strictly obeyed, there will be undefined behavior! Thus, if be consistent with your opinion, I think Init_GlobalC should also/first be removed.
So if for a fully good design, there are two more reasonable things to do:
Describe the Code Quality Issue
Esolver_KS_PW defined too much functions and they should be moved to other places.
Additional Context
No response
Task list for Issue attackers (only for developers)