diff --git a/source/module_esolver/esolver_ks_lcao.cpp b/source/module_esolver/esolver_ks_lcao.cpp index c1893301f2..07d8936fb8 100644 --- a/source/module_esolver/esolver_ks_lcao.cpp +++ b/source/module_esolver/esolver_ks_lcao.cpp @@ -219,7 +219,7 @@ void ESolver_KS_LCAO::before_all_runners(const Input_para& inp, UnitCell // 10) initialize the HSolver if (this->phsol == nullptr) { - this->phsol = new hsolver::HSolverLCAO(&(this->pv), GlobalV::KS_SOLVER); + this->phsol = new hsolver::HSolver(); } // 11) inititlize the charge density diff --git a/source/module_esolver/esolver_ks_lcao_tddft.cpp b/source/module_esolver/esolver_ks_lcao_tddft.cpp index 37107c0440..3feb76bf9f 100644 --- a/source/module_esolver/esolver_ks_lcao_tddft.cpp +++ b/source/module_esolver/esolver_ks_lcao_tddft.cpp @@ -104,7 +104,7 @@ void ESolver_KS_LCAO_TDDFT::before_all_runners(const Input_para& inp, UnitCell& // 7) initialize Hsolver if (this->phsol == nullptr) { - this->phsol = new hsolver::HSolverLCAO>(&this->pv, GlobalV::KS_SOLVER); + this->phsol = new hsolver::HSolver>(); } // 8) initialize the charge density diff --git a/source/module_esolver/esolver_ks_lcaopw.cpp b/source/module_esolver/esolver_ks_lcaopw.cpp index 6452f72c57..d34ce8e607 100644 --- a/source/module_esolver/esolver_ks_lcaopw.cpp +++ b/source/module_esolver/esolver_ks_lcaopw.cpp @@ -67,15 +67,14 @@ namespace ModuleESolver template void ESolver_KS_LIP::allocate_hsolver() { - this->phsol = new hsolver::HSolverLIP(this->pw_wfc); + this->phsol = new hsolver::HSolver(); } template void ESolver_KS_LIP::deallocate_hsolver() { if (this->phsol != nullptr) { - std::cout << "test" << std::endl; - delete reinterpret_cast*>(this->phsol); + delete (this->phsol); this->phsol = nullptr; } } diff --git a/source/module_hsolver/hsolver.h b/source/module_hsolver/hsolver.h index 98e6dcd620..bdf282beed 100644 --- a/source/module_hsolver/hsolver.h +++ b/source/module_hsolver/hsolver.h @@ -23,33 +23,6 @@ class HSolver public: HSolver() {}; - // solve Hamiltonian to electronic density in ElecState - virtual void solve(hamilt::Hamilt* phm, - psi::Psi& ppsi, - elecstate::ElecState* pes, - const std::string method, - const bool skip_charge) - { - return; - } - - virtual void solve(hamilt::Hamilt* phm, - psi::Psi& ppsi, - elecstate::ElecState* pes, - ModulePW::PW_Basis_K* wfc_basis, - Stochastic_WF& stowf, - const int istep, - const int iter, - const std::string method, - const int scf_iter_in, - const bool need_subspace_in, - const int diag_iter_max_in, - const double pw_diag_thr_in, - const bool skip_charge) - { - return; - } - // set diagethr according to drho (for lcao and lcao-in-pw, we suppose the error is zero and we set diagethr to 0) virtual Real set_diagethr(Real diag_ethr_in, const int istep, const int iter, const Real drho) { diff --git a/source/module_hsolver/hsolver_lcao.h b/source/module_hsolver/hsolver_lcao.h index 3803d00612..d139e79abe 100644 --- a/source/module_hsolver/hsolver_lcao.h +++ b/source/module_hsolver/hsolver_lcao.h @@ -8,17 +8,19 @@ namespace hsolver { template -class HSolverLCAO : public HSolver +class HSolverLCAO { public: - HSolverLCAO(const Parallel_Orbitals* ParaV_in, std::string method_in) - : ParaV(ParaV_in), method(method_in) - {}; + HSolverLCAO(const Parallel_Orbitals* ParaV_in, std::string method_in) : ParaV(ParaV_in), method(method_in) {}; - void solve(hamilt::Hamilt* pHamilt, psi::Psi& psi, elecstate::ElecState* pes, const std::string method_in, const bool skip_charge) override; + void solve(hamilt::Hamilt* pHamilt, + psi::Psi& psi, + elecstate::ElecState* pes, + const std::string method_in, + const bool skip_charge); static std::vector out_mat_hs; // mohan add 2010-09-02 - static int out_mat_hsR; // LiuXh add 2019-07-16 + static int out_mat_hsR; // LiuXh add 2019-07-16 static int out_mat_t; static int out_mat_dh; @@ -29,7 +31,6 @@ class HSolverLCAO : public HSolver void parakSolve(hamilt::Hamilt* pHamilt, psi::Psi& psi, elecstate::ElecState* pes, int kpar); - bool is_first_scf = true; using Real = typename GetTypeReal::type; @@ -50,13 +51,13 @@ template int HSolverLCAO::out_mat_dh = 0; template -inline T my_conj(T value) +inline T my_conj(T value) { return value; } template <> -inline std::complex my_conj(std::complex value) +inline std::complex my_conj(std::complex value) { return std::conj(value); } diff --git a/source/module_hsolver/hsolver_lcaopw.h b/source/module_hsolver/hsolver_lcaopw.h index 971a7aaecb..a606721d67 100644 --- a/source/module_hsolver/hsolver_lcaopw.h +++ b/source/module_hsolver/hsolver_lcaopw.h @@ -8,7 +8,7 @@ namespace hsolver { // LCAO-in-PW does not support GPU now. template - class HSolverLIP : public HSolver + class HSolverLIP { private: // Note GetTypeReal::type will diff --git a/source/module_hsolver/hsolver_pw_sdft.h b/source/module_hsolver/hsolver_pw_sdft.h index 0f6cb52639..610805ed55 100644 --- a/source/module_hsolver/hsolver_pw_sdft.h +++ b/source/module_hsolver/hsolver_pw_sdft.h @@ -30,7 +30,7 @@ class HSolverPW_SDFT : public HSolverPW> const bool need_subspace_in, const int diag_iter_max_in, const double pw_diag_thr_in, - const bool skip_charge) override; + const bool skip_charge); virtual double set_diagethr(double diag_ethr_in, const int istep, const int iter, const double drho) override;