Repository navigation
Fix: correct My sign in noncollinear Mulliken magnetism - #8250
Merged
Merged
Conversation
Correct the nspin=4 Mulliken My sign for the conj-first density matrix convention. Add a regression test covering nonzero My for several noncollinear spin directions. Keep the nspin=1/2 paths unchanged.
ABACUS-PR-BOT
left a comment
Collaborator
There was a problem hiding this comment.
The My sign now matches the conj-first density matrix and the production overlap contraction. No new implementation defect found. Static review only; no build or runtime tests were run.
Non-blocking: Please record the exact configure/build and test commands, including the command or sign-revert procedure used to check the old-sign failure.
Corrected comment to reflect the proper matrix operation in the code.
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.Summary
Fix the incorrect sign of the y-component of Mulliken magnetization (
My) for noncollinear calculations (nspin=4).The previous implementation used a sign convention inconsistent with the conjugate-first density matrix representation and Pauli-matrix decomposition in ABACUS.
The corrected expression is:
My = Im(mud_ud - mud_du)Previously:
My_old = -Im(mud_ud) + Im(mud_du)Changes
Mysign fornspin=4.collect_MW_nspin4().Mx,Mz, and thenspin=1/2paths unchanged.Verification
Unit Tests
The Mulliken unit tests passed, including the new regression test
OutputMullikenSpinTest.Nspin4MyFollowsPauliConvention.Verification command:
ctest --test-dir build-test -R MODULE_IO_mulliken_test --output-on-failureResult: 1/1 CTest target passed.
Integration Tests
Two independent ABACUS versions were compiled and compared:
0223bfeb0e2a8728f0OMP_NUM_THREADS=1The converged noncollinear Fe example (
examples/04_noncollinear/01_Fe_noncollinear) was tested with initial magnetization along +y andout_mul 1.SCF converged in 11 iterations with final DRHO =
8.2125e-06.Myagrees with the prescribed magnetization direction.Mx,Mz, atomic charges, and total energy remain unchanged.Result: PASS
The existing
tests/17_DS_DFTU/02_LCAO_SPIN_S4_XYZcase was also tested. It confirmed the exactMysign reversal with unchanged other quantities, but did not reach SCF convergence due to its existing numerical stability issue.Conclusion
The Mulliken
Mysign correction is verified by unit tests and a converged noncollinear Fe integration calculation. The fix affects only the reportedMycomponent and does not alter the SCF calculation.No automated integration regression case was added.