Repository navigation
Fix missing last term in B-spline factor for structure factor - #8210
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).
912652c to
3e566d4
Compare
ABACUS-PR-BOT
left a comment
There was a problem hiding this comment.
Static review found the endpoint correction consistent with the spline support, phase and FFT normalization on the documented cutoff or odd-full-grid paths. Runtime tests and CI diagnostics were not run; the existing even-full-grid Nyquist limitation remains outside this validation. Two nonblocking follow-ups below.
| totalforceref 0.787244 | ||
| totalstressref 107.895762 | ||
| totaltimeref +1.49612 | ||
| etotref -231.6927874142393 |
There was a problem hiding this comment.
Non-blocking: Please record the exact commands, producing source/executable identity, build configuration, and results used to generate the six replacement references and the new case. The correction explains why spline results change, but the blank validation section leaves their numerical provenance unverified. Please also note unrun checks and why this algorithm-only correction needs no INPUT-doc update.
| @@ -0,0 +1,30 @@ | |||
| INPUT_PARAMETERS | |||
There was a problem hiding this comment.
Non-blocking: Please trim the trailing spaces in the new INPUT and STRU files (INPUT line 1; STRU lines 8–10 and 18). They are harmless to parsing, but currently make git diff --check fail; cleanup can be a follow-up after merge.
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