Commit 45e8bd4
fix(outputs.py): handle missing trailing newline in ICOHPLIST.lobster (#4350)
* fix(outputs.py): handle missing trailing newline in ICOHPLIST.lobster
LOBSTER 5.1.1 sometimes produces an ICOHPLIST.lobster file without a trailing
newline, which causes the Icohplist parser to miscount bond entries (e.g., 1079 vs. 1080).
This commit updates the file-reading logic in Icohplist.__init__ to use splitlines()
and filters out any blank lines, ensuring that only valid, non-empty lines are parsed.
This change prevents the ValueError ("COHPCAR and ICOHPLIST do not fit together")
and aligns the bond count with COHPCAR.lobster.
Ref: See related issue in lobsterpy (#389) for additional context.
Signed-off-by: Ali Hussain Umar Bhatti <65511923+alibh95@users.noreply.github.com>
* pre-commit auto-fixes
* Update outputs.py
* Add test_missing_trailing_newline
* Robust header detection and version parsing in Icohplist
- Strip only trailing blank lines so a missing final newline still works
- Compute header length dynamically (skip title and optional spin‐line)
- Determine LOBSTER version by column count (6→2.2.1, 8→3.1.1, 9→5.1.0)
- Preserve non‐orbitalwise LCFO entries (fixes length mismatch for non-orbitalwise LCFO lists)
---------
Signed-off-by: Ali Hussain Umar Bhatti <65511923+alibh95@users.noreply.github.com>
Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
Co-authored-by: Shyue Ping Ong <shyuep@users.noreply.github.com>1 parent 9dfe704 commit 45e8bd4
2 files changed
Lines changed: 59 additions & 21 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
405 | 405 | | |
406 | 406 | | |
407 | 407 | | |
408 | | - | |
409 | | - | |
410 | | - | |
411 | | - | |
412 | | - | |
413 | | - | |
414 | | - | |
415 | | - | |
416 | | - | |
417 | | - | |
418 | | - | |
419 | | - | |
420 | | - | |
421 | | - | |
422 | | - | |
423 | | - | |
424 | | - | |
425 | | - | |
| 408 | + | |
| 409 | + | |
| 410 | + | |
| 411 | + | |
| 412 | + | |
| 413 | + | |
| 414 | + | |
| 415 | + | |
| 416 | + | |
| 417 | + | |
| 418 | + | |
| 419 | + | |
| 420 | + | |
| 421 | + | |
| 422 | + | |
| 423 | + | |
| 424 | + | |
| 425 | + | |
| 426 | + | |
| 427 | + | |
| 428 | + | |
| 429 | + | |
| 430 | + | |
| 431 | + | |
| 432 | + | |
| 433 | + | |
| 434 | + | |
| 435 | + | |
| 436 | + | |
426 | 437 | | |
427 | 438 | | |
428 | 439 | | |
| |||
587 | 598 | | |
588 | 599 | | |
589 | 600 | | |
| 601 | + | |
| 602 | + | |
| 603 | + | |
| 604 | + | |
590 | 605 | | |
591 | 606 | | |
592 | 607 | | |
| |||
1720 | 1735 | | |
1721 | 1736 | | |
1722 | 1737 | | |
1723 | | - | |
| 1738 | + | |
| 1739 | + | |
| 1740 | + | |
| 1741 | + | |
| 1742 | + | |
| 1743 | + | |
1724 | 1744 | | |
1725 | 1745 | | |
1726 | 1746 | | |
| |||
2333 | 2353 | | |
2334 | 2354 | | |
2335 | 2355 | | |
2336 | | - | |
| 2356 | + | |
2337 | 2357 | | |
2338 | 2358 | | |
2339 | 2359 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
3 | 3 | | |
4 | 4 | | |
5 | 5 | | |
| 6 | + | |
6 | 7 | | |
7 | 8 | | |
8 | 9 | | |
| |||
1955 | 1956 | | |
1956 | 1957 | | |
1957 | 1958 | | |
1958 | | - | |
| 1959 | + | |
1959 | 1960 | | |
1960 | 1961 | | |
1961 | 1962 | | |
| |||
2171 | 2172 | | |
2172 | 2173 | | |
2173 | 2174 | | |
| 2175 | + | |
| 2176 | + | |
| 2177 | + | |
| 2178 | + | |
| 2179 | + | |
| 2180 | + | |
| 2181 | + | |
| 2182 | + | |
| 2183 | + | |
| 2184 | + | |
| 2185 | + | |
| 2186 | + | |
| 2187 | + | |
| 2188 | + | |
| 2189 | + | |
| 2190 | + | |
| 2191 | + | |
2174 | 2192 | | |
2175 | 2193 | | |
2176 | 2194 | | |
| |||
0 commit comments