Skip to content

BandsOutput: parse .dat.gnu for cumulative k-path distances#152

Merged
mbercx merged 1 commit into
mainfrom
new/parse-gnu
May 8, 2026
Merged

BandsOutput: parse .dat.gnu for cumulative k-path distances#152
mbercx merged 1 commit into
mainfrom
new/parse-gnu

Conversation

@mbercx
Copy link
Copy Markdown
Member

@mbercx mbercx commented May 8, 2026

The .gnu file written by bands.x is the natural source for the x-axis of a band-structure plot: cumulative k-path distance per k-point. Without parsing it, users have to construct that distance manually from k_points, which is tedious and error-prone — especially when the path contains discontinuities, which need to be handled explicitly to avoid distorting the x-axis.

BandsGnuParser reads the gnuplot file as nbnd blank-separated blocks of (k_path_distance, eigenvalue) rows and exposes k_path_distances, eigenvalues, nbnd, and nks. _BandsMapping adds a new k_path_distances field sourced exclusively from gnu, and routes eigenvalues, number_of_bands, and number_of_kpoints through Coalesce("dat.…", "gnu.…") so users who only have the .gnu file can still resolve eigenvalues.

BandsOutput.from_dir locates *.dat.gnu (filtering it out of the bare-.dat glob alongside .dat.rap); from_files accepts a new gnu= keyword.

The `.gnu` file written by bands.x is the natural source for the x-axis of a
band-structure plot: cumulative k-path distance per k-point. Without parsing it,
users have to construct that distance manually from `k_points`, which is tedious
and error-prone — especially when the path contains discontinuities, which need
to be handled explicitly to avoid distorting the x-axis.

`BandsGnuParser` reads the gnuplot file as `nbnd` blank-separated blocks of
`(k_path_distance, eigenvalue)` rows and exposes `k_path_distances`,
`eigenvalues`, `nbnd`, and `nks`. `_BandsMapping` adds a new `k_path_distances`
field sourced exclusively from `gnu`, and routes `eigenvalues`,
`number_of_bands`, and `number_of_kpoints` through `Coalesce("dat.…", "gnu.…")`
so users who only have the `.gnu` file can still resolve eigenvalues.

`BandsOutput.from_dir` locates `*.dat.gnu` (filtering it out of the bare-`.dat`
glob alongside `.dat.rap`); `from_files` accepts a new `gnu=` keyword.
@mbercx mbercx merged commit feb1437 into main May 8, 2026
5 checks passed
@mbercx mbercx deleted the new/parse-gnu branch May 8, 2026 10:12
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.

1 participant