Fix: Fix missing EXX contribution in RT-TDDFT evolution steps#7344
Merged
Conversation
mohanchen
approved these changes
May 15, 2026
Collaborator
|
Nice fix! |
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
Fix #7068.
Description
When running RT-TDDFT with hybrid functionals (EXX), a severe, unphysical energy jump (specifically in
eband) occurs between the initial ground-state SCF and the first electron evolution step (istep = 1).The root cause of this bug lies in the
OperatorEXX::contributeHkfunction. In ABACUS, thetwo_level_stepflag is reset to0at the beginning of each new ionic or evolution step. Originally, the code incontributeHkcontained the following condition:Because RT-TDDFT uses
Add_Hexx_Type::k(and thus relies oncontributeHkto add the EXX matrix to the Hamiltonian), this condition erroneously triggered areturnfor allistep >= 1evolution steps. As a result, the EXX contribution was completely omitted from the Hamiltonian foristep >= 1, leading to a catastrophic energy jump.A similar issue in KSDFT BOMD (which uses
OperatorEXX::contributeHR) was previously identified and fixed in PR #5403 (by Yuyang Ji @1041176461) by restricting this skip condition to the first step (this->istep == 0). However,contributeHkwas overlooked during that fix.Changes made
OperatorEXX::contributeHkto includethis->istep == 0:This ensures that the two-level SCF skip logic (converging pure GGA before turning on EXX) is strictly limited to the initial SCF phase (
istep = 0). For all subsequent RT-TDDFT evolution steps (istep >= 1), the EXX contribution is correctly calculated and added to the Hamiltonian without being skipped.Testing
Acknowledgments
Special thanks to Xinyuan Liang @xuan112358 for her valuable help in tracking down the root cause of this bug!