Skip to content

Fix: match spin density symmetrization with the new convention changed in #7664 - #7804

Merged
mohanchen merged 2 commits into
deepmodeling:developfrom
maki49:develop
Aug 12, 2026
Merged

mohanchen merged 2 commits into
deepmodeling:developfrom
maki49:develop

Conversation

@maki49

@maki49 maki49 commented Aug 11, 2026

Copy link
Copy Markdown
Collaborator

#7664 breaks NiO's energy (from ~ μeV to ~ meV deviation from symmetry-off) due to the out-of-sync of the convention in spin density symmetrization. This PR fix the problem.

Copilot AI lite review requested due to automatic review settings August 11, 2026 15:30

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Pull request overview

This PR aims to restore consistency between the post-#7664 Pauli/sigma_y convention used when extracting spin density components and the spin-rotation applied during reciprocal-space (rhog) spin-density symmetrization, addressing symmetry-off vs symmetry-on energy deviations (e.g., NiO).

Changes:

  • Introduces a y-channel handedness correction concept (S=diag(1,-1,1) conjugation) in psymmg_soc when building per-symmetry-operation spin-rotation matrices.
  • Adds a new SOC coupling unit test to validate that SU(2) spinor rotation + Pauli decomposition matches the SO(3) pseudovector rotation (with nonzero m_y cases).

Reviewed changes

Copilot reviewed 2 out of 2 changed files in this pull request and generated 1 comment.

File Description
source/source_estate/module_charge/symmetry_rhog.cpp Adds the intended y-channel handedness correction logic for spin-density symmetrization matrix construction (currently not applied).
source/source_cell/module_symmetry/test/symmetry_rho_soc_test.cpp Adds a coupling test that checks SU(2)-induced Pauli rotation and extracted Pauli components against spin_so3 rotation for nonzero m_y.

💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.

Comment thread source/source_estate/module_charge/symmetry_rhog.cpp
@mohanchen mohanchen added Bugs Bugs that only solvable with sufficient knowledge of DFT Refactor Refactor ABACUS codes labels Aug 12, 2026
@mohanchen

Copy link
Copy Markdown
Collaborator

Any integrate or unit tests to protect this feature?

@mohanchen
mohanchen merged commit 640e7f5 into deepmodeling:develop Aug 12, 2026
17 checks passed
AroundPeking pushed a commit to AroundPeking/abacus-develop that referenced this pull request Sep 24, 2026
Port deepmodeling/abacus-develop PR deepmodeling#7832 (f29968d)
onto the magnetic LibRPA producer baseline. Correct both density-extraction
templates and the DeltaSpin driving field. Include the prerequisite deepmodeling#7748
pauli_to_moment sign correction absent from this older baseline.

Preserve the existing cubic and hexagonal spin-rotation tests and LibRPA
exports. Adapt the upstream physical-spinor tests to the legacy filenames;
make the DeltaSpin unit test call the production measurement helper.
The old baseline has no deepmodeling#7804 yflip rotation compensation to remove.

Validation on dongfang: release MPI build, 84 C++ cases in 14 CTest targets,
12 ABF Python tests, and all three deepmodeling#7832 integration references passed with
unchanged acceptance thresholds. Separate material comparisons are retained
in workspace/symmetry/runs/20260919-abacus-msg-upstream-r1 in the GW topic.

(cherry picked from commit f29968d)
(cherry picked from commit 07d0470b1610eb44b7b6cb4a8009229f3b8b6e0f)
AroundPeking pushed a commit to AroundPeking/abacus-develop that referenced this pull request Sep 26, 2026
Port deepmodeling/abacus-develop PR deepmodeling#7832 (f29968d)
onto the magnetic LibRPA producer baseline. Correct both density-extraction
templates and the DeltaSpin driving field. Include the prerequisite deepmodeling#7748
pauli_to_moment sign correction absent from this older baseline.

Preserve the existing cubic and hexagonal spin-rotation tests and LibRPA
exports. Adapt the upstream physical-spinor tests to the legacy filenames;
make the DeltaSpin unit test call the production measurement helper.
The old baseline has no deepmodeling#7804 yflip rotation compensation to remove.

Validation on dongfang: release MPI build, 84 C++ cases in 14 CTest targets,
12 ABF Python tests, and all three deepmodeling#7832 integration references passed with
unchanged acceptance thresholds. Separate material comparisons are retained
in workspace/symmetry/runs/20260919-abacus-msg-upstream-r1 in the GW topic.

(cherry picked from commit f29968d)
(cherry picked from commit 07d0470b1610eb44b7b6cb4a8009229f3b8b6e0f)
AroundPeking pushed a commit to AroundPeking/abacus-develop that referenced this pull request Sep 27, 2026
Port deepmodeling/abacus-develop PR deepmodeling#7832 (f29968d)
onto the magnetic LibRPA producer baseline. Correct both density-extraction
templates and the DeltaSpin driving field. Include the prerequisite deepmodeling#7748
pauli_to_moment sign correction absent from this older baseline.

Preserve the existing cubic and hexagonal spin-rotation tests and LibRPA
exports. Adapt the upstream physical-spinor tests to the legacy filenames;
make the DeltaSpin unit test call the production measurement helper.
The old baseline has no deepmodeling#7804 yflip rotation compensation to remove.

Validation on dongfang: release MPI build, 84 C++ cases in 14 CTest targets,
12 ABF Python tests, and all three deepmodeling#7832 integration references passed with
unchanged acceptance thresholds. Separate material comparisons are retained
in workspace/symmetry/runs/20260919-abacus-msg-upstream-r1 in the GW topic.

(cherry picked from commit f29968d)
(cherry picked from commit 07d0470b1610eb44b7b6cb4a8009229f3b8b6e0f)
AroundPeking pushed a commit to AroundPeking/abacus-develop that referenced this pull request Sep 27, 2026
Port deepmodeling/abacus-develop PR deepmodeling#7832 (f29968d)
onto the magnetic LibRPA producer baseline. Correct both density-extraction
templates and the DeltaSpin driving field. Include the prerequisite deepmodeling#7748
pauli_to_moment sign correction absent from this older baseline.

Preserve the existing cubic and hexagonal spin-rotation tests and LibRPA
exports. Adapt the upstream physical-spinor tests to the legacy filenames;
make the DeltaSpin unit test call the production measurement helper.
The old baseline has no deepmodeling#7804 yflip rotation compensation to remove.

Validation on dongfang: release MPI build, 84 C++ cases in 14 CTest targets,
12 ABF Python tests, and all three deepmodeling#7832 integration references passed with
unchanged acceptance thresholds. Separate material comparisons are retained
in workspace/symmetry/runs/20260919-abacus-msg-upstream-r1 in the GW topic.

(cherry picked from commit f29968d)
(cherry picked from commit 07d0470b1610eb44b7b6cb4a8009229f3b8b6e0f)
AroundPeking pushed a commit to AroundPeking/abacus-develop that referenced this pull request Sep 29, 2026
Port deepmodeling/abacus-develop PR deepmodeling#7832 (f29968d)
onto the magnetic LibRPA producer baseline. Correct both density-extraction
templates and the DeltaSpin driving field. Include the prerequisite deepmodeling#7748
pauli_to_moment sign correction absent from this older baseline.

Preserve the existing cubic and hexagonal spin-rotation tests and LibRPA
exports. Adapt the upstream physical-spinor tests to the legacy filenames;
make the DeltaSpin unit test call the production measurement helper.
The old baseline has no deepmodeling#7804 yflip rotation compensation to remove.

Validation on dongfang: release MPI build, 84 C++ cases in 14 CTest targets,
12 ABF Python tests, and all three deepmodeling#7832 integration references passed with
unchanged acceptance thresholds. Separate material comparisons are retained
in workspace/symmetry/runs/20260919-abacus-msg-upstream-r1 in the GW topic.

(cherry picked from commit f29968d)
(cherry picked from commit 07d0470b1610eb44b7b6cb4a8009229f3b8b6e0f)
AroundPeking added a commit to AroundPeking/abacus-develop that referenced this pull request Sep 29, 2026
Port deepmodeling/abacus-develop PR deepmodeling#7832 (f29968d)
onto the magnetic LibRPA producer baseline. Correct both density-extraction
templates and the DeltaSpin driving field. Include the prerequisite deepmodeling#7748
pauli_to_moment sign correction absent from this older baseline.

Preserve the existing cubic and hexagonal spin-rotation tests and LibRPA
exports. Adapt the upstream physical-spinor tests to the legacy filenames;
make the DeltaSpin unit test call the production measurement helper.
The old baseline has no deepmodeling#7804 yflip rotation compensation to remove.

Validation on dongfang: release MPI build, 84 C++ cases in 14 CTest targets,
12 ABF Python tests, and all three deepmodeling#7832 integration references passed with
unchanged acceptance thresholds. Separate material comparisons are retained
in workspace/symmetry/runs/20260919-abacus-msg-upstream-r1 in the GW topic.

(cherry picked from commit f29968d)
(cherry picked from commit 07d0470b1610eb44b7b6cb4a8009229f3b8b6e0f)
AroundPeking added a commit to AroundPeking/abacus-develop that referenced this pull request Sep 30, 2026
Port deepmodeling/abacus-develop PR deepmodeling#7832 (f29968d)
onto the magnetic LibRPA producer baseline. Correct both density-extraction
templates and the DeltaSpin driving field. Include the prerequisite deepmodeling#7748
pauli_to_moment sign correction absent from this older baseline.

Preserve the existing cubic and hexagonal spin-rotation tests and LibRPA
exports. Adapt the upstream physical-spinor tests to the legacy filenames;
make the DeltaSpin unit test call the production measurement helper.
The old baseline has no deepmodeling#7804 yflip rotation compensation to remove.

Validation on dongfang: release MPI build, 84 C++ cases in 14 CTest targets,
12 ABF Python tests, and all three deepmodeling#7832 integration references passed with
unchanged acceptance thresholds. Separate material comparisons are retained
in workspace/symmetry/runs/20260919-abacus-msg-upstream-r1 in the GW topic.

(cherry picked from commit f29968d)
(cherry picked from commit 07d0470b1610eb44b7b6cb4a8009229f3b8b6e0f)
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.

3 participants