forked from abacusmodeling/abacus-develop
-
Notifications
You must be signed in to change notification settings - Fork 152
Closed
Description
Describe the Code Quality Issue
Recently, we made many modifications in charge_mixing.cpp to try various new mixing method, see #3138 . After heavy development, the code related with charge mixing is not elegant and easy-to-understand. It is a good time to re-design charge-mixing.cpp from a bird's eye view, and refactor charge-mixing.cpp.
What is the plan?
- Polish UnitTest for
Charge_Mixing, make sure the refactor is correct. Charge_Mixing::set_mixing
CurrentCharge_Mixing::set_mixingis called inESolver_KS<T, Device>::Init(). Now it do two main things:
- construct mixing object.
- allocate memory for
rho_mdataandnhat_mdata. - move
set_mixingafter set_xc_type(), and allocate tau_mdata inset_mixingas well. - should we spilt this function into
setandallocate? Maybe yes, split intoset_mixingandinitialize_mixing() - After this
set, all functions inCharge_Mixingshould use private variables. - I agree this setting function can be called several times to make sure it is possible to modify mixing parameter during calculations.
-
Interface
Charge_Mixingshould only offer three interfaces:
initialize_mixing(GlobalV)/mix_rho(Charge* chr)/mix_dmr(DensityMatrix* dm) -
move
get_drho()fromCharge_MixingtoCharge. -
Only keep one
Kerker_screen_recip/inner_product_recip -
keep old tau mixing method as
mixing_tau = 1, and make a new onemixing_tau = 2.
Step 1: set_mixing()
Step 2: init_mixing()
Step 3: refactor inner_product()
Step 4: refactor kerker function and polish UnitTests
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
No labels