Skip to content

Commit a374fe8

Browse files
committed
fix: correct k-phase convention in cal_DMR_td for TDDFT hybrid gauge
The cal_DMR_td function used e^{+i(k+A)R} for the k->R Fourier transform, which is the same convention as folding_HR_td (R->k transform). This is incorrect because the inverse transform should use the conjugate phase. Changed cal_DMR_td to use e^{-i(k+A)R} (conjugate of folding_HR_td's e^{+i(k+A)R}), ensuring DMR(R) satisfies Hermiticity: DMR(-R) = DMR(R)^dagger. Key changes: - Negate k·R phase: arg = -(kvec_d · dR) * TWO_PI - Conjugate phase_hybrid for hybrid gauge (td_stype==2): std::conj(phase_hybrid) This gives e^{-iA·R} instead of e^{+iA·R} Note: cal_DMR (ground-state) is intentionally left unchanged with e^{+ikR} to maintain consistency with all downstream code (charge density, forces, etc.). The ground-state DMR is self-consistent with the +ikR convention for time-reversal symmetric systems where DM(R) is real.
1 parent ee6ec4c commit a374fe8

1 file changed

Lines changed: 5 additions & 4 deletions

File tree

source/source_estate/module_dm/density_matrix.cpp

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -266,16 +266,17 @@ void DensityMatrix_Tools::cal_DMR_td(
266266
{
267267
if(ik_in >= 0 && ik_in != ik) { continue; }
268268
// cal k_phase
269-
// if TK==std::complex<double>, kphase is e^{ikR}
269+
// DMR(R) = (1/Nk) Sum_k e^{-i(k+A)R} DMK(k) (inverse Fourier transform with hybrid gauge)
270+
// This is the conjugate of folding_HR_td's e^{+i(k+A)R}, ensuring DMR Hermiticity.
270271
const ModuleBase::Vector3<double> dR(R_index[0], R_index[1], R_index[2]);
271-
const double arg = (dm._kvec_d[ik] * dR) * ModuleBase::TWO_PI;
272+
const double arg = -(dm._kvec_d[ik] * dR) * ModuleBase::TWO_PI;
272273
double sinp, cosp;
273274
ModuleBase::libm::sincos(arg, &sinp, &cosp);
274275
kphase_vec[ik][iR] = TK(cosp, sinp);
275276
if(PARAM.inp.td_stype==2)
276277
{
277-
//phase for hybrid gauge tddft
278-
kphase_vec[ik][iR] *= phase_hybrid.at(R_index);
278+
//phase for hybrid gauge tddft: conjugate to get e^{-iA·R}
279+
kphase_vec[ik][iR] *= std::conj(phase_hybrid.at(R_index));
279280
}
280281
}
281282
}

0 commit comments

Comments
 (0)