Skip to content

Fix and harden abacuslite ASE interface#7588

Open
QuantumMisaka wants to merge 4 commits into
deepmodeling:developfrom
QuantumMisaka:feat/abacuslite
Open

Fix and harden abacuslite ASE interface#7588
QuantumMisaka wants to merge 4 commits into
deepmodeling:developfrom
QuantumMisaka:feat/abacuslite

Conversation

@QuantumMisaka

Copy link
Copy Markdown
Collaborator

Summary

This PR hardens the vendored abacuslite ASE interface and ports the ATST-Tools fixes that are suitable for upstream ABACUS:

  • Preserve numbered backups without clobbering existing *.bak.N files and ignore non-canonical suffixes.
  • Remove unsupported dipole from the advertised ASE implemented properties.
  • Detect contradictory property-derived and user-provided ABACUS keywords.
  • Preserve first-occurrence species order when writing STRU files and map FixAtoms / FixCartesian ASE constraints to ABACUS mobility flags.
  • Make legacy band parsing tolerate non-band rows while preventing cross-k-point block misreads, and keep magmom result reordering consistent with atoms/forces.

Fixes #7540
Fixes #7544
Fixes #7546

Tests

Run from interfaces/ASE_interface/abacuslite after python3 -m pip install -e ../ --no-deps:

  • python3 ./io/generalio.py -v
  • python3 ./io/legacyio.py -v
  • python3 ./io/latestio.py -v
  • python3 ./utils/ksampling.py -v
  • python3 core.py TestAbacusCalculator.test_version_number_check TestAbacusCalculator.test_property_keywords_reject_conflicting_user_parameters TestAbacusCalculator.test_property_keywords_reject_conflicting_properties TestAbacusCalculator.test_dipole_property_is_not_implemented -v
  • git diff --check -- interfaces/ASE_interface/abacuslite/core.py interfaces/ASE_interface/abacuslite/io/generalio.py interfaces/ASE_interface/abacuslite/io/legacyio.py interfaces/ASE_interface/abacuslite/io/latestio.py

The local shell did not have abacus or mpirun in PATH, so the full calculator execution test remains covered by upstream CI.

@QuantumMisaka QuantumMisaka requested a review from kirk0830 July 3, 2026 15:16
@kirk0830

kirk0830 commented Jul 4, 2026

Copy link
Copy Markdown
Collaborator

noted.
I have had a quick scan on your changes. Once all tests are passed, I will review your PR .

Regards.

# we should raise a ValueError
param_cache_ = {}
def normalize_keyword_value(value):
if isinstance(value, bool):

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.

I don't understand what happens here. Does it happen that the 'True' or 'true' string is treated as an iterable which yields 'T r u e' or 't r u e' eventually in ABACUS INPUT file?

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

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

The string case remains scalar: "true" is not treated as an iterable and is not split into characters.

I simplified the comparison helper in 762919f so it matches the INPUT writer behavior. Python bool values are normalized to ABACUS switch values "1"/"0"; list/tuple/set values are compared by joining their plain string elements; scalar strings stay unchanged. I also added regression coverage for bool equivalence, false bool conflicts, scalar string handling, and iterable comparison semantics.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

2 participants