Refactor and Fix Parallel Handling of Plane Wave Counts in Eigenvalue Output #6844
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Description
This PR addresses the logic for handling and reporting k-point specific plane wave counts (
ngk) in theModuleIO::write_eig_iterandModuleIO::write_eig_filefunctions. It ensures that plane wave basis sizes are correctly aggregated across MPI ranks and accurately reported in the output logs.Technical Breakdown & Conclusions
std::vector<int>registry. Each elementngk[ik]stores the number of plane waves (G-vectors) used for thekv.ngkis resized to match the local pool size (nks). This explains why the size might appear small (e.g.,size 2for 2 k-points).MPI_AllreducewithSUMoverPOOL_WORLDis required to obtain the total physical basis size for each k-point.Changes
MPI_Allreduceto aggregatengkcounts across ranks in the same pool, ensuring the output reports the true total number of plane waves per k-point.ekb) and occupations (wg) from other pools to prevent output race conditions.std::coutstatements regardingngksizes while maintaining improved logging formats.Verification (Commit: 80281a5)
009_Li27Ni9O54Mn9Co9(PW basis).KPARenabled.nksis small, the plane wave counts are correctly calculated and stored, with the final output reflecting the full physical basis set assigned to those k-points.