Fix non-LCAO elecstate energy test mock - #7736
Merged
mohanchen merged 1 commit intoAug 1, 2026
Merged
Conversation
AsTonyshment
approved these changes
Aug 1, 2026
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
No upstream issue linked; this is a follow-up to the non-LCAO test regression introduced by PR #5703.
Unit Tests and/or Case Tests for my changes
MODULE_ESTATE_elecstate_energywith LCAO disabled failed with an undefined reference toelecstate::ElecState::get_dftu_energy().git diff --checkpasses.What's changed?
PR #5703 extended DFT+U to the PW basis and removed the production
__LCAOguard aroundElecState::get_dftu_energy()and its call fromcal_energies(). The unit test added by PR #2486 still defined its lightweightget_dftu_energy()replacement only under__LCAO.The failure occurs with
BUILD_TESTING=ON,ENABLE_MPI=ON, andENABLE_LCAO=OFFwhen CMake builds the standaloneMODULE_ESTATE_elecstate_energytest executable. That target compileselecstate_energy.cppbut intentionally does not link the productionelecstate_energy_terms.cppand its DFT+U dependencies. With LCAO disabled, the stale guard removed the test replacement as well, leaving the production call unresolved at link time.The production ABACUS target is unaffected because the
source_estatemodule compiles bothelecstate_energy.cppandelecstate_energy_terms.cpp.This PR makes the test replacement available in both LCAO and non-LCAO builds. It also makes both DFT+U assertions expect the replacement's
0.6contribution, matching the PW DFT+U behavior introduced by #5703. No production source or runtime behavior changes.Governance Notes