Fix time-reversal symmetry in plane-wave basis Hartree matrix elements v_h and dump_hartree - #46
Open
jaemolihm wants to merge 1 commit into
Open
Conversation
hamilt::v_h passed kp_trev(k) to transform_k2g, which applies the sign
flip sg=-1 and places the plane-wave coefficients at -S*g. Combined with
the separate real-space conjugation of the orbital, this double-applies
the sign and produces the per-k density inverted about the FFT grid
origin, n_{Sk}(-r) instead of n_{Sk}(r).
For crystals whose inversion center is not at the grid origin (e.g.
diamond Si, inversion center at the bond midpoint), the time-reversed
half of the BZ is then misregistered relative to the non-TR half. The
total charge (G=0) is preserved, but the G!=0 structure partially
cancels, halving the Hartree matrix elements (e.g. Si Gamma band 3:
2.65 eV vs QE 5.30 eV). Only the plane-wave v_h path is affected; the
THC J[Dm] path used for HF/GW energies is correct.
Fix: pass false to transform_k2g in both v_h overloads. Time reversal is
already applied via the real-space conjugation of the orbital (full-
density path) and is unnecessary for |psi|^2 (diagonal-density path).
This matches the idiom used elsewhere (unfold_bz.cpp): spatial rotation
via transform_k2g(false, ...) and time reversal via a separate conj.
Test: new fixture qe_si333_sym (diamond Si, 3x3x3, force_symmorphic ->
27 kpts reduce to 4 IBZ with 13 time-reversal pairs and no inversion op)
with two check_Hartree sections (full and diagonal density). Before fix
||J - J2|| = 0.098 (FAIL); after fix O(1e-7). Existing LiH/GaAs fixtures
do not catch this: LiH's inversion center is at the origin (masks the
misregistration) and the GaAs fixture has no TR pairs.
jaemolihm
force-pushed
the
fix/vh-hartree-time-reversal
branch
from
July 18, 2026 20:48
47983c2 to
397ec30
Compare
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.
Problem
coqui.post_proc.dump_hartree(plane-wave Hartree matrix elementsVH_skij) was wrong for systems with time-reversal symmetry but no symmorphic inversion (inversion about the grid origin), such as silicon with inversion center at (1/8, 1/8, 1/8).Fix
Updated
src/hamiltonian/v_h.hppconj(FFT[c @ -S·g])(r) = u₋ₛₖ(-r)→ densityn_{Sk}(-r)(inverted about the origin)conj(FFT[c @ +S·g])(r) = u₋ₛₖ(r)→ densityn_{Sk}(r)(correct)Same as
coqui/src/mean_field/symmetry/unfold_bz.cpp
Lines 141 to 142 in 3f807e4
Test
New fixture
qe_si333_sym(diamond Si, 3×3×3,force_symmorphic = .true.) + twocheck_Hartreesections.J: from the THC ERIs (hf.evaluate)J2: from the plane-wave path (hamilt::Vhartree→v_h, the code under test)si333_sym(full ρ)si333_sym_diag(diagonal ρ)Existing LiH/GaAs fixtures do not cover this because LiH inversion center at origin; GaAs does not use symmetry.