diff --git a/source/module_cell/klist.cpp b/source/module_cell/klist.cpp index 3f6e89ac73..1c42184d7e 100644 --- a/source/module_cell/klist.cpp +++ b/source/module_cell/klist.cpp @@ -483,7 +483,7 @@ bool K_Vectors::read_kpoints(const std::string &fn) } } - this->nks = this->nkstot; + this->nkstot_full = this->nks = this->nkstot; ModuleBase::GlobalFunc::OUT(GlobalV::ofs_running,"nkstot",nkstot); return 1; @@ -546,7 +546,7 @@ void K_Vectors::update_use_ibz( void ) ModuleBase::TITLE("K_Vectors","update_use_ibz"); assert( nkstot_ibz > 0 ); - // update nkstot + // update nkstot this->nkstot = this->nkstot_ibz; ModuleBase::GlobalFunc::OUT(GlobalV::ofs_running,"nkstot now",nkstot); @@ -1035,6 +1035,8 @@ void K_Vectors::mpi_k(void) Parallel_Common::bcast_int(nkstot); + Parallel_Common::bcast_int(nkstot_full); + Parallel_Common::bcast_int(nmp, 3); Parallel_Common::bcast_double(koffset, 3); diff --git a/source/module_cell/klist.h b/source/module_cell/klist.h index bf9a5abbea..cd37f0529f 100644 --- a/source/module_cell/klist.h +++ b/source/module_cell/klist.h @@ -23,8 +23,9 @@ class K_Vectors std::vector ibz2bz; // mohan added 2009-05-18 int nks; // number of k points in this pool(processor, up+dw) - int nkstot; // total number of k points - int nkstot_ibz; + int nkstot; /// total number of k points, equal to nkstot_ibz after reducing k points + int nkstot_ibz; /// number of k points in IBZ + int nkstot_full; /// number of k points in full k mesh int nmp[3]; // Number of Monhorst-Pack diff --git a/source/module_io/input_conv.cpp b/source/module_io/input_conv.cpp index f4745461dc..a7d62b5115 100644 --- a/source/module_io/input_conv.cpp +++ b/source/module_io/input_conv.cpp @@ -570,9 +570,9 @@ void Input_Conv::Convert(void) Exx_Abfs::Jle::Ecut_exx = INPUT.exx_opt_orb_ecut; Exx_Abfs::Jle::tolerence = INPUT.exx_opt_orb_tolerence; - // EXX does not support any symmetry analyse, force symmetry setting to -1 - if (INPUT.calculation != "nscf") - ModuleSymmetry::Symmetry::symm_flag = -1; + // EXX does not support symmetry=1 + if (INPUT.calculation != "nscf" && INPUT.symmetry == "1") + ModuleSymmetry::Symmetry::symm_flag = 0; } #endif // __LCAO #endif // __EXX diff --git a/source/module_ri/Exx_LRI.hpp b/source/module_ri/Exx_LRI.hpp index 05fd00ffe6..297dae100f 100644 --- a/source/module_ri/Exx_LRI.hpp +++ b/source/module_ri/Exx_LRI.hpp @@ -78,7 +78,7 @@ void Exx_LRI::init(const MPI_Comm &mpi_comm_in, const K_Vectors &kv_in) throw std::domain_error(std::string(__FILE__)+" line "+std::to_string(__LINE__)); break; } }; - this->abfs_ccp = Conv_Coulomb_Pot_K::cal_orbs_ccp( this->abfs, info.ccp_type, get_ccp_parameter(), this->info.ccp_rmesh_times, p_kv->nks ); + this->abfs_ccp = Conv_Coulomb_Pot_K::cal_orbs_ccp(this->abfs, info.ccp_type, get_ccp_parameter(), this->info.ccp_rmesh_times, p_kv->nkstot_full); for( size_t T=0; T!=this->abfs.size(); ++T ) diff --git a/source/module_ri/RI_2D_Comm.hpp b/source/module_ri/RI_2D_Comm.hpp index 081f1fad9a..738260c790 100644 --- a/source/module_ri/RI_2D_Comm.hpp +++ b/source/module_ri/RI_2D_Comm.hpp @@ -18,6 +18,13 @@ #include #include +inline RI::Tensor tensor_conj(const RI::Tensor& t) { return t; } +inline RI::Tensor> tensor_conj(const RI::Tensor>& t) +{ + RI::Tensor> r(t.shape); + for (int i = 0;i < t.data->size();++i)(*r.data)[i] = std::conj((*t.data)[i]); + return r; +} template auto RI_2D_Comm::split_m2D_ktoR(const K_Vectors &kv, const std::vector &mks_2D, const Parallel_Orbitals &pv) -> std::vector>>> @@ -42,11 +49,16 @@ auto RI_2D_Comm::split_m2D_ktoR(const K_Vectors &kv, const std::vector mk_2D = RI_Util::Matrix_to_Tensor(*mks_2D[ik]); const Tdata_m frac = SPIN_multiple * RI::Global_Func::convert( std::exp( - - ModuleBase::TWO_PI*ModuleBase::IMAG_UNIT * (kv.kvec_c[ik] * (RI_Util::array3_to_Vector3(cell)*GlobalC::ucell.latvec)))); - if(mR_2D.empty()) - mR_2D = RI::Global_Func::convert(mk_2D * frac); - else - mR_2D = mR_2D + RI::Global_Func::convert(mk_2D * frac); + -ModuleBase::TWO_PI * ModuleBase::IMAG_UNIT * (kv.kvec_c[ik] * (RI_Util::array3_to_Vector3(cell) * GlobalC::ucell.latvec)))); + auto set_mR_2D = [&mR_2D](auto&& mk_frac) { + if (mR_2D.empty()) + mR_2D = RI::Global_Func::convert(mk_frac); + else + mR_2D = mR_2D + RI::Global_Func::convert(mk_frac); + }; + if (static_cast(std::round(SPIN_multiple * kv.wk[ik] * kv.nkstot_full)) == 2) + set_mR_2D(mk_2D * (frac * 0.5) + tensor_conj(mk_2D * (frac * 0.5))); + else set_mR_2D(mk_2D * frac); } for(int iwt0_2D=0; iwt0_2D!=mR_2D.shape[0]; ++iwt0_2D) @@ -122,7 +134,7 @@ void RI_2D_Comm::add_Hexx( if(GlobalV::GAMMA_ONLY_LOCAL) lm.set_HSgamma(iwt0, iwt1, RI::Global_Func::convert(H(iw0_b, iw1_b)) * RI::Global_Func::convert(frac), - lm.Hloc.data()); + lm.Hloc.data()); else lm.set_HSk(iwt0, iwt1, RI::Global_Func::convert>(H(iw0_b, iw1_b)) * frac, diff --git a/tests/integrate/281_NO_KP_HSE/INPUT b/tests/integrate/281_NO_KP_HSE/INPUT index f4d2a98f60..6ef86684dd 100644 --- a/tests/integrate/281_NO_KP_HSE/INPUT +++ b/tests/integrate/281_NO_KP_HSE/INPUT @@ -2,7 +2,7 @@ INPUT_PARAMETERS #Parameters (1.General) suffix autotest ntype 1 -symmetry -1 +symmetry 0 gamma_only 0 nspin 1 diff --git a/tests/integrate/283_NO_KP_HF/INPUT b/tests/integrate/283_NO_KP_HF/INPUT index 5d68095e47..b9a3432cc8 100644 --- a/tests/integrate/283_NO_KP_HF/INPUT +++ b/tests/integrate/283_NO_KP_HF/INPUT @@ -2,7 +2,7 @@ INPUT_PARAMETERS #Parameters (1.General) suffix autotest ntype 1 -symmetry -1 +symmetry 0 gamma_only 0 nspin 1 diff --git a/tests/integrate/284_NO_KP_PBE0/INPUT b/tests/integrate/284_NO_KP_PBE0/INPUT index a3faac71c0..a4c9daf26c 100644 --- a/tests/integrate/284_NO_KP_PBE0/INPUT +++ b/tests/integrate/284_NO_KP_PBE0/INPUT @@ -2,7 +2,7 @@ INPUT_PARAMETERS #Parameters (1.General) suffix autotest ntype 1 -symmetry -1 +symmetry 0 gamma_only 0 nspin 1 diff --git a/tests/integrate/285_NO_KP_RE_HSE/INPUT b/tests/integrate/285_NO_KP_RE_HSE/INPUT index daa8e72c94..da713b6d69 100644 --- a/tests/integrate/285_NO_KP_RE_HSE/INPUT +++ b/tests/integrate/285_NO_KP_RE_HSE/INPUT @@ -2,7 +2,7 @@ INPUT_PARAMETERS #Parameters (1.General) suffix autotest ntype 1 -symmetry -1 +symmetry 0 gamma_only 0 nspin 1 diff --git a/tests/integrate/286_NO_KP_CR_HSE/INPUT b/tests/integrate/286_NO_KP_CR_HSE/INPUT index 608d62b8b6..0885c393c9 100644 --- a/tests/integrate/286_NO_KP_CR_HSE/INPUT +++ b/tests/integrate/286_NO_KP_CR_HSE/INPUT @@ -2,7 +2,7 @@ INPUT_PARAMETERS #Parameters (1.General) suffix autotest ntype 1 -symmetry -1 +symmetry 0 gamma_only 0 nspin 1 diff --git a/tests/integrate/381_NO_GO_S1_HSE/INPUT b/tests/integrate/381_NO_GO_S1_HSE/INPUT index f9b41e90c1..03fd12fddc 100644 --- a/tests/integrate/381_NO_GO_S1_HSE/INPUT +++ b/tests/integrate/381_NO_GO_S1_HSE/INPUT @@ -3,7 +3,7 @@ INPUT_PARAMETERS suffix autotest calculation scf ntype 2 -symmetry -1 +symmetry 0 nspin 1 pseudo_dir ../../PP_ORB orbital_dir ../../PP_ORB diff --git a/tests/integrate/382_NO_GO_S2_HSE/INPUT b/tests/integrate/382_NO_GO_S2_HSE/INPUT index 663dad3134..a0ef5a24f4 100644 --- a/tests/integrate/382_NO_GO_S2_HSE/INPUT +++ b/tests/integrate/382_NO_GO_S2_HSE/INPUT @@ -3,7 +3,7 @@ INPUT_PARAMETERS suffix autotest calculation scf ntype 2 -symmetry -1 +symmetry 0 nspin 2 pseudo_dir ../../PP_ORB orbital_dir ../../PP_ORB diff --git a/tests/integrate/383_NO_GO_SO_HSE/INPUT b/tests/integrate/383_NO_GO_SO_HSE/INPUT index 9b06fc9739..6cfc5cb3d0 100644 --- a/tests/integrate/383_NO_GO_SO_HSE/INPUT +++ b/tests/integrate/383_NO_GO_SO_HSE/INPUT @@ -3,7 +3,7 @@ INPUT_PARAMETERS suffix autotest calculation scf ntype 2 -symmetry -1 +symmetry 0 nspin 4 lspinorb 1 noncolin 1 diff --git a/tests/integrate/385_NO_GO_RE_S1_HSE/INPUT b/tests/integrate/385_NO_GO_RE_S1_HSE/INPUT index 004553fb7a..35b83abed6 100644 --- a/tests/integrate/385_NO_GO_RE_S1_HSE/INPUT +++ b/tests/integrate/385_NO_GO_RE_S1_HSE/INPUT @@ -3,7 +3,7 @@ INPUT_PARAMETERS suffix autotest calculation relax ntype 2 -symmetry -1 +symmetry 0 nspin 1 pseudo_dir ../../PP_ORB orbital_dir ../../PP_ORB diff --git a/tests/integrate/386_NO_GO_MD_S1_HSE/INPUT b/tests/integrate/386_NO_GO_MD_S1_HSE/INPUT index 82ce110b14..b2b7881cfc 100644 --- a/tests/integrate/386_NO_GO_MD_S1_HSE/INPUT +++ b/tests/integrate/386_NO_GO_MD_S1_HSE/INPUT @@ -3,7 +3,7 @@ INPUT_PARAMETERS suffix autotest calculation md ntype 2 -symmetry -1 +symmetry 0 nspin 1 pseudo_dir ../../PP_ORB orbital_dir ../../PP_ORB