source_hsolver tests: drop the last source_pw/source_hamilt dependencies - #8044
Merged
mohanchen merged 1 commit intoSep 30, 2026
Conversation
…r tests - test_hsolver.cpp: every TEST_F had been commented out, and the fixture only held a hamilt::Hamilt and a Stochastic_WF that nothing used. Replace it with tests of the free functions actually declared in hsolver.h (cal_hsolve_error, set_diagethr_ks, set_diagethr_sdft, reset_diag_ethr), which had no unit test, and compile ../hsolver.cpp into MODULE_HSOLVER_base. - hsolver_supplementary_mock.h: move the Stochastic_WF mock (and its source_pw/module_stodft/sto_wf.h include) into module_stodft/test/test_sto_hsolver_pw.cpp, its only remaining user. After this, nothing under source/source_hsolver includes source_pw, source_lcao or source_hamilt, production or test. Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
mohanchen
approved these changes
Sep 30, 2026
Collaborator
|
Well done! |
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.source/changes.Linked Issue
Closes #7603
Closes #7677
Closes #7678
Closes #7679
This is the last cleanup step of the
source_hsolverdecoupling series (#7683, #7920, #7948, #7974, #8012). None of those PRs linked the issues, so they stayed open. On currentdevelop, the production code undersource/source_hsolveralready has nosource_pw,source_lcaoorsource_hamiltinclude. Only two test-side leftovers were left, and this PR removes them:source_lcaodm2rhorouted throughElecStateLCAO::dmToRho)source_pwhsolver_lcaopwno longer needshamilt_pw.h/hamilt_lcaopw.h), #8012 (HSolverPW_SDFTmoved tomodule_stodftasStoHSolverPW)test/hsolver_supplementary_mock.hstill includedsource_pw/module_stodft/sto_wf.hsource_hamiltMatrixBlock→source_base), #7948 (LCAO direct solvers take H(k)/S(k)), #7974 (solvers depend on thehsolver::HSOperator/hsolver::HSMatrixinterfaces; thehamiltside provides adapters insource_hamilt/hamilt_hs_adapter.h, injected from the ESolver)test/test_hsolver.cppstill includedsource_hamilt/hamilt.hFor #7679, the recorded design decision is the dependency inversion introduced in #7974.
source_hsolverowns the minimalHSOperator/HSMatrixinterfaces it needs, andsource_hamiltimplements them.source_hamiltis therefore not kept as a whitelisted exception.Unit Tests and/or Case Tests for my changes
python tools/03_code_analysis/agent_governance_check.py --staged. The only finding was the docs-sync reminder on the PR body, which is answered below.git grep -n -E 'source_(pw|hamilt|lcao)/' -- source/source_hsolver. The only matches left are two doc comments inhs_matrix.h/hs_operator.hthat name the adapter header. There are no#includes.MODULE_HSOLVER_base,MODULE_HSOLVER_pwandMODULE_PW_Sto_HSolver_UTs. They are left to CI.MODULE_HSOLVER_basegoes from 0 test cases (everyTEST_Fwas commented out) to 12 tests.What's changed?
Developer-facing, test-only. No production code changes.
source_hsolver/test/test_hsolver.cpp: everyTEST_Fhad been commented out, and the fixture only held ahamilt::Hamiltand aStochastic_WFthat nothing used. This PR replaces the fixture with focused tests of the free functions actually declared inhsolver.h(cal_hsolve_error,set_diagethr_ks,set_diagethr_sdft,reset_diag_ethr), which had no unit test.../hsolver.cppis now compiled intoMODULE_HSOLVER_base.source_hsolver/test/hsolver_supplementary_mock.h: theStochastic_WFmock and itssource_pw/module_stodft/sto_wf.hinclude move tosource_pw/module_stodft/test/test_sto_hsolver_pw.cpp, their only remaining user. The dead commented-out body ofinitis dropped.After this PR, nothing under
source/source_hsolver(production or test) includessource_pw,source_lcaoorsource_hamilt.Governance Notes
module_stodfttest now owns theStochastic_WFmock it uses.🤖 Generated with Claude Code