Skip to content

fix(rt): use matching spin Hamiltonians for commutator current - #8321

Merged
mohanchen merged 4 commits into
deepmodeling:developfrom
memii-x:codex/upstream-spin-current-8285-20261114
Nov 20, 2026
Merged

mohanchen merged 4 commits into
deepmodeling:developfrom
memii-x:codex/upstream-spin-current-8285-20261114

Conversation

@memii-x

@memii-x memii-x commented Nov 16, 2026 •

Copy link
Copy Markdown

Linked Issue

Fixes #8285.

What's changed?

For collinear spin calculations, the commutator current now uses the same real-space Hamiltonian as propagation for each spin channel. When both spins share a Hamiltonian, the current calculation uses that shared matrix.

Unit Tests and/or Case Tests for my changes

From tests/08_RI, bash ../integrate/Autotest.sh -a /path/to/abacus -n 4 -o 1 -j 1 -r '^rt_tddft_hse_current_spin2_up$' passed. The pre-fix binary fails the current comparison on the second output row at the existing absolute tolerance of 1e-10.

With two MPI ranks, the Si HSE case took 20.65 s at scf_thr=1e-10, 13.76 s at 1e-7, and 10.98 s at the selected 1e-6.

Governance Notes

No documentation update required. The fix preserves the existing current output format.

@ABACUS-PR-BOT ABACUS-PR-BOT left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

One conditional regression remains in out_current=2 when local-potential terms are disabled; see inline. Static source review only: governance and git diff --check passed; builds and tests were not run, and CI results were not inspected.

@ABACUS-PR-BOT ABACUS-PR-BOT left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The reported shared-H(R) defect is addressed in a0612f0; one test safeguard is noted inline. Static source review only; builds and tests were not run.

@mohanchen mohanchen added Bugs Bugs that only solvable with sufficient knowledge of DFT Refactor Refactor ABACUS codes labels Nov 17, 2026

@AsTonyshment AsTonyshment left a comment •

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Overall, the implementation looks fine to me in terms of physical correctness. However, there are some over-engineering issues (AI agents nowadays always over engineer things), particularly with the additional tests, that I'd suggest addressing before merging.

Comment thread tests/08_RI/CASES_CPU.txt Resolved
Comment thread tests/08_RI/CASES_CPU.txt Resolved

@AsTonyshment AsTonyshment left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@mohanchen
mohanchen merged commit f9e3583 into deepmodeling:develop Nov 20, 2026
19 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Bugs Bugs that only solvable with sufficient knowledge of DFT Refactor Refactor ABACUS codes

Projects

None yet

Development

Successfully merging this pull request may close these issues.

LCAO RT out_current=2 reuses one spin Hamiltonian for both channels (nspin=2)

4 participants