From a6631a6addf00cdcb9941145c96c7b1eb54cc2f8 Mon Sep 17 00:00:00 2001 From: Mohan Chen Date: Sat, 30 Nov 2024 09:54:28 +0800 Subject: [PATCH] Update elecstate_pw.h (#5651) * Update elecstate_pw.h * [pre-commit.ci lite] apply automatic fixes --------- Co-authored-by: pre-commit-ci-lite[bot] <117423508+pre-commit-ci-lite[bot]@users.noreply.github.com> --- source/module_elecstate/elecstate_pw.h | 50 ++++++++++++++++---------- 1 file changed, 32 insertions(+), 18 deletions(-) diff --git a/source/module_elecstate/elecstate_pw.h b/source/module_elecstate/elecstate_pw.h index 408dd76a96..d879d872ac 100644 --- a/source/module_elecstate/elecstate_pw.h +++ b/source/module_elecstate/elecstate_pw.h @@ -17,6 +17,7 @@ class ElecStatePW : public ElecState { private: using Real = typename GetTypeReal::type; + public: ElecStatePW(ModulePW::PW_Basis_K* wfc_basis_in, Charge* chg_in, @@ -26,46 +27,59 @@ class ElecStatePW : public ElecState ModulePW::PW_Basis* rhodpw_in, ModulePW::PW_Basis* rhopw_in, ModulePW::PW_Basis_Big* bigpw_in); - // void init(Charge* chg_in):charge(chg_in){} override; ~ElecStatePW(); - // interface for HSolver to calculate rho from Psi + + //! interface for HSolver to calculate rho from Psi virtual void psiToRho(const psi::Psi& psi); - // return current electronic density rho, as a input for constructing Hamiltonian - // const double* getRho(int spin) const override; - virtual void cal_tau(const psi::Psi& psi); - // update charge density for next scf step - // void getNewRho() override; + virtual void cal_tau(const psi::Psi& psi); Real* becsum = nullptr; - // init rho_data and kin_r_data + + //! init rho_data and kin_r_data void init_rho_data(); - Real ** rho = nullptr, ** kin_r = nullptr; //[Device] [spin][nrxx] rho and kin_r + Real** rho = nullptr; + Real** kin_r = nullptr; //[Device] [spin][nrxx] rho and kin_r protected: + ModulePW::PW_Basis* rhopw_smooth = nullptr; + ModulePW::PW_Basis_K* basis = nullptr; + UnitCell* ucell = nullptr; + const pseudopot_cell_vnl* ppcell = nullptr; - // calculate electronic charge density on grid points or density matrix in real space - // the consequence charge density rho saved into rho_out, preparing for charge mixing. + //! calculate electronic charge density on grid points or density matrix in real space + //! the consequence charge density rho saved into rho_out, preparing for charge mixing. void updateRhoK(const psi::Psi& psi); // override; - // sum over all pools for rho and ebands + + //! sum over all pools for rho and ebands void parallelK(); - // calcualte rho for each k + + //! calcualte rho for each k void rhoBandK(const psi::Psi& psi); - // add to the charge density in reciprocal space the part which is due to the US augmentation. + + //! add to the charge density in reciprocal space the part which is due to the US augmentation. void add_usrho(const psi::Psi& psi); - // \sum_lm Q_lm(r) \sum_i w_i + + //! Non-local pseudopotentials + //! \sum_lm Q_lm(r) \sum_i w_i void addusdens_g(const Real* becsum, T* rhog); Device * ctx = {}; + bool init_rho = false; + mutable T* vkb = nullptr; - Real * rho_data = nullptr, * kin_r_data = nullptr; - T * wfcr = nullptr, * wfcr_another_spin = nullptr; + + Real* rho_data = nullptr; + Real* kin_r_data = nullptr; + T* wfcr = nullptr; + T* wfcr_another_spin = nullptr; + private: using meta_op = hamilt::meta_pw_op; using elecstate_pw_op = elecstate::elecstate_pw_op; @@ -85,4 +99,4 @@ class ElecStatePW : public ElecState } // namespace elecstate -#endif \ No newline at end of file +#endif