diff --git a/source/source_lcao/module_dftu/dftu_pw.cpp b/source/source_lcao/module_dftu/dftu_pw.cpp index c1757f45d4..4e047a41d2 100644 --- a/source/source_lcao/module_dftu/dftu_pw.cpp +++ b/source/source_lcao/module_dftu/dftu_pw.cpp @@ -247,7 +247,7 @@ void Plus_U::cal_occ_pw(const int iter, } Plus_U::energy_u = 0.0; - const double weight_eu = (Plus_U::nspin == 1) ? 0.25 : (Plus_U::nspin == 2) ? 0.5 : 0.25; + const double weight_eu = (Plus_U::nspin == 1) ? 1.0 : (Plus_U::nspin == 2) ? 0.5 : 0.25; const double diag_coeff = (Plus_U::nspin == 4) ? 1.0 : 0.5; // calculate VU and energy (locale already reduced above) for(int iat = 0; iat < cell.nat; iat++) @@ -309,8 +309,8 @@ void Plus_U::cal_occ_pw(const int iter, } vu_iat[index[0]] = 0.5 * (vu_tmp[0] + vu_tmp[3]); vu_iat[index[3]] = 0.5 * (vu_tmp[0] - vu_tmp[3]); - vu_iat[index[1]] = 0.5 * (vu_tmp[1] - std::complex(0.0, 1.0) * vu_tmp[2]); - vu_iat[index[2]] = 0.5 * (vu_tmp[1] + std::complex(0.0, 1.0) * vu_tmp[2]); + vu_iat[index[1]] = 0.5 * (vu_tmp[1] + std::complex(0.0, 1.0) * vu_tmp[2]); + vu_iat[index[2]] = 0.5 * (vu_tmp[1] - std::complex(0.0, 1.0) * vu_tmp[2]); } } } diff --git a/tests/01_PW/099_PW_DJ_SO/result.ref b/tests/01_PW/099_PW_DJ_SO/result.ref index 4c9007e428..e6b1657fb7 100644 --- a/tests/01_PW/099_PW_DJ_SO/result.ref +++ b/tests/01_PW/099_PW_DJ_SO/result.ref @@ -1,5 +1,5 @@ -etotref -5662.3881388456420609 -etotperatomref -2831.1940694228 -totalforceref 15.774740 -totalstressref 100840.559090 +etotref -5662.3908859903258417 +etotperatomref -2831.1954429952 +totalforceref 17.965510 +totalstressref 100582.607209 totaltimeref 1.26 diff --git a/tests/01_PW/815_PW_DFTU_S2_Z/INPUT b/tests/01_PW/815_PW_DFTU_S2_Z/INPUT new file mode 100644 index 0000000000..88bcde220e --- /dev/null +++ b/tests/01_PW/815_PW_DFTU_S2_Z/INPUT @@ -0,0 +1,29 @@ +INPUT_PARAMETERS +suffix autotest +calculation scf +basis_type pw +ecutwfc 50 +gamma_only 0 +device cpu + +nspin 2 +nbands 28 +scf_thr 1.0e-6 +scf_nmax 100 +out_chg 0 +smearing_method gaussian +smearing_sigma 0.01 +mixing_type broyden +mixing_beta 0.4 +ks_solver dav_subspace +symmetry 0 + +# DFT+U parameters +dft_plus_u 1 +orbital_corr 2 +hubbard_u 5.0 +onsite_radius 3.0 + +pseudo_dir ../../PP_ORB +orbital_dir ../../PP_ORB +pw_seed 1 diff --git a/tests/01_PW/815_PW_DFTU_S2_Z/KPT b/tests/01_PW/815_PW_DFTU_S2_Z/KPT new file mode 100644 index 0000000000..35597cecff --- /dev/null +++ b/tests/01_PW/815_PW_DFTU_S2_Z/KPT @@ -0,0 +1,4 @@ +K_POINTS +0 +Monkhorst-Pack +2 2 2 0 0 0 diff --git a/tests/01_PW/815_PW_DFTU_S2_Z/README b/tests/01_PW/815_PW_DFTU_S2_Z/README new file mode 100644 index 0000000000..558599f71b --- /dev/null +++ b/tests/01_PW/815_PW_DFTU_S2_Z/README @@ -0,0 +1 @@ +Test PW DFT+U (U=5.0eV, l=2) with collinear spin (nspin=2), Z magnetization diff --git a/tests/01_PW/815_PW_DFTU_S2_Z/STRU b/tests/01_PW/815_PW_DFTU_S2_Z/STRU new file mode 100644 index 0000000000..8535c1db16 --- /dev/null +++ b/tests/01_PW/815_PW_DFTU_S2_Z/STRU @@ -0,0 +1,21 @@ +ATOMIC_SPECIES +Fe 1.000 Fe.upf + +NUMERICAL_ORBITAL +Fe_gga_6au_100Ry_4s2p2d1f.orb + +LATTICE_CONSTANT +8.190 + +LATTICE_VECTORS + 1.00 0.50 0.50 + 0.50 1.00 0.50 + 0.50 0.50 1.00 +ATOMIC_POSITIONS +Direct + +Fe +0.0 +2 +0.00 0.00 0.00 mag 2.0 +0.51 0.51 0.51 mag -2.0 diff --git a/tests/01_PW/815_PW_DFTU_S2_Z/result.ref b/tests/01_PW/815_PW_DFTU_S2_Z/result.ref new file mode 100644 index 0000000000..f9ddfdd28a --- /dev/null +++ b/tests/01_PW/815_PW_DFTU_S2_Z/result.ref @@ -0,0 +1,3 @@ +etotref -6792.3335167095001452 +etotperatomref -3396.1667583548 +totaltimeref 21.07 diff --git a/tests/01_PW/816_PW_DFTU_S4_XY/INPUT b/tests/01_PW/816_PW_DFTU_S4_XY/INPUT new file mode 100644 index 0000000000..5d19e1c066 --- /dev/null +++ b/tests/01_PW/816_PW_DFTU_S4_XY/INPUT @@ -0,0 +1,29 @@ +INPUT_PARAMETERS +suffix autotest +calculation scf +basis_type pw +ecutwfc 20 +gamma_only 0 +device cpu + +noncolin 1 +scf_thr 1.0e-6 +scf_nmax 50 +out_chg 0 +smearing_method gaussian +smearing_sigma 0.01 +mixing_type broyden +mixing_beta 0.4 +ks_solver dav_subspace +symmetry 0 + +# DFT+U parameters +dft_plus_u 1 +orbital_corr 2 +hubbard_u 5.0 +onsite_radius 3.0 + +kpar 1 +pseudo_dir ../../PP_ORB +orbital_dir ../../PP_ORB +pw_seed 1 diff --git a/tests/01_PW/816_PW_DFTU_S4_XY/KPT b/tests/01_PW/816_PW_DFTU_S4_XY/KPT new file mode 100644 index 0000000000..35597cecff --- /dev/null +++ b/tests/01_PW/816_PW_DFTU_S4_XY/KPT @@ -0,0 +1,4 @@ +K_POINTS +0 +Monkhorst-Pack +2 2 2 0 0 0 diff --git a/tests/01_PW/816_PW_DFTU_S4_XY/README b/tests/01_PW/816_PW_DFTU_S4_XY/README new file mode 100644 index 0000000000..7953a4c17e --- /dev/null +++ b/tests/01_PW/816_PW_DFTU_S4_XY/README @@ -0,0 +1 @@ +Test PW DFT+U with noncollinear spin (nspin=4), XY magnetization constraint diff --git a/tests/01_PW/816_PW_DFTU_S4_XY/STRU b/tests/01_PW/816_PW_DFTU_S4_XY/STRU new file mode 100644 index 0000000000..63c4d14399 --- /dev/null +++ b/tests/01_PW/816_PW_DFTU_S4_XY/STRU @@ -0,0 +1,21 @@ +ATOMIC_SPECIES +Fe 1.000 Fe.upf + +NUMERICAL_ORBITAL +Fe_gga_6au_100Ry_4s2p2d1f.orb + +LATTICE_CONSTANT +8.190 + +LATTICE_VECTORS + 1.00 0.50 0.50 + 0.50 1.00 0.50 + 0.50 0.50 1.00 +ATOMIC_POSITIONS +Direct + +Fe +0.0 +2 +0.00 0.00 0.00 magmom 2.0 0.0 0.0 +0.51 0.51 0.51 magmom -2.0 0.0 0.0 diff --git a/tests/01_PW/816_PW_DFTU_S4_XY/result.ref b/tests/01_PW/816_PW_DFTU_S4_XY/result.ref new file mode 100644 index 0000000000..8242af7627 --- /dev/null +++ b/tests/01_PW/816_PW_DFTU_S4_XY/result.ref @@ -0,0 +1,3 @@ +etotref -6364.2658763901727070 +etotperatomref -3182.1329381951 +totaltimeref 7.82 diff --git a/tests/01_PW/CASES_CPU.txt b/tests/01_PW/CASES_CPU.txt index 0ffdf7c077..d074f9bb8e 100644 --- a/tests/01_PW/CASES_CPU.txt +++ b/tests/01_PW/CASES_CPU.txt @@ -127,3 +127,5 @@ scf_out_chg_tau 812_PW_LT_sm 813_PW_LT_bacm 814_PW_LT_triclinic +815_PW_DFTU_S2_Z +816_PW_DFTU_S4_XY diff --git a/tests/17_DS_DFTU/CASES_CPU.txt b/tests/17_DS_DFTU/CASES_CPU.txt index fc43536515..1b66080746 100644 --- a/tests/17_DS_DFTU/CASES_CPU.txt +++ b/tests/17_DS_DFTU/CASES_CPU.txt @@ -19,8 +19,8 @@ # ======================== 06_PW_SPIN_S2_Z 07_PW_SPIN_S4_XYZ -08_PW_DFTU_S2_Z -09_PW_DFTU_S4_XY +# 08_PW_DFTU_S2_Z # MIGRATED to 01_PW/815_PW_DFTU_S2_Z +# 09_PW_DFTU_S4_XY # MIGRATED to 01_PW/816_PW_DFTU_S4_XY 11_PW_DFTU_S2_FeO # ========================