Repository navigation
Fix missing last term in B-spline factor for structure factor - #8210
Open
Cstandardlib wants to merge 2 commits into
Open
Cstandardlib wants to merge 2 commits into
Cstandardlib wants to merge 2 commits into
Conversation
… by (1-1/N!)^-3
The denominator loop in Structure_Factor::bsplinecoef missed the last integer-point sample M_{N+1}(N) = 1/N! of the Cardinal B-spline, so the G=0 deconvolution factor was 1/(1-1/N!) per direction instead of 1, and S(G=0) -- the integrated electron number -- was scaled by (1-1/N!)^-3 (8x at nbspline=2). The method is exact at G=0 at any order by partition of unity, so this was an off-by-one implementation error, not low-order interpolation error.
Add a unit test asserting b(0)=1 for norder = 2,4,6,10,20 and a low-order OFDFT integration case 35_OF_LPS_bspline; regenerate references of the six existing nbspline=10 cases (energies shift by ~1e-4 eV, the intended behavior change).
Cstandardlib
force-pushed
the
fix-nbspline
branch
from
October 25, 2026 10:21
912652c to
3e566d4
Compare
Cstandardlib
marked this pull request as ready for review
October 25, 2026 17:09
This branch has not been deployed
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.
Fix missing last term in B-spline deconvolution factor for structure factor (nbspline).
Summary
Fix an error in the B-spline correction coefficients used by
Structure_Factor::bsplinecoef.The previous denominator sum omitted the last nonzero integer sample of the Cardinal B-spline.
This gives incorrect structure factors when
nbsplineis enabled, with a particularly large error at low orders.For
nbspline = 2, the zero-frequency structure factor is multiplied by 8, which also scales the integratedatomic-superposition initial density before any subsequent normalization.
Linked Issue
Fix #8092
Unit Tests and/or Case Tests for my changes
What's changed?
Governance Notes