Skip to content

Fix undefined basis variable in interface workflow (#7571) - #7878

Open
mohanchen wants to merge 2 commits into
deepmodeling:developfrom
mohanchen:20260829-issue7571
Open

Fix undefined basis variable in interface workflow (#7571)#7878
mohanchen wants to merge 2 commits into
deepmodeling:developfrom
mohanchen:20260829-issue7571

Conversation

@mohanchen

Copy link
Copy Markdown
Collaborator

Summary

Fixes #7571

The interface workflow (wannier-interface job) defines a basis key in the build matrix, but the "Create mock data & patch script" step never exported it to the step environment. The Python heredoc in that step references basis directly, so each matrix job fails with NameError: name 'basis' is not defined before any mock data is generated.

Changes

  • Add BASIS: ${{ matrix.basis }} to the step env
  • Read basis = os.environ["BASIS"] inside the heredoc, matching the existing SCRIPT/PREFIX pattern

Verification

  • YAML syntax check passed: python3 -c "import yaml; yaml.safe_load(open('.github/workflows/interface.yml'))"
  • Diff is +2 lines only
  • Note: this workflow is workflow_dispatch only, so it is not triggered by push/PR events; a manual dispatch run is needed to fully verify the fix

The "Create mock data & patch script" step referenced `basis` inside
the Python heredoc without defining it: the matrix key `basis` was
never exported to the step environment, so the step failed with
"NameError: name 'basis' is not defined" before any mock data was
generated.

Pass matrix.basis through the BASIS environment variable and read it
in the heredoc, matching the existing SCRIPT/PREFIX pattern.
@mohanchen mohanchen added the Compile & CICD & Docs & Dependencies Issues related to compiling ABACUS label Aug 29, 2026
@mohanchen
mohanchen requested a review from Critsium-xy August 29, 2026 09:34
Document the upstream repo/issues/PR links and two workflow facts:
upstream PRs are opened from personal fork branches, and
workflow_dispatch-only workflows cannot be verified by PR CI.

@Critsium-xy Critsium-xy 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.

The two-line BASIS fix is correct and matches the existing SCRIPT/PREFIX pattern; basis was the only undefined name in the heredoc. But the workflow still fails on all three matrix jobs after this change. I extracted the heredoc and ran it locally against each matrix entry.

1. example_advance.py does not exist (blocks the third job)

.github/workflows/interface.yml:27 sets script: example_advance.py, but the file is interfaces/Wannier90_interface/examples_python/example_advanced.py.

with open(script) as f:
FileNotFoundError: [Errno 2] No such file or directory: 'example_advance.py'

This crashes in the same step, five lines before the basis reference this PR fixes, so the advance (LCAO) job never reaches the fixed code. prefix: Bi2Se3_advanced is already correct and matches BASE_DIR in the script.

2. Mock wannier90.nnkp does not match parse_nnkp (blocks the other two jobs)

With basis fixed, basic and pw complete the mock step, then fail in Run … — dryrun:

>>> Step 2: Preparing ABACUS NSCF input for Wannier90...
[INPUT ERROR] No k-points found in Bi2Se3_pw/wannier/wannier90.nnkp.
              Check that the file is a valid wannier90.nnkp.

parse_nnkp (abacusw90/io_utils.py:147) reads k-points between begin kpoints and end kpoints — the same format io_utils.py:121 writes. The mock generator emits a different bare-numeric layout with no delimiters (grep -ci "begin kpoints" returns 0), so kpoints is empty and ValueError is raised. DRY RUN COMPLETE is never printed and Check dryrun completion banner exits 1.

The NameError was the first of several blockers; this workflow appears never to have passed. Either fix both items here, or state in the PR body that the workflow still fails at step2 and open a follow-up issue.

@Critsium-xy Critsium-xy 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.

Two non-blocking issues in the same mock block, worth folding into this PR.

3. pw branch assigns Bi's pseudopotential to Se

.github/workflows/interface.yml:100:

Bi  208.980  Bi_pbe_fr.upf
Se   78.960  Bi_pbe_fr.upf     # should be Se_pbe_fr.upf

The lcao branch (line 108) is correct, and line 183 already creates Se_pbe_fr.upf. This branch was unreachable before — the basis fix activates it for the first time, so it is worth correcting here.

4. Mock nnkp values are internally inconsistent

In the same block: num_bands = 20, num_exclude_bands = 20, num_wann = 30. num_wann exceeds num_bands while every band is excluded. Further evidence the mock was never validated against the real format; fix alongside item 2.


Scoped to issue #7571 (plumb matrix.basis into the heredoc), this PR is correct and can close it. It should not be described as making the interface workflow pass.

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

Labels

Compile & CICD & Docs & Dependencies Issues related to compiling ABACUS

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[Code scan] Pass matrix.basis into the interface workflow heredoc

2 participants