Skip to content

Fix(dftu-pw): fix DFT+U for PW basis (nspin=1/2/4) and occupation mat… - #7733

Open
dyzheng wants to merge 2 commits into
deepmodeling:developfrom
dyzheng:feat/issue-7726-dftu-pw-nspin-fixes
Open

Fix(dftu-pw): fix DFT+U for PW basis (nspin=1/2/4) and occupation mat…#7733
dyzheng wants to merge 2 commits into
deepmodeling:developfrom
dyzheng:feat/issue-7726-dftu-pw-nspin-fixes

Conversation

@dyzheng

@dyzheng dyzheng commented Jul 31, 2026

Copy link
Copy Markdown
Collaborator

…rix mixing

  • Relax DFT+U nspin validation to support nspin=1/2/4 for PW basis
  • Encapsulate Plus_U with typed accessors (get/set_locale, get_orbital_corr, get_hubbard_u, is_locale_initialized, mark_locale_dirty, enable_mixing)
  • Rewrite cal_occ_pw for nspin=1/2/4 with correct becp indexing
  • Add DFT+U occupation matrix mixing via Broyden method in Charge_Mixing
  • Fix DFT+U locale double-counting when kpar>1
  • Fix spin-channel selection: use isk[ik] instead of ik>=nk/2 in cal_occ_pw
  • Extract setup_pw_dftu_indices() from cal_ps_dftu
  • Propagate ld_psi for correct GEMM strides when ngk[ik] < npwx
  • Restructure eff_pot_pw layout: nspin=2 uses split spin_up|spin_down
  • Add get_eff_pot_pw_spin(isk) for nspin-aware access
  • Add becp_ready caching in OnsiteProjector
  • Update dftu_lcao.cpp for new Plus_U accessor interface
  • Add unit tests for PW DFT+U (dftu_pw_test.cpp)
  • Update dftu_io.cpp to use new accessors and onsite.dm format

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:

…rix mixing

- Relax DFT+U nspin validation to support nspin=1/2/4 for PW basis
- Encapsulate Plus_U with typed accessors (get/set_locale, get_orbital_corr, get_hubbard_u, is_locale_initialized, mark_locale_dirty, enable_mixing)
- Rewrite cal_occ_pw for nspin=1/2/4 with correct becp indexing
- Add DFT+U occupation matrix mixing via Broyden method in Charge_Mixing
- Fix DFT+U locale double-counting when kpar>1
- Fix spin-channel selection: use isk[ik] instead of ik>=nk/2 in cal_occ_pw
- Extract setup_pw_dftu_indices() from cal_ps_dftu
- Propagate ld_psi for correct GEMM strides when ngk[ik] < npwx
- Restructure eff_pot_pw layout: nspin=2 uses split spin_up|spin_down
- Add get_eff_pot_pw_spin(isk) for nspin-aware access
- Add becp_ready caching in OnsiteProjector
- Update dftu_lcao.cpp for new Plus_U accessor interface
- Add unit tests for PW DFT+U (dftu_pw_test.cpp)
- Update dftu_io.cpp to use new accessors and onsite.dm format
@mohanchen mohanchen added Bugs Bugs that only solvable with sufficient knowledge of DFT Refactor Refactor ABACUS codes labels Aug 1, 2026
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.

2 participants