Skip to content

Fix bug (deltaspin): restore LCAO spin rotation invariance - #7914

Open
Tao-Xia wants to merge 3 commits into
deepmodeling:developfrom
Tao-Xia:codex/fix-deltaspin-spin-rotation
Open

Fix bug (deltaspin): restore LCAO spin rotation invariance#7914
Tao-Xia wants to merge 3 commits into
deepmodeling:developfrom
Tao-Xia:codex/fix-deltaspin-spin-rotation

Conversation

@Tao-Xia

@Tao-Xia Tao-Xia commented Sep 6, 2026

Copy link
Copy Markdown

Reminder

  • I have read AGENTS.md and docs/developers_guide/agent_governance.md.
  • I have linked an issue or explained why this PR does not need one.
  • I have added adequate unit tests and/or case tests, or explained why not.
  • I have listed the exact verification commands run and their results.
  • I have described user-visible behavior changes, including INPUT parameter changes.
  • I have explained core-module impact for ESolver, HSolver, ElecState, Hamilt, Operator, Psi, or other source/ changes.
  • I have requested any needed governance exception below.

Linked Issue

Fixes #7913

Unit Tests and/or Case Tests for my changes

  • Commands run:
    • cmake --build build-elpa-cpu --target deltaspin_core_test MODULE_HSOLVER_LCAO abacus_basic_para -j 12
    • build-elpa-cpu/source/source_lcao/module_deltaspin/test/deltaspin_core_test
    • From source/source_hsolver/test: build-elpa-cpu/source/source_hsolver/test/MODULE_HSOLVER_LCAO
    • From the same directory: mpirun -np 4 build-elpa-cpu/source/source_hsolver/test/MODULE_HSOLVER_LCAO --gtest_filter='DiagoElpaComplexTest.UsesAuthoritativeUpperTriangle:DiagoTest/DiagoKPointsTest.LCAO/0'
    • Two 12-rank bcc-Fe LCAO DeltaSpin integration runs with equivalent x and y target moments, no SOC, and ks_solver genelpa.
  • Result summary:
    • DeltaSpin: 22/22 tests passed.
    • LCAO eigensolver: 7/7 single-rank tests passed; 2/2 selected 4-rank tests passed.
    • Both new regression tests were also checked against the old behavior and failed as intended.
    • bcc-Fe x/y total energies differ by only 1.82e-8 eV; both target moments converge with transverse residuals of order 1e-6 mu_B.
  • Checks not run, with reason:
    • Full repository test suite was not run because the change is confined to the complex genelpa transform and DeltaSpin coefficient mapping; the focused module tests and end-to-end integration runs exercise both paths.

What's changed?

  • Use PZHEMM with the authoritative upper triangle when the complex custom ELPA solver forms the generalized Hamiltonian. This prevents stale lower-triangle entries from entering the eigensolve without allocating an extra full matrix.
  • Define the Cartesian-Pauli-to-spinor conversion once and use it in the LCAO DeltaSpin operator.
  • Add an invariant test requiring <psi | lambda dot sigma | psi> = lambda dot M, including the sign-sensitive y channel.
  • Add a complex genelpa regression that deliberately corrupts the non-authoritative lower triangle and compares with the upper-triangle LAPACK reference.

There are no INPUT parameter or serialized-data changes. The user-visible correction is restored non-SOC spin-rotation invariance for LCAO DeltaSpin with genelpa.

Governance Notes

  • INPUT/docs changes: none; no user-facing option or default changes.
  • Core module impact: HSolver changes one complex generalized-transform kernel from general to Hermitian distributed multiplication; OperatorLCAO uses a shared DeltaSpin Pauli conversion. ESolver, ElecState, and Psi interfaces are unchanged.
  • Exceptions requested: none.

@dyzheng dyzheng 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,This PR may resolve the numerical instability issue in non‑collinear spin calculations with the LCAO basis set. Thank you for your submission.

@mohanchen mohanchen added Bugs Bugs that only solvable with sufficient knowledge of DFT Refactor Refactor ABACUS codes labels Sep 6, 2026
@mohanchen mohanchen changed the title fix(deltaspin): restore LCAO spin rotation invariance Fx bug (deltaspin): restore LCAO spin rotation invariance Sep 6, 2026
@mohanchen mohanchen changed the title Fx bug (deltaspin): restore LCAO spin rotation invariance Fix bug (deltaspin): restore LCAO spin rotation invariance Sep 6, 2026
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.

bug(deltaspin): non-SOC LCAO spin rotation invariance breaks with genelpa

3 participants