Repository navigation
Conversation
…ymmetry Four defects made SDFT/DOS unusable at high temperature: * checkconverge() uses tmin == 0 as its "uninitialized" sentinel, so a positive trial Rayleigh quotient leaves Emin > 0 and excludes every bound state; the upper bound is underestimated in the same path. * the DOS stage re-derived the range from (0, 0) instead of inheriting the converged SCF range, and Stochastic_WF::nchi was never initialized, so the range probe always used random vectors. * dos_scale widened the reported window by 0.5% per side without widening the Chebyshev interval, so T_n(|x| > 1) grew exponentially: DOS values of 1e26--1e64 instead of the 2*N_pw integral. * the entropy density computed 1 - f by subtraction, and returned 0 for |x| > 36: the sqrt(g) coefficient tail was lifted from ~1e-19 to ~1e-12, which made E_entropy(-TS) two orders of magnitude too large while Ne stayed exact. Stochastic_Iter::dot() also ignored its arguments, so the reported precision was meaningless. Fixes: repair the range at the call sites, inherit the SCF range in the DOS stage, initialize nchi, expand the Chebyshev interval to contain the output grid, evaluate the entropy density with s = min(f, 1-f) and log1p(-s), and make dot() use the passed arrays. Adds a unit test for the entropy kernels.
This was referenced Nov 24, 2026
This was referenced Nov 24, 2026
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.
Reminder
AGENTS.mdanddocs/developers_guide/agent_governance.md.Linked Issue
Fixes #8379.
Fixes #8380.
Part 2/3 of the series; part 3/3 is #8383.
Unit Tests and/or Case Tests for my changes
ctest -R MODULE_PW_STO --output-on-failure(newmodule_stodft/unittests/test_sto_func.cpp,4 cases)
sto_func.cppas a controltests/06_SDFTthroughtests/integrate/Autotest.sh(24 cases, 116 checks)mpirun -np 4 abacuson the 1-atom 348 eV inputs from SDFT: DOS values of 1e52 at high electronic temperature #8379 and SDFT: TSRelative Chebyshev Precision is abnormally large (orders of magnitude above NeRelative) #8380cmake --build --target abacus_pw_paraon top of the currentdevelop(
no_artificial_cutoff_jump,tail_asymptotics_and_extremes) when compiled against theunpatched
sto_func.cpptests/06_SDFT: 116/116 checks passE_entropy(-TS)-1.28e8 Ry -> -787.85 Ry,TSRelative0.73 -> 3.8e-13,NeRelativeunchanged (5.1e-15 -> 1.5e-12)(
+18.06 Ry -> -5.02 Ry) and the|t| > 1evaluation of the DOS grid is gonetests/; the behaviour is covered bythe existing
tests/06_SDFTcases plus the unit test, and the exact numbers above are reported inthe linked issues.
What's changed?
Four defects made SDFT/DOS unusable at high temperature:
Math_Chebyshev::checkconverge()usestmin == 0as its "uninitialized" sentinel, so a positivetrial Rayleigh quotient leaves
Emin > 0and excludes every bound state; the upper bound isunderestimated in the same path.
(0, 0)instead of inheriting the converged SCF range, andStochastic_WF::nchiwas never initialized, so the range probe always used random vectors.dos_scalewidened the reported window by 0.5% per side without widening the Chebyshev interval,so
T_n(|x| > 1)grew exponentially: DOS values of1e26-1e64instead of the integral of thedensity of states.
1 - fby subtraction and returned 0 for|x| > 36: thesqrt(g)coefficient tail was lifted from
~1e-19to~1e-12, which madeE_entropy(-TS)two orders ofmagnitude too large while
Nestayed exact.Stochastic_Iter::dot()also ignored its arguments,so the reported precision was meaningless.
Fixes: repair the range at the call sites, inherit the SCF range in the DOS stage, initialize
nchi,expand the Chebyshev interval to contain the output grid, evaluate the entropy density with
s = min(f, 1-f)andlog1p(-s), and makedot()use the passed arrays.Governance Notes
dos_scale,dos_nche,emin_stoandemax_stois unchanged for healthy input (the window is repaired only when it is out of range).No default or interface changes, so there is no documentation update required.
module_stodftonly (Sto_DOS,Sto_Tool,Sto_Func,Stochastic_Iter,Stochastic_WF); no change in the KSDFT solver.Global dependency budget(+11 references, all in warning/reporting paths ofthe SDFT range checks), see below.
Governance Exception
GlobalV::ofs_running, the same channel the existing SDFT warnings use. The added reads happen atmost once per run (or once per SCF step in the range check).
source/source_pw/module_stodft/sto_dos.cpp,sto_iter.cpp,sto_tool.cpp.a silent DOS/entropy failure visible.
Sto_DOS/Sto_Toolare not given an output stream,and threading one through would change the
ESolver<->module_stodftinterface.std::ostream&(or a small logging context) down from the esolverand remove the
GlobalV::ofs_runningreads, together with the same cleanup as part 1/3.