Skip to content

Dev vasp kpointsopt - #3

Merged
the-hampel merged 14 commits into
TRIQS:unstablefrom
the-hampel:dev_vasp_kpointsopt
Aug 26, 2026
Merged

the-hampel merged 14 commits into
TRIQS:unstablefrom
the-hampel:dev_vasp_kpointsopt

Conversation

@the-hampel

Copy link
Copy Markdown
Member

Convert KPOINTS_OPT/LOCPROJ_OPT data (along kpath) into dft_bands_input as it is possible for Wien2k and Elk. Auto-detect KPOINTS_OPT data during convert_dft_input.

Add dedicated SVO bands tests, and include minimal reproducibility inputs (INCAR/POSCAR/KPOINTS/KPOINTS_OPT/plo.cfg plus vaspout.h5).

Warning: this is based on a non released VASP version. So reproducibility of the provided vaspout.h5 is limited.

the-hampel added a commit to TRIQS/dft_tools that referenced this pull request May 26, 2026
see TRIQS/dftkit#3 for more information.

- add test for spaghettis for vasp
- add documentation for new vasp bands converter feature
the-hampel added a commit to TRIQS/dft_tools that referenced this pull request Jun 19, 2026
see TRIQS/dftkit#3 for more information.

- add test for spaghettis for vasp
- add documentation for new vasp bands converter feature
@harrisonlabollita

Copy link
Copy Markdown
Collaborator

Hi @the-hampel, thanks for this PR! This is a nice feature. While we are at, should we also add the high-symmetry path labels and x-ticks to the converter readers? For example, in Wien2k, the high-symmetry labels and high-symmetry points are printed at the end of the case.outband file. Our converters could be upgraded to read this and store in the hdf5. The user can then read data and metadata from the hdf5 file when making their plot. What do you think?

@the-hampel

Copy link
Copy Markdown
Member Author

Hi @harrisonlabollita , yes that might be a good idea. Problem is that in VASP this is optional. A kpath is specified in the KPOINTS or KPOINTS_OPT file and might look like this:

k-points for bandstructure using Γ–X–M–Γ–R
100
line
reciprocal
  0.00000000   0.00000000   0.00000000 GAMMA
  0.00000000   0.50000000   0.00000000 X

  0.00000000   0.50000000   0.00000000 X
  0.50000000   0.50000000   0.00000000 M

  0.50000000   0.50000000   0.00000000 M
  0.00000000   0.00000000   0.00000000 GAMMA

  0.00000000   0.00000000   0.00000000 GAMMA
  0.50000000   0.50000000   0.50000000 R

Problem is that the 4 item in each coordinate is optional and you can write whatever you want. It is used by py4vasp and it is already stored by vasp into the vaspout.h5. So I can simply add this with a line of code to store it. But I shall add a check because the user can write there whatever. Where do we want to store it?

@harrisonlabollita

Copy link
Copy Markdown
Collaborator

Indeed, the same problem would occur in Wien2k. If the high-symmetry label is not indicated in their case.klist_band, we would not know it either. By default, we could just do K1,..., KN. My thought was just include in the dft_bands_input group. The field could be kpts_labels and kpts_labels_idx?

@the-hampel

Copy link
Copy Markdown
Member Author

That sounds good. Let me instruct Mr Claude and we see how this looks.

@the-hampel
the-hampel force-pushed the dev_vasp_kpointsopt branch from b92cdf9 to e99f13b Compare June 23, 2026 14:02
@the-hampel

Copy link
Copy Markdown
Member Author

7186a41 is a first draft. Let me know what you think and if this is compatible with wien2k.

@the-hampel
the-hampel force-pushed the dev_vasp_kpointsopt branch from 7186a41 to 03daf9e Compare June 26, 2026 11:32
Report the global DFT+DMFT iteration, each inner DMFT iteration, and the
point just before the VASP charge update / DFT driver is triggered.
The upstream ctseg fix (real(...) in work_data.cpp mu extraction) means
solve_generic now accepts the complex-flagged Hermitian impurity levels
directly; no need to strip the imaginary noise with h.real.copy().
Skip the final VASP charge update so the run always terminates on a DMFT
step instead of a now-unused DFT charge update, and add a header comment
plus inline comments explaining the setup and the outer/inner loops.
Convert KPOINTS_OPT/LOCPROJ_OPT data into dft_bands_input with strict shell matching and optional cfg-driven PLO transforms so VASP bands can be consumed like other DFT backends.

Auto-detect KPOINTS_OPT data during convert_dft_input, add dedicated SVO bands tests, and include minimal reproducibility inputs (INCAR/POSCAR/KPOINTS/KPOINTS_OPT/plo.cfg plus vaspout.h5) while suppressing confusing density/local-H diagnostics on the bands path.
Read the band-path labels for KPOINTS_OPT line-mode runs directly from
vaspout.h5 (/input/kpoints_opt: mode, labels_kpoints, number_kpoints) and
store them as kpts_labels + kpts_labels_idx in dft_bands_input, so the
high-symmetry tick metadata is available from the h5 at plot time (as
Wien2k exposes via case.outband).

VASP writes two labels (start, end) per line segment; each is mapped to its
0-based position in the flattened band k-path via segment arithmetic, and
the shared endpoint of two adjacent segments is collapsed into a single
tick. Non-line-mode runs simply omit the labels (no text-file fallback).

Extend the SVO bands test to check the Gamma-X-M-Gamma-R path
(labels and indices [0, 49, 99, 149, 199]).
The KPOINTS_OPT bands test checked the shape of dft_bands_input and one
hopping element, which passes even when the projectors themselves are
wrong. Two errors on the VASP side got through it during development of
this interface: raw LOCPROJ_OPT amplitudes that scaled with the MPI
decomposition, and a LORBIT=14 optimal PAW channel rebuilt from the
interpolated KPOINTS_OPT k-points instead of kept from the ground-state
mesh, which collapsed the path projectors by about four orders of
magnitude on the V t2g bands.

Both are invisible in dft_bands_input because PLOVasp orthonormalizes
the projectors and divides an overall factor out again, so add two checks
that look where the error is visible:

- _check_locproj_opt_scale compares the raw KPOINTS_OPT projectors with
  the regular-mesh ones at GAMMA, the k-point the line-mode path and the
  15x15x15 mesh have in common. It compares sum_orb sum_band
  |<phi|psi>|^2, which is invariant under the arbitrary band phase and
  under mixing inside a degenerate multiplet and therefore does not
  depend on the MPI decomposition (equal to 1e-8 relative between 4 and
  8 ranks). No hard-coded amplitude, so nothing to keep up to date.

- _check_downfolded_t2g downfolds hopping with proj_mat and checks the
  SrVO3 t2g dispersion along the path: the 2.487 eV bandwidth, the
  threefold degeneracy at GAMMA and R, the band bottom at GAMMA and top
  at R, and that both GAMMA ticks give the same bands. This catches a
  wrong orbital character, a k/band misalignment or a broken label
  mapping, none of which the shape assertions see.

Pin NBANDS in the fixture INCAR. VASP rounds the default up to a
multiple of the band-group size, so regenerating at 4 instead of 8 ranks
gives 23 bands, drops the topmost eg pair out of the [Group 1] EWINDOW
and changes n_orbitals.

Regenerate vaspout.h5 with a VASP that has both fixes, so the fixture
carries correct projector amplitudes rather than a snapshot of the
collapsed ones. The converted band structure is unchanged: the
downfolded t2g eigenvalues agree with the previous fixture to 5e-8 eV,
since the orthonormalization was already removing the error.

Also extend .gitignore with the LOCPROJ_OPT, PROCAR_OPT and PROJCAR_OPT
run outputs introduced with the KPOINTS_OPT workflow, and make the
generated converter artifact patterns recursive so they also cover
fixtures in subdirectories.
@the-hampel
the-hampel force-pushed the dev_vasp_kpointsopt branch from 03daf9e to 0359f3d Compare August 26, 2026 08:11
@the-hampel
the-hampel merged commit 20e6373 into TRIQS:unstable Aug 26, 2026
4 checks passed
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