diff --git a/source/source_pw/module_pwdft/operator_pw/op_exx_pw.cpp b/source/source_pw/module_pwdft/operator_pw/op_exx_pw.cpp index eb41263376..e4e6f9167d 100644 --- a/source/source_pw/module_pwdft/operator_pw/op_exx_pw.cpp +++ b/source/source_pw/module_pwdft/operator_pw/op_exx_pw.cpp @@ -322,9 +322,10 @@ void OperatorEXXPW::act_op_kpar(const int nbands, // decide which pool does the iq belong to int iq_pool = kv->para_k.whichpool[iq]; int iq_loc = iq - kv->para_k.startk_pool[iq_pool]; + int iq_loc_spin = iq_loc; if (ispin == 1) { - iq_loc += wfcpw->nks / nspin_fac; + iq_loc_spin += wfcpw->nks / nspin_fac; } for (int m_iband = 0; m_iband < psi.get_nbands(); m_iband++) @@ -332,7 +333,7 @@ void OperatorEXXPW::act_op_kpar(const int nbands, double wg_mqb = 0; if (iq_pool == GlobalV::MY_POOL) { - wg_mqb = (*wg)(iq_loc, m_iband); + wg_mqb = (*wg)(iq_loc_spin, m_iband); } #ifdef __MPI MPI_Bcast(&wg_mqb, 1, MPI_DOUBLE, kv->para_k.get_startpro_pool(iq_pool), MPI_COMM_WORLD); @@ -342,7 +343,7 @@ void OperatorEXXPW::act_op_kpar(const int nbands, if (iq_pool == GlobalV::MY_POOL) { - const T* psi_mq = get_pw(m_iband, iq_loc + ispin * wfcpw->nks / nspin_fac); + const T* psi_mq = get_pw(m_iband, iq_loc_spin); wfcpw->recip_to_real(ctx, psi_mq, psi_mq_real, iq_loc); // send } diff --git a/tests/01_PW/096_PW_PBE0_AFM/INPUT b/tests/01_PW/096_PW_PBE0_AFM/INPUT new file mode 100644 index 0000000000..34e5220d03 --- /dev/null +++ b/tests/01_PW/096_PW_PBE0_AFM/INPUT @@ -0,0 +1,31 @@ +INPUT_PARAMETERS +#Parameters (System) +suffix autotest +calculation scf +nspin 2 +pseudo_dir ../../PP_ORB +orbital_dir ../../PP_ORB + +#Parameters (PW) +ecutwfc 30 +basis_type pw + +#Parameters (SCF) +scf_thr 1.0e-7 +scf_nmax 100 +smearing_method gaussian +smearing_sigma 0.015 +mixing_type pulay +mixing_ndim 8 +mixing_beta 0.2 + +#Parameters (Hybrid Functional) +dft_functional pbe0 + +#Parameters (Other) +symmetry -1 +init_wfc random +pw_seed 1 +device cpu +exx_thr_type energy +exx_ene_thr 5e-2 \ No newline at end of file diff --git a/tests/01_PW/096_PW_PBE0_AFM/KPT b/tests/01_PW/096_PW_PBE0_AFM/KPT new file mode 100644 index 0000000000..e583e6e418 --- /dev/null +++ b/tests/01_PW/096_PW_PBE0_AFM/KPT @@ -0,0 +1,7 @@ +K_POINTS +0 +Gamma +1 1 1 0 0 0 +### If you are running an energy calculation, please make sure your final energy is +### converged with respect to the k-point settings, unless you set a loose k-point +### mesh on purpose. diff --git a/tests/01_PW/096_PW_PBE0_AFM/README b/tests/01_PW/096_PW_PBE0_AFM/README new file mode 100644 index 0000000000..6f0a2e68a4 --- /dev/null +++ b/tests/01_PW/096_PW_PBE0_AFM/README @@ -0,0 +1 @@ +Fe Anti-ferromagnetic with nspin=2 hybrid functional (PBE0), PW basis, init magnet: up + down \ No newline at end of file diff --git a/tests/01_PW/096_PW_PBE0_AFM/STRU b/tests/01_PW/096_PW_PBE0_AFM/STRU new file mode 100644 index 0000000000..41c2d00632 --- /dev/null +++ b/tests/01_PW/096_PW_PBE0_AFM/STRU @@ -0,0 +1,19 @@ +ATOMIC_SPECIES +Fe 55.845 Fe_ONCV_PBE-1.0.upf + + +LATTICE_CONSTANT +1.889725989 + +LATTICE_VECTORS + 2.8328152400000000 0.0000000000000000 0.0000000000000000 + 0.0000000000000000 2.8328152400000000 0.0000000000000000 + 0.0000000000000000 0.0000000000000000 2.8328152400000000 +ATOMIC_POSITIONS +Direct + +Fe +1.0 +2 +0.0 0.0 0.0 mag 5 +0.5 0.5 0.5 mag -5 diff --git a/tests/01_PW/096_PW_PBE0_AFM/result.ref b/tests/01_PW/096_PW_PBE0_AFM/result.ref new file mode 100644 index 0000000000..94d18e2a1c --- /dev/null +++ b/tests/01_PW/096_PW_PBE0_AFM/result.ref @@ -0,0 +1,3 @@ +etotref -6383.448381202996 +etotperatomref -3191.7241906015 +totaltimeref 1.06 diff --git a/tests/01_PW/096_PW_PBE0_FM/INPUT b/tests/01_PW/096_PW_PBE0_FM/INPUT new file mode 100644 index 0000000000..34e5220d03 --- /dev/null +++ b/tests/01_PW/096_PW_PBE0_FM/INPUT @@ -0,0 +1,31 @@ +INPUT_PARAMETERS +#Parameters (System) +suffix autotest +calculation scf +nspin 2 +pseudo_dir ../../PP_ORB +orbital_dir ../../PP_ORB + +#Parameters (PW) +ecutwfc 30 +basis_type pw + +#Parameters (SCF) +scf_thr 1.0e-7 +scf_nmax 100 +smearing_method gaussian +smearing_sigma 0.015 +mixing_type pulay +mixing_ndim 8 +mixing_beta 0.2 + +#Parameters (Hybrid Functional) +dft_functional pbe0 + +#Parameters (Other) +symmetry -1 +init_wfc random +pw_seed 1 +device cpu +exx_thr_type energy +exx_ene_thr 5e-2 \ No newline at end of file diff --git a/tests/01_PW/096_PW_PBE0_FM/KPT b/tests/01_PW/096_PW_PBE0_FM/KPT new file mode 100644 index 0000000000..e583e6e418 --- /dev/null +++ b/tests/01_PW/096_PW_PBE0_FM/KPT @@ -0,0 +1,7 @@ +K_POINTS +0 +Gamma +1 1 1 0 0 0 +### If you are running an energy calculation, please make sure your final energy is +### converged with respect to the k-point settings, unless you set a loose k-point +### mesh on purpose. diff --git a/tests/01_PW/096_PW_PBE0_FM/README b/tests/01_PW/096_PW_PBE0_FM/README new file mode 100644 index 0000000000..99bca880b5 --- /dev/null +++ b/tests/01_PW/096_PW_PBE0_FM/README @@ -0,0 +1,3 @@ +Fe Ferromagnetic with nspin=2 hybrid functional (PBE0), PW basis, init magnet: up + up + + diff --git a/tests/01_PW/096_PW_PBE0_FM/STRU b/tests/01_PW/096_PW_PBE0_FM/STRU new file mode 100644 index 0000000000..34fa5b31d0 --- /dev/null +++ b/tests/01_PW/096_PW_PBE0_FM/STRU @@ -0,0 +1,19 @@ +ATOMIC_SPECIES +Fe 55.845 Fe_ONCV_PBE-1.0.upf + + +LATTICE_CONSTANT +1.889725989 + +LATTICE_VECTORS + 2.8328152400000000 0.0000000000000000 0.0000000000000000 + 0.0000000000000000 2.8328152400000000 0.0000000000000000 + 0.0000000000000000 0.0000000000000000 2.8328152400000000 +ATOMIC_POSITIONS +Direct + +Fe +1.0 +2 +0.0 0.0 0.0 mag 5 +0.5 0.5 0.5 mag 5 diff --git a/tests/01_PW/096_PW_PBE0_FM/result.ref b/tests/01_PW/096_PW_PBE0_FM/result.ref new file mode 100644 index 0000000000..5b7663ffcd --- /dev/null +++ b/tests/01_PW/096_PW_PBE0_FM/result.ref @@ -0,0 +1,3 @@ +etotref -6382.460958449486 +etotperatomref -3191.2304792247 +totaltimeref 1.59 \ No newline at end of file diff --git a/tests/01_PW/CASES_CPU.txt b/tests/01_PW/CASES_CPU.txt index 06af40e6ad..1057122012 100644 --- a/tests/01_PW/CASES_CPU.txt +++ b/tests/01_PW/CASES_CPU.txt @@ -94,6 +94,8 @@ 094_PW_NPT 095_PW_NVT 096_PW_PBE0 +096_PW_PBE0_AFM +096_PW_PBE0_FM 097_PW_LDOS 098_PW_15_SO_avg 099_PW_DJ_SO