Skip to content

Commit ea86510

Browse files
author
dyzheng
committed
Fix(dftu-pw): correct Pauli-to-spin conversion signs and weight_eu for nspin=1
In cal_occ_pw(): - Swap the imaginary signs in the Pauli-to-spin conversion for nspin=4: index[1] (spin down-up): -i*vu_tmp[2] -> +i*vu_tmp[2] index[2] (spin up-down): +i*vu_tmp[2] -> -i*vu_tmp[2] The DFT+U vu array convention requires opposite sign from deeq_nc. - Fix weight_eu for nspin=1: 0.25 -> 1.0 nspin=1 has single occupancy, not the Pauli double-counting factor. Verified with tests/17_DS_DFTU/08 and 09: 08: -6792.33351671617 (ref -6792.33351670950, diff 6.7e-9 eV) 09: -6364.26587638707 (ref -6364.26587639017, diff 3.1e-9 eV)
1 parent bb2cb4b commit ea86510

1 file changed

Lines changed: 3 additions & 3 deletions

File tree

source/source_lcao/module_dftu/dftu_pw.cpp

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -247,7 +247,7 @@ void Plus_U::cal_occ_pw(const int iter,
247247
}
248248

249249
Plus_U::energy_u = 0.0;
250-
const double weight_eu = (Plus_U::nspin == 1) ? 0.25 : (Plus_U::nspin == 2) ? 0.5 : 0.25;
250+
const double weight_eu = (Plus_U::nspin == 1) ? 1.0 : (Plus_U::nspin == 2) ? 0.5 : 0.25;
251251
const double diag_coeff = (Plus_U::nspin == 4) ? 1.0 : 0.5;
252252
// calculate VU and energy (locale already reduced above)
253253
for(int iat = 0; iat < cell.nat; iat++)
@@ -309,8 +309,8 @@ void Plus_U::cal_occ_pw(const int iter,
309309
}
310310
vu_iat[index[0]] = 0.5 * (vu_tmp[0] + vu_tmp[3]);
311311
vu_iat[index[3]] = 0.5 * (vu_tmp[0] - vu_tmp[3]);
312-
vu_iat[index[1]] = 0.5 * (vu_tmp[1] - std::complex<double>(0.0, 1.0) * vu_tmp[2]);
313-
vu_iat[index[2]] = 0.5 * (vu_tmp[1] + std::complex<double>(0.0, 1.0) * vu_tmp[2]);
312+
vu_iat[index[1]] = 0.5 * (vu_tmp[1] + std::complex<double>(0.0, 1.0) * vu_tmp[2]);
313+
vu_iat[index[2]] = 0.5 * (vu_tmp[1] - std::complex<double>(0.0, 1.0) * vu_tmp[2]);
314314
}
315315
}
316316
}

0 commit comments

Comments
 (0)