Skip to content

Fix error when empty lines are present before "ATOMIC_POSITIONS" in pw.in input file#6

Open
Shibu778 wants to merge 1 commit intowest-code-development:masterfrom
Shibu778:bug_fix
Open

Fix error when empty lines are present before "ATOMIC_POSITIONS" in pw.in input file#6
Shibu778 wants to merge 1 commit intowest-code-development:masterfrom
Shibu778:bug_fix

Conversation

@Shibu778
Copy link

Description:
This pull request adds a condition to handle empty lines when parsing the pw.in input file. Specifically, the code now checks if a line is not empty before attempting to access its first element, preventing an error when empty lines are encountered before the "ATOMIC_POSITIONS" section.
The updated condition is:

if line.split() and line.split()[0] == "ATOMIC_POSITIONS":

This ensures that the script processes "ATOMIC_POSITIONS" correctly even if there are blank lines in the input, improving robustness and preventing potential crashes during parsing.

@vyu16
Copy link
Contributor

vyu16 commented Aug 12, 2025

Thanks for reporting this and for the fix! We have replaced this line and the preceding line with

if line.strip().startswith("ATOMIC_POSITIONS"):

The code now works correctly for pw.in with empty lines. This fix will be available in the next release of WEST.

@Shibu778
Copy link
Author

Thanks.

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

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants