Hoist sigma_minus_dc out of the per-k loop in SumkDFT_opt#175
Open
k-yoshimi wants to merge 1 commit into
Open
Conversation
sigma_minus_dc (Sigma_imp minus double counting) is independent of the k-point and the chemical potential, but lattice_gf() recomputed it (a full copy, and add_dc()) for every k -- and total_density() is called repeatedly during the chemical-potential bisection, so the cost was amplified. - Add SumkDFT_opt._compute_sigma_minus_dc(iw_or_w, with_dc). - lattice_gf() accepts an optional precomputed sigma_minus_dc (backward compatible: recomputes when not supplied). - extract_G_loc() and total_density_matsubara() precompute it once before the k-loop and pass it in. upfold() only reads gf_to_upfold, so sharing one object across all k is safe. Verified end-to-end with the TRIQS-compat (dcorelib) backend: tests/non-mpi passes (20 passed, HPhi-binary tests excluded). Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
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
sigma_minus_dc(Sigma_imp minus double counting) is independent of the k-point and the chemical potential, butlattice_gf()recomputed it (a full copy, plusadd_dc()) for every k — andtotal_density()is called repeatedly during the chemical-potential bisection, amplifying the cost.SumkDFT_opt._compute_sigma_minus_dc(iw_or_w, with_dc).lattice_gf()accepts an optional precomputedsigma_minus_dc(backward compatible: it recomputes when not supplied).extract_G_loc()andtotal_density_matsubara()precompute it once before the k-loop and pass it in.upfold()only readsgf_to_upfold, so sharing one object across all k is safe.Verification
End-to-end with the TRIQS-compat (dcorelib) backend:
tests/non-mpipasses (20 passed; HPhi-binary tests excluded), including the wannier90 DMFT tests that exercise this path on both numpy 1.26.4 and numpy 2.5.0.🤖 Generated with Claude Code