Skip to content

Fix(dftu): write dm_onsite.txt format matching read_occup_m parser - #7828

Merged
mohanchen merged 1 commit into
deepmodeling:developfrom
dyzheng:fix/dftu-dm-onsite-format
Aug 18, 2026
Merged

Fix(dftu): write dm_onsite.txt format matching read_occup_m parser#7828
mohanchen merged 1 commit into
deepmodeling:developfrom
dyzheng:fix/dftu-dm-onsite-format

Conversation

@dyzheng

@dyzheng dyzheng commented Aug 17, 2026

Copy link
Copy Markdown
Collaborator

write_occup_m emits tokens like "Atom=1" (no space after '='), but read_occup_m reads with >> and strcmp against "Atom=". The mismatch causes NSCF runs reading dm_onsite.txt to fail with "WRONG IN READING LOCAL OCCUPATION NUMBER MATRIX FROM Plus_U FILE".

Add a space after '=' for Atom, L, ORBITAL, and spin tokens so the written format matches what read_occup_m expects. Verified with the examples/19_dftu/01_lcao_NiO DFT+U case: SCF converges and the subsequent NSCF step completes successfully.

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:

write_occup_m emits tokens like "Atom=1" (no space after '='), but
read_occup_m reads with >> and strcmp against "Atom=". The mismatch
causes NSCF runs reading dm_onsite.txt to fail with
"WRONG IN READING LOCAL OCCUPATION NUMBER MATRIX FROM Plus_U FILE".

Add a space after '=' for Atom, L, ORBITAL, and spin tokens so the
written format matches what read_occup_m expects. Verified with the
examples/19_dftu/01_lcao_NiO DFT+U case: SCF converges and the
subsequent NSCF step completes successfully.
@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 18, 2026
@mohanchen
mohanchen merged commit fde7e06 into deepmodeling:develop Aug 18, 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