Skip to content

fix(debug): remove incorrect assert for nullptr in Overlap and EKinet…#7460

Merged
mohanchen merged 1 commit into
deepmodeling:developfrom
mintleaf84:fix-debug-assert
Jun 9, 2026
Merged

fix(debug): remove incorrect assert for nullptr in Overlap and EKinet…#7460
mohanchen merged 1 commit into
deepmodeling:developfrom
mintleaf84:fix-debug-assert

Conversation

@mintleaf84

Copy link
Copy Markdown

Reminder

  • Have you linked an issue with this pull request?
  • Have you added adequate unit tests and/or case tests for your pull request?
  • Have you noticed possible changes of behavior below or in the linked issue?
  • Have you explained the changes of codes in core modules of ESolver, HSolver, ElecState, Hamilt, Operator or Psi? (ignore if not applicable)

Linked Issue

Fix #7021

Unit Tests and/or Case Tests for my changes

No additional tests required. This is a simple fix removing incorrect assert statements.

What's changed?

  • Remove assert(this->SR != nullptr) in Overlap constructor
  • Remove assert(this->hsk != nullptr) in EKinetic constructor
  • These pointers can be nullptr in normal operation (e.g., for force calculation), so the assert was incorrectly triggering when -DDEBUG_INFO=ON

Any changes of core modules? (ignore if not applicable)

No changes to core modules. Only removed incorrect assert statements in constructors

…ic constructors

Remove assert(this->SR != nullptr) in Overlap constructor and
assert(this->hsk != nullptr) in EKinetic constructor. These pointers
can be nullptr in normal operation (e.g., for force calculation),
so the assert was incorrectly triggering when DEBUG_INFO=ON.

Fixes deepmodeling#7021

@mohanchen mohanchen left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

Thanks, sounds reasonable.

@mohanchen mohanchen merged commit 33cedb4 into deepmodeling:develop Jun 9, 2026
15 checks passed
@mohanchen mohanchen added Bugs Bugs that only solvable with sufficient knowledge of DFT Refactor Refactor ABACUS codes labels Jun 9, 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.

assert when -DDEBUG_INFO=ON

2 participants