fix: Filter SIESTA pseudopotentials by system atom types#1861
Draft
fix: Filter SIESTA pseudopotentials by system atom types#1861
Conversation
Co-authored-by: njzjz <9496702+njzjz@users.noreply.github.com>
Co-authored-by: njzjz <9496702+njzjz@users.noreply.github.com>
Copilot
AI
changed the title
[WIP] Fix unnecessary assertion in Siesta input file generation
fix: Filter SIESTA pseudopotentials by system atom types
Feb 13, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
SIESTA input generation failed with
AssertionErrorwhen systems contained a subset of elements fromfp_pp_files(e.g., pure C systems when both C.psf and H.psf were provided).Changes
dpgen/generator/run.py: Filter
fp_pp_filesto match system atom types before passing tomake_siesta_input, following PWSCF pattern:dpgen/tools/relabel.py: Apply same filtering in
make_siestahelper and fix parameter passingtests/generator/test_make_fp.py: Add
TestMakeFPSIESTASubsetElementsto validate subset element handlingThe assertion
assert ntypes == len(pps)in_make_siesta_02_speciesnow receives correctly filtered pseudopotentials matching the system's atom types.Original prompt
This section details on the original issue you should resolve
<issue_title>[BUG] Un-necessary assertion ntypes < len(pps) when making siesta input files</issue_title>
<issue_description>### Bug summary
Hi!
I'm running DPGEN for systems containing element 'C' and 'H' with SIESTA as the DFT engine.
In this task, 'sys_configs' includes pure 'C' systems and systems with both 'C' and 'H'. The 'fp_pp_files = ["C.psf", "H.psf"]'. However, an unexpected error occurs:
The root reason seems to be a unnecessary assert check in dpgen/generator/lib/siesta.py:_make_siesta_02_species. The 'ntypes' is just necessary to be a subset of 'pps'.
DP-GEN Version
Version: 0.13.2.dev62+g037d6b819
Platform, Python Version, Remote Platform, etc
No response
Input Files, Running Commands, Error Log, etc.
'param.json'