Skip to content

Commit 7125ec9

Browse files
committed
DeltaP PW: fix multi-k segfault — use Gamma mesh + pw_rho
Two fixes for multi-k Berry phase during SCF: 1. Use Gamma mesh (not Monkhorst-Pack) — Monkhorst-Pack causes segfault for isolated molecules in large boxes. Gamma 1x1x2 works correctly. 2. Pass pw_rho (smooth density grid) instead of pw_rhod (dense USPP grid) as rhopw to compute_total_gamma_pw(). unkdotp_G0 uses rhopw->recip2real which requires the smooth FFT grid. Multi-k verified (H2O, Gamma 1x1x2): gamma_total = -0.2302 rad (same as Gamma-only -0.2298) per-atom: O=-0.1512, H=-0.0398 (stable across iterations) E_tot = -417.089 eV (vs -417.169 eV Gamma-only) BN LCAO regression passes.
1 parent 478b972 commit 7125ec9

2 files changed

Lines changed: 2 additions & 2 deletions

File tree

source/source_esolver/esolver_ks_pw.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -283,7 +283,7 @@ void ESolver_KS_PW<T, Device>::iter_finish(UnitCell& ucell, const int istep, int
283283

284284
// DeltaP: compute gamma and update lambda after SCF iteration
285285
pw_deltap::deltap_iter_finish(ucell, this->drho,
286-
this->stp.psi_cpu, this->kv, this->pw_wfc, this->pw_rhod, PARAM.inp);
286+
this->stp.psi_cpu, this->kv, this->pw_wfc, this->pw_rho, PARAM.inp);
287287

288288
// the output quantities
289289
ModuleIO::ctrl_iter_pw(istep, iter, conv_esolver, this->stp.psi_cpu,

tests/deltap_pw_h2o/INPUT

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,4 +27,4 @@ deltap_gdir 3
2727
deltap_lambda_step 0.01
2828
deltap_lambda_mixing 0.1
2929
deltap_inner_thr 1e-3
30-
onsite_radius 6.0
30+
onsite_radius 6.0

0 commit comments

Comments
 (0)