Whilst DFT codes quite reasonably store wavefunctions in binary files, for they are large, sometimes it is useful to be able to extract one in an ASCII format for further processing.

For VASP, the utility WaveTrans exists which does this. C2x can also write a slightly modified version of its output. The standard name for the file seems to be GCOEFF.txt

The original output format is defined as follows. It has a nine-line header:

  no of spins
  no of kpoints
  no of bands
  a_x a_y a_z
  b_x b_y b_z
  c_x c_y c_z
  a*_x a*_y a*_z
  b*_x b*_y b*_z
  c*_x c*_y c*_z

where a_x etc. are the real lattice vectors in Angstroms, and a*_x etc. the reciprocal space ones, including a factor of 2π.

Then a set of nested loops describes the wavefunction:

[loop over spins]
  [loop over kpoints]
    k_x k_y k_z
    ( E_r , E_i ) occ
    [loop over bands]
      band_index  no_of_plane_waves
      [loop over plane waves]
        ig1  ig2  ig3 ( psi_r , psi_i )

where k_x etc. are the fractional co-ordinate of the kpoint, E_r and E_i are the real and imaginary parts of the band's eigenvalue in eV and occ its occupancy, the band_index is an integer, and no_of_plane_waves might vary between kpoints, but seems unlikely to vary within a kpoint. Finally ig1 etc are the integer components of the gvector, and psi_r and psi_i the real and imaginary components of the corresponding wavefunction coefficient. Of course, E_i always seems to be zero.

Note that the complex values are written in Fortran's default style, which means that the two brackets and the comma really exist in the file.

In order that GCOEFF.txt can contain all the data present in a VASP WAVECAR file, c2x makes one adjustment to it, which it is hoped will be ignored by readers unaware of it. The header line giving the number of bands has appended the plane wave cutoff, and the Fermi energy (both in eV). If only one extra float appears on this line, then it is the plane wave cutoff, and the Fermi energy is unknown. If the cutoff is written as zero, then it is clearly a dummy value which should be ignored. Ideally readers would be able to cope with one, two or three data items on this line.