Skip to content

Commit 93a0d78

Browse files
committed
Restore add(dp_op) to operator chain, remove stale contributeHk call
The previous commits removed add(dp_op) as a workaround for np=2 crash, breaking np=1 constraint mode. Restored. The MPI fixes that remain valid: - dp_target broadcast (bcast_cell.cpp) - Gamma Bcast (deltap_wannier.cpp) - Lambda Bcast (esolver_ks_lcao.cpp) - Print rank-0 guards (esolver_ks_lcao.cpp) - Null guard in deltap_lcao.cpp
1 parent 6ddad71 commit 93a0d78

2 files changed

Lines changed: 2 additions & 17 deletions

File tree

source/source_esolver/esolver_ks_lcao.cpp

Lines changed: 0 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -1411,19 +1411,6 @@ void ESolver_KS_LCAO<TK, TR>::deltap_update_lambda(UnitCell& ucell, const int it
14111411
std::unordered_map<int, std::vector<std::complex<double>>> hk_corr;
14121412
dp->compute_hk_correction(ucell, psi, lambda, hk_corr);
14131413
dp_op->set_hk_correction(hk_corr);
1414-
1415-
// Apply HK correction on rank 0 only (operator not in chain for MPI)
1416-
#ifdef __MPI
1417-
if (this->pv.comm() != MPI_COMM_NULL) {
1418-
int rank = 0;
1419-
MPI_Comm_rank(this->pv.comm(), &rank);
1420-
if (rank == 0)
1421-
#endif
1422-
for (int ik = 0; ik < this->kv.get_nks(); ++ik)
1423-
dp_op->contributeHk(ik);
1424-
#ifdef __MPI
1425-
}
1426-
#endif
14271414
}
14281415
}
14291416

source/source_lcao/hamilt_lcao.cpp

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -417,12 +417,10 @@ HamiltLCAO<TK, TR>::HamiltLCAO(const UnitCell& ucell,
417417
&grid_d,
418418
two_center_bundle.overlap_orb_onsite.get(),
419419
orb.cutoffs(),
420-
PARAM.inp.deltap_rm);
420+
PARAM.inp.deltap_rm);
421+
this->getOperator()->add(dp_op);
421422
this->dp_operator = dynamic_cast<DeltaPOperator<TK, TR>*>(dp_op);
422423
this->dp_operator->set_gdir(PARAM.inp.deltap_gdir);
423-
// Note: NOT added to operator chain (getOperator()->add) due to
424-
// MPI distributed-k-point crash. HK correction applied directly
425-
// from esolver iter_finish.
426424
}
427425
}
428426

0 commit comments

Comments
 (0)