Skip to content

Fix ASE STRU parser KeyError on LATTICE_PARAMETER block - #8019

Merged
mohanchen merged 1 commit into
deepmodeling:developfrom
mohanchen:2026-09-25-line1
Sep 25, 2026
Merged

mohanchen merged 1 commit into
deepmodeling:developfrom
mohanchen:2026-09-25-line1

Conversation

@mohanchen

Copy link
Copy Markdown
Collaborator

fix #7555

The ASE interface read_stru checked for the LATTICE_PARAMETER block but then indexed blocks['LATTICE_PARAMETERS'] (extra 'S'), so STRU files using LATTICE_PARAMETER instead of LATTICE_VECTORS raised a KeyError (issue #7555). Read from blocks['LATTICE_PARAMETER'][0] instead, since block values are lists of lines. Add a unit test covering a STRU with LATTICE_PARAMETER and no LATTICE_VECTORS.

Verified: python3 -m unittest abacuslite.io.generalio.TestAbacusCalculatorIOUtil -v (10 tests OK, 2 pre-existing skips)

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:

The ASE interface read_stru checked for the LATTICE_PARAMETER block but
then indexed blocks['LATTICE_PARAMETERS'] (extra 'S'), so STRU files
using LATTICE_PARAMETER instead of LATTICE_VECTORS raised a KeyError
(issue deepmodeling#7555). Read from blocks['LATTICE_PARAMETER'][0] instead, since
block values are lists of lines. Add a unit test covering a STRU with
LATTICE_PARAMETER and no LATTICE_VECTORS.

Verified: python3 -m unittest abacuslite.io.generalio.TestAbacusCalculatorIOUtil -v
(10 tests OK, 2 pre-existing skips)
@mohanchen
mohanchen requested a review from kirk0830 September 25, 2026 02:58
@mohanchen mohanchen added Bugs Bugs that only solvable with sufficient knowledge of DFT Refactor Refactor ABACUS codes Interfaces Interfaces with other packages labels Sep 25, 2026

@kirk0830 kirk0830 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.

LGTM, this is a not covered use case in previous implementation, thanks for making the ASE interface more robust!

@mohanchen
mohanchen merged commit fb9f03a 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 Interfaces Interfaces with other packages Refactor Refactor ABACUS codes

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[Code scan] Read LATTICE_PARAMETER blocks consistently in STRU parsers

2 participants