How to obtain ordered G-vectors corresponding to vaspwave.h5 wavefunction coefficients?

Queries about input and output files, running specific calculations, etc.


Moderators: Global Moderator, Moderator

Post Reply
Message
Author
nuri_yazdani
Newbie
Newbie
Posts: 1
Joined: Mon May 04, 2020 1:14 pm

How to obtain ordered G-vectors corresponding to vaspwave.h5 wavefunction coefficients?

#1 Post by nuri_yazdani » Thu Jun 11, 2026 10:58 am

I am trying to do some calculations using the wavefunction coefficients printed out in the vaspwave.h5 file.
It seems that (num_planewave long) list of the G vectors corresponding to the coefficients is not saved in the h5 file.
I can generate them myself, but I need to know what the ordering of the G vectors is for the coefficients.
Im assuming h is the outer loop, followed by k, then l, i.e.:
[000], [001], [002], ..., [00Nc], [010], [011], ... [0NbNc], [100], [101], ... [NaNbNc]?

Would be great if someone could confirm this or correct me!

Im running 6.5.0.


zahedzx
Global Moderator
Global Moderator
Posts: 13
Joined: Mon Nov 03, 2025 2:06 pm

Re: How to obtain ordered G-vectors corresponding to vaspwave.h5 wavefunction coefficients?

#2 Post by zahedzx » Tue Jun 23, 2026 7:31 pm

Hi,

I checked the VASP source code and can give you the exact ordering.

The loop structure is:

  • z (l) — outermost / slowest

  • y (k) — middle

  • x (h) — innermost / fastest

So your guess was reversed. x is the fast index, not z.

The integer G-components follow the standard FFT wrap-around convention for each direction independently. For a grid of size N, the sequence of integers is:
0, 1, 2, ..., N/2, -(N/2-1), ..., -2, -1

Concrete example for NGX=NGY=NGZ=4 (so h,k,l each run over 0,1,2,−1 in that order), the full unfiltered scan visits G-vectors in this sequence:

Code: Select all

(h, k, l)
──────────────────────────────────
 (0, 0, 0)   ← l=0, k=0, h starts
 (1, 0, 0)
 (2, 0, 0)
(-1, 0, 0)   ← h wraps
 (0, 1, 0)   ← k increments
 (1, 1, 0)
 (2, 1, 0)
(-1, 1, 0)
 (0, 2, 0)
 (1, 2, 0)
 (2, 2, 0)
(-1, 2, 0)
 (0,-1, 0)   ← k wraps
 (1,-1, 0)
 (2,-1, 0)
(-1,-1, 0)
 (0, 0, 1)   ← l increments
 (1, 0, 1)
 (2, 0, 1)
(-1, 0, 1)
 (0, 1, 1)
 ...
 (0, 0, 2)   ← l=2
 ...
 (0, 0,-1)   ← l wraps
 ...
(-1,-1,-1)   ← last in scan
──────────────────────────────────

Only the G-vectors that satisfy ℏ2 ∣G+k∣2/2m < Ecut are actually stored. The num_planewaves entry in the HDF5 file tells you how many survive the cutoff for each k-point.

Best,
Zahed


Post Reply