Fix: Correct LCAO real-space wavefunctions and partial-charge handling - #7868
Merged
Conversation
…rs with correct norm, real, and imaginary components
…complex Bloch phases, component separation, and direct Gint output
…led nspin=4 symmetry, and unify Cube precision
AsTonyshment
force-pushed
the
fix/pchg_wfc_lcao
branch
from
August 28, 2026 00:01
4151f17 to
d68f1f1
Compare
mohanchen
approved these changes
Aug 28, 2026
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.
Summary
This PR corrects the physical meaning and data flow of real-space wavefunction output and fixes the LCAO partial-charge path.
Real-space wavefunction
.cubefiles now represent the complete, normalized single-particle Bloch stateFor$\rho_{n\boldsymbol{k}}=2|\psi_{n\boldsymbol{k}}|^2$ , and no longer rescales the wavefunction itself.
nspin=1, the factor of two belongs only to the partial charge,nspin=4, the norm iss1/s2contain the upper/lower spinor components.cal_dm_psi: Gamma and separate-k states use the appropriate spin degeneracy, while k-summed states usekv.wk. This also removes the MPI-only implementation.Charge::rho,rho_save, orrhog. Fornspin=4, the scalar charge is symmetrized separately and the three magnetization components are rotated together through the SOC symmetry path..cubefiles, and makes.cubefile naming and precision consistent.out_wfc_pw: the old path was a lossy LCAO-to-PW projection whose content depended on unrelated.cubeoutput selectors. Nonzero values are rejected for non-PW bases; native PW coefficient output is unchanged. The INPUT metadata and wavefunction initialization documentation were updated and regenerated accordingly.Scope
The shared LCAO DMK/DMR/Fourier/Pauli convention is unchanged. Partial-charge output now reuses the existing common density-matrix path and deliberately adds no output-layer phase or$m_y$ sign compensation.
Related work in #7832 changes the noncollinear Pauli-component convention, particularly the sign of$m_y$ , while #7833 changes the DMK-to-DMR Fourier convention. These definitions can affect the eventual
nspin=4LCAO partial-charge semantics. This PR neither duplicates nor compensates for those proposed changes; by routing state DMK construction and real-space density evaluation through the common path, it keeps partial-charge output aligned with whichever shared convention is merged.