Feat/issue 7726 dftu pw nspin fixes - #7744
Merged
mohanchen merged 5 commits intoAug 2, 2026
Merged
Conversation
added 3 commits
August 1, 2026 21:03
…r nspin=1 In cal_occ_pw(): - Swap the imaginary signs in the Pauli-to-spin conversion for nspin=4: index[1] (spin down-up): -i*vu_tmp[2] -> +i*vu_tmp[2] index[2] (spin up-down): +i*vu_tmp[2] -> -i*vu_tmp[2] The DFT+U vu array convention requires opposite sign from deeq_nc. - Fix weight_eu for nspin=1: 0.25 -> 1.0 nspin=1 has single occupancy, not the Pauli double-counting factor. Verified with tests/17_DS_DFTU/08 and 09: 08: -6792.33351671617 (ref -6792.33351670950, diff 6.7e-9 eV) 09: -6364.26587638707 (ref -6364.26587639017, diff 3.1e-9 eV)
815_PW_DFTU_S2_Z — nspin=2 DFT+U, matches ref -6792.33351671614 816_PW_DFTU_S4_XY — nspin=4 DFT+U, matches ref -6364.26587638708
The nspin=4 Pauli-to-spin sign swap in cal_occ_pw changes the output of all nspin=4 DFT+U PW tests, including the pre-existing 099_PW_DJ_SO whose result.ref was not updated. Regenerate its etot/force/stress references: etot -5662.3881388456420609 -> -5662.3908859903258417 force 15.774740 -> 17.965510 stress 100840.559090 -> 100582.607209 Without this, the 01_PW integrate suite fails on 099_PW_DJ_SO (etot dev 2.7e-3 eV, force dev -2.19, stress dev 258).
Commit b95f433 on develop removed the automatic nspin=4 reset when noncolin/lspinorb is enabled, instead requiring explicit nspin=4. Since the PR does not touch read_input_item_elec_stru.cpp, the CI merge uses develop's validation code, causing ABACUS to quit with: nspin must be 4 when noncolin or lspinorb is enabled.
mohanchen
approved these changes
Aug 2, 2026
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.Linked Issue
Fix #
Unit Tests and/or Case Tests for my changes
What's changed?
Governance Notes