diff --git a/source/module_io/input_conv.cpp b/source/module_io/input_conv.cpp index 5b807620c8..ebcf40a6c6 100644 --- a/source/module_io/input_conv.cpp +++ b/source/module_io/input_conv.cpp @@ -377,7 +377,7 @@ void Input_Conv::Convert() } else if (dft_functional_lower == "hse") { GlobalC::exx_info.info_global.cal_exx = true; GlobalC::exx_info.info_global.ccp_type - = Conv_Coulomb_Pot_K::Ccp_Type::Hse; + = Conv_Coulomb_Pot_K::Ccp_Type::Erfc; } else if (dft_functional_lower == "opt_orb") { GlobalC::exx_info.info_global.cal_exx = false; Exx_Abfs::Jle::generate_matrix = true; @@ -391,12 +391,12 @@ void Input_Conv::Convert() else if ( dft_functional_lower == "wp22" ) { GlobalC::exx_info.info_global.cal_exx = true; - GlobalC::exx_info.info_global.ccp_type = Conv_Coulomb_Pot_K::Ccp_Type::erf; // use the error function erf(w|r-r'|), exx just has the long-range part + GlobalC::exx_info.info_global.ccp_type = Conv_Coulomb_Pot_K::Ccp_Type::Erf; // use the error function erf(w|r-r'|), exx just has the long-range part } else if ( dft_functional_lower == "cwp22" ) { GlobalC::exx_info.info_global.cal_exx = true; - GlobalC::exx_info.info_global.ccp_type = Conv_Coulomb_Pot_K::Ccp_Type::Hse; // use the erfc(w|r-r'|), exx just has the short-range part + GlobalC::exx_info.info_global.ccp_type = Conv_Coulomb_Pot_K::Ccp_Type::Erfc; // use the erfc(w|r-r'|), exx just has the short-range part } else { GlobalC::exx_info.info_global.cal_exx = false; diff --git a/source/module_lr/esolver_lrtd_lcao.cpp b/source/module_lr/esolver_lrtd_lcao.cpp index 46697710ea..0356b4e78a 100644 --- a/source/module_lr/esolver_lrtd_lcao.cpp +++ b/source/module_lr/esolver_lrtd_lcao.cpp @@ -226,7 +226,7 @@ LR::ESolver_LR::ESolver_LR(ModuleESolver::ESolver_KS_LCAO&& ks_sol { // set ccp_type according to the xc_kernel if (xc_kernel == "hf") { exx_info.info_global.ccp_type = Conv_Coulomb_Pot_K::Ccp_Type::Hf; } - else if (xc_kernel == "hse") { exx_info.info_global.ccp_type = Conv_Coulomb_Pot_K::Ccp_Type::Hse; } + else if (xc_kernel == "hse") { exx_info.info_global.ccp_type = Conv_Coulomb_Pot_K::Ccp_Type::Erfc; } this->exx_lri = std::make_shared>(exx_info.info_ri); this->exx_lri->init(MPI_COMM_WORLD, this->kv, ks_sol.orb_); this->exx_lri->cal_exx_ions(input.out_ri_cv); @@ -396,7 +396,7 @@ LR::ESolver_LR::ESolver_LR(const Input_para& inp, UnitCell& ucell) : inpu { // set ccp_type according to the xc_kernel if (xc_kernel == "hf") { exx_info.info_global.ccp_type = Conv_Coulomb_Pot_K::Ccp_Type::Hf; } - else if (xc_kernel == "hse") { exx_info.info_global.ccp_type = Conv_Coulomb_Pot_K::Ccp_Type::Hse; } + else if (xc_kernel == "hse") { exx_info.info_global.ccp_type = Conv_Coulomb_Pot_K::Ccp_Type::Erfc; } this->exx_lri = std::make_shared>(exx_info.info_ri); this->exx_lri->init(MPI_COMM_WORLD, this->kv, orb); this->exx_lri->cal_exx_ions(input.out_ri_cv); diff --git a/source/module_ri/Exx_LRI.hpp b/source/module_ri/Exx_LRI.hpp index 58a900fe11..b517044d1c 100644 --- a/source/module_ri/Exx_LRI.hpp +++ b/source/module_ri/Exx_LRI.hpp @@ -79,7 +79,7 @@ void Exx_LRI::init(const MPI_Comm &mpi_comm_in, const K_Vectors &kv_in, c const double hf_Rcut = std::pow(0.75 * this->p_kv->get_nkstot_full()/nspin0 * GlobalC::ucell.omega / (ModuleBase::PI), 1.0/3.0); return {{"hf_Rcut", hf_Rcut}}; } - case Conv_Coulomb_Pot_K::Ccp_Type::Hse: + case Conv_Coulomb_Pot_K::Ccp_Type::Erfc: return {{"hse_omega", this->info.hse_omega}}; default: throw std::domain_error(std::string(__FILE__)+" line "+std::to_string(__LINE__)); break; diff --git a/source/module_ri/conv_coulomb_pot_k.cpp b/source/module_ri/conv_coulomb_pot_k.cpp index 6394f9148d..f8e349574b 100644 --- a/source/module_ri/conv_coulomb_pot_k.cpp +++ b/source/module_ri/conv_coulomb_pot_k.cpp @@ -11,9 +11,8 @@ namespace Conv_Coulomb_Pot_K const std::vector & psif) { std::vector psik2_ccp(psif.size()); - for( size_t ik=0; ik psik2_ccp(psif.size()); - for (size_t ik = 0; ik < psif.size(); ++ik) { - psik2_ccp[ik] = ModuleBase::FOUR_PI * psif[ik] * (1 - std::cos(k_radial[ik] * hf_Rcut)); -} + for (size_t ik = 0; ik < psif.size(); ++ik) + { psik2_ccp[ik] = ModuleBase::FOUR_PI * psif[ik] * (1 - std::cos(k_radial[ik] * hf_Rcut)); } return psik2_ccp; } - std::vector cal_psi_hse( + std::vector cal_psi_erfc( const std::vector & psif, const std::vector & k_radial, const double hse_omega) { std::vector psik2_ccp(psif.size()); - for( size_t ik=0; ik psik2_ccp(psif.size()); - for( size_t ik=0; ik(orbs.getNr()*rmesh_times)) | 1; + std::vector rab(Nr); - for( size_t ir=0; ir r_radial(Nr); - for( size_t ir=0; ir=0; --ir) { - if(std::abs(orbs.getPsi(ir))>=psi_threshold) { - return static_cast(ir)/orbs.getNr(); -} + if(std::abs(orbs.getPsi(ir))>=psi_threshold) + { return static_cast(ir)/orbs.getNr(); } } return 0.0; } diff --git a/source/module_ri/conv_coulomb_pot_k.h b/source/module_ri/conv_coulomb_pot_k.h index 269691606c..02f43e921d 100644 --- a/source/module_ri/conv_coulomb_pot_k.h +++ b/source/module_ri/conv_coulomb_pot_k.h @@ -10,8 +10,8 @@ namespace Conv_Coulomb_Pot_K enum class Ccp_Type{ // parameter: Ccp, // Hf, // "hf_Rcut" - Hse, // "hse_omega" - erf}; // "hse_omega" + Erfc, // "hse_omega" + Erf}; // "hse_omega", "hf_Rcut" template T cal_orbs_ccp( const T &orbs, diff --git a/source/module_ri/exx_lip.hpp b/source/module_ri/exx_lip.hpp index 94689f5167..3703da9dde 100644 --- a/source/module_ri/exx_lip.hpp +++ b/source/module_ri/exx_lip.hpp @@ -334,13 +334,17 @@ void Exx_Lip::qkg2_exp(const int ik, const int iq) this->sum2_factor += this->recip_qkg2[ig] * std::exp(-info.lambda * qkg2); this->recip_qkg2[ig] = sqrt(this->recip_qkg2[ig]); } - else if (Conv_Coulomb_Pot_K::Ccp_Type::Hse == info.ccp_type) + else if (Conv_Coulomb_Pot_K::Ccp_Type::Erfc == info.ccp_type) { if (std::abs(qkg2) < 1e-10) { this->recip_qkg2[ig] = 1.0 / (2 * info.hse_omega); } else { this->recip_qkg2[ig] = sqrt((1 - std::exp(-qkg2 / (4 * info.hse_omega * info.hse_omega))) / qkg2); } } + else + { + throw( std::string(__FILE__) + " line " + std::to_string(__LINE__) ); + } } ModuleBase::timer::tick("Exx_Lip", "qkg2_exp"); }