Feature: Support PW partial-charge output under ultrasoft pseudopotentials (USPP) - #7944
Open
AsTonyshment wants to merge 4 commits into
Open
Feature: Support PW partial-charge output under ultrasoft pseudopotentials (USPP)#7944AsTonyshment wants to merge 4 commits into
AsTonyshment wants to merge 4 commits into
Conversation
AsTonyshment
force-pushed
the
feat/uspp_pchg
branch
from
September 9, 2026 07:53
cf9dea4 to
4704985
Compare
AsTonyshment
requested
a lite review from Copilot
and removed request for
Copilot
September 9, 2026 08:10
AsTonyshment
force-pushed
the
feat/uspp_pchg
branch
from
September 9, 2026 08:36
4738616 to
36ddd39
Compare
AsTonyshment
requested
a lite review from Copilot
and removed request for
Copilot
September 9, 2026 08:36
AsTonyshment
force-pushed
the
feat/uspp_pchg
branch
from
September 9, 2026 08:38
36ddd39 to
9366f0e
Compare
…avefunction output handling
AsTonyshment
force-pushed
the
feat/uspp_pchg
branch
from
September 9, 2026 08:53
9366f0e to
8723766
Compare
AsTonyshment
requested
a lite review from Copilot
and removed request for
Copilot
September 9, 2026 08:53
mohanchen
reviewed
Sep 9, 2026
| const std::complex<double> zero_d(0, 0); | ||
| char transa = 'N'; | ||
| char transb = 'T'; | ||
| zgemm_(&transa, |
| const std::complex<double>* owner_wfcr = transform_wfc(&psi_(local_band, component * work->npwx), ik, component, work); | ||
| std::copy(owner_wfcr, owner_wfcr + work->dense_nrxx, work->wfcr[component].begin()); | ||
| } | ||
| #ifdef __MPI |
Collaborator
There was a problem hiding this comment.
you don't need to write #ifdef __MPI, it should be included in the bcast_data function
| work->state_weight, | ||
| &work->state_becsum); | ||
| } | ||
| #ifdef __MPI |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
What's changed?
PW
out_pchgpreviously exported only the squared pseudo-wavefunction amplitude for ultrasoft pseudopotentials (USPP). Since USPP states are normalized with the overlap operator, this soft contribution alone generally does not integrate to the expected state charge. This PR adds the missing augmentation contribution to produce the complete band-decomposed valence density.The single-state density is

$Q_{ij}^{I}$ are the augmentation functions and $\beta_i^I$ are the atomic projectors.
where
The implementation shares the projector-overlap and augmentation-density routines with
ElecStatePW. Augmentation is constructed on the dense charge grid and included before the merged density is symmetrized, with support for k-point and band parallelism and mixed norm-conserving/USPP species.Related changes:
.hand.cppfiles with reusable workspaces, and use the solver's native CPU/GPU wavefunction precision for FFTs and projector overlaps.mem_saver=1whenout_pchg,out_wfc_norm, orout_wfc_re_imis specified, because wavefunctions from earlier k points are overwritten.213_PW_USPP_pchg_wfc, covering occupied and unoccupied partial charges, wavefunction output, double grids, and k-point/band parallelism.Test results
Test case: NaCl,
nspin=1, CPU double, 4 MPI × 2 OpenMPd9d5206)