✨ BandsOutput: parse .dat.gnu for cumulative k-path distances#152
Merged
Conversation
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.
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.
The
.gnufile 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 fromk_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.BandsGnuParserreads the gnuplot file asnbndblank-separated blocks of(k_path_distance, eigenvalue)rows and exposesk_path_distances,eigenvalues,nbnd, andnks._BandsMappingadds a newk_path_distancesfield sourced exclusively fromgnu, and routeseigenvalues,number_of_bands, andnumber_of_kpointsthroughCoalesce("dat.…", "gnu.…")so users who only have the.gnufile can still resolve eigenvalues.BandsOutput.from_dirlocates*.dat.gnu(filtering it out of the bare-.datglob alongside.dat.rap);from_filesaccepts a newgnu=keyword.