Skip to content

Fix #7556 and #7558 in pyabacus - #8021

Merged
mohanchen merged 3 commits into
deepmodeling:developfrom
mohanchen:2026-09-25-line1-3
Sep 25, 2026
Merged

mohanchen merged 3 commits into
deepmodeling:developfrom
mohanchen:2026-09-25-line1-3

Conversation

@mohanchen

@mohanchen mohanchen commented Sep 25, 2026 •

Copy link
Copy Markdown
Collaborator

Fix #7556 and #7558

Cell._save_stru() rebuilt species_dict[symbol] on every atom, resetting the species atom list each time. For multiple atoms of the same species only the last atom survived, and natom was tied to the pp_type branch instead of counting appended atoms.

Initialize each species entry only once and increment natom for every appended atom independently of pp_type. Add a regression test that appends atoms of an existing species and checks the saved STRU reloads with the full atom list.

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:

…ted species

Cell._save_stru() rebuilt species_dict[symbol] on every atom, resetting
the species atom list each time. For multiple atoms of the same species
only the last atom survived, and natom was tied to the pp_type branch
instead of counting appended atoms.

Initialize each species entry only once and increment natom for every
appended atom independently of pp_type. Add a regression test that
appends atoms of an existing species and checks the saved STRU reloads
with the full atom list.
@mohanchen mohanchen added Bugs Bugs that only solvable with sufficient knowledge of DFT Refactor Refactor ABACUS codes pyabacus ABACUS used with Python labels Sep 25, 2026
@mohanchen mohanchen changed the title Fix #7556: preserve all atoms when saving STRU with repeated species Fix #7556: preserve all atoms when saving STRU with repeated species in pyabacus Sep 25, 2026
…rlap_generator

The PyABACUS wrapper exposes rcut_max and lmax as methods, not
properties, and there is no lmax_ method. The old code treated them as
attributes, so overlap generation failed before producing matrices.

Use self.orb.rcut_max(), self.orb.lmax(), and self.orb.lmax(it).
@mohanchen mohanchen changed the title Fix #7556: preserve all atoms when saving STRU with repeated species in pyabacus Fix #7556 and #7558 in pyabacus Sep 25, 2026
Comment thread tools/02_postprocessing/rt-tddft-tools/overlap_generator.py Outdated
@mohanchen
mohanchen merged commit 3478727 into deepmodeling:develop Sep 25, 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 pyabacus ABACUS used with Python Refactor Refactor ABACUS codes

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[Code scan] Call PyABACUS RadialCollection methods correctly in overlap_generator [Code scan] Preserve all atoms when Cell saves STRU files

5 participants