Repository navigation
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
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.
| MecMulP(0, j) += mud(ic, ir).real(); | ||
| MecMulP(3, j) += mud(ic, ir).real(); | ||
| } | ||
| // mud is DM.S with the conj-first density matrix built by |
There was a problem hiding this comment.
Non-blocking: Please write DM*S^T here, matching the header and the N,T GEMM in cal_orbMulP. For complex Hermitian overlap, the transpose is needed for mud = conj(P*S); DM*S describes a different contraction.
| dm[2] = std::conj(c[1]) * c[0]; | ||
| dm[3] = std::conj(c[1]) * c[1]; | ||
|
|
||
| // one spatial orbital, one k-point, overlap S = 1: mud = DM * S^T = DM. |
There was a problem hiding this comment.
Non-blocking: Consider a small nonzero-My case using dm_from_psi and the Output_Mulliken multiplication with a complex Hermitian overlap, checked against a direct wavefunction/Pauli expectation. This test supplies mud directly with S=I, so it cannot catch a conjugation or transpose mismatch in that interface.
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.
Reminder
AGENTS.mdanddocs/developers_guide/agent_governance.md.source/changes.Summary
Fix the incorrect sign of the y-component of noncollinear Mulliken magnetization (
nspin=4).The previous implementation produced an incorrect sign for (M_y) due to the conjugate-first convention used by the density matrix.
Problem
In the
nspin=4Mulliken implementation, the magnetization components are accumulated from[
\mathrm{mud} = \mathrm{DM}\cdot S
]
where the stored density matrix follows the conjugate-first convention:
[
\mathrm{DM}{ab}=\sum_n w_n c{n,a}^{*}c_{n,b}
]
The previous implementation used
[
M_y^{\mathrm{old}}
=-\operatorname{Im}(\mathrm{mud}{\uparrow\downarrow})
+\operatorname{Im}(\mathrm{mud}{\downarrow\uparrow})
]
which gives the opposite sign of the physical y-component.
The correct expression is
[
M_y=
\operatorname{Im}\left(
\mathrm{mud}{\uparrow\downarrow}
-\mathrm{mud}{\downarrow\uparrow}
\right)
]
The (M_x) and (M_z) components are unaffected.
Changes
nspin=4Mulliken magnetization accumulation.nspin=4accumulation logic intocollect_MW_nspin4()to enable direct unit testing.OutputMullikenSpinTest.Nspin4MyFollowsPauliConvention, covering nonzero (M_y) for several noncollinear spin directions.nspin=1andnspin=2implementations unchanged.Tests
MODULE_IO_mulliken_testtarget successfully.MODULE_IO_mulliken_testafter rebasing onto the latestdevelop: passed.git diff --check: passed.Related
This is a follow-up to the Mulliken (M_y) convention warning documented in PR #7832, which deferred the actual fix and regression test to a separate PR.