Skip to content

Feat/issue 7726 dftu pw nspin fixes - #7744

Merged
mohanchen merged 5 commits into
deepmodeling:developfrom
dyzheng:feat/issue-7726-dftu-pw-nspin-fixes
Aug 2, 2026
Merged

Feat/issue 7726 dftu pw nspin fixes#7744
mohanchen merged 5 commits into
deepmodeling:developfrom
dyzheng:feat/issue-7726-dftu-pw-nspin-fixes

Conversation

@dyzheng

@dyzheng dyzheng commented Aug 1, 2026

Copy link
Copy Markdown
Collaborator

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

Fix #

Unit Tests and/or Case Tests for my changes

  • Commands run:
  • Result summary:
  • Checks not run, with reason:

What's changed?

  • Example: brief summary of the user-visible or developer-facing change.

Governance Notes

  • INPUT/docs changes:
  • Core module impact:
  • Exceptions requested:

dyzheng 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
@dyzheng
dyzheng requested a review from mohanchen August 1, 2026 13:36
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).
@mohanchen mohanchen added Bugs Bugs that only solvable with sufficient knowledge of DFT DFT+U Issues related to DFT plus U function Refactor Refactor ABACUS codes labels Aug 2, 2026
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
mohanchen merged commit 0797d01 into deepmodeling:develop Aug 2, 2026
17 checks passed
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 DFT+U Issues related to DFT plus U function Refactor Refactor ABACUS codes

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants