R. M. Feenstra and M. Widom
Department of Physics, Carnegie Mellon University, Pittsburgh, PA 15213
Record-length #spin components RTAG(a value specifying the precision) #k-points #bands ENCUT(maximum energy for plane waves) LatVec-A LatVec-B LatVec-C Loop over spin Loop over k-points #plane waves, k vector Loop over bands band energy, band occupation End loop over bands Loop over bands Loop over plane waves Plane-wave coefficient End loop over plane waves End loop over bands End loop over k-points End loop over spinOn the first line of the WAVECAR file, a value of RTAG of 45200 specifies that complex*8 binary format is used for the coefficients, whereas a value of 45210 specifies complex*16 format. WaveTrans presently works only for the former case (see Limitations section below). Note that in the WAVECAR file there is no explicit specification of the G value associated with a given plane-wave coefficient. Rather, the G values must be deduced by the ordering of the coefficients; it is this operation that WaveTrans accomplishes.
The WaveTrans program reads in the contents of the WAVECAR file, and outputs a GCOEFF.txt file with the appropriate G values and corresponding plane-wave coefficients. For full specification of the format of the GCOEFF.txt file, see the comments at the top of the source code. In brief, the GCOEFF.txt file contains, for each wavevector k, band ν, and spin channel, a set of G values and corresponding complex plane-wave coefficients Cν,G(k), from which the real-space wavefunction can be easily constructed (as described in Supplemental material for Phys. Rev. B 87, 041406 (2012)). Within the GCOEFF.txt file, each G value is specified by providing three integers (n1,n2,n3), from which the G value is obtained according to G = n1b1+n2b2+n3b3, where bi are the reciprocal lattice vectors. The set of G values that are contained explicitly in the GCOEFF.txt file (and implicitly in the WAVECAR file) is determined by the maximum plane-wave energy used for the VASP run, i.e. it is all G values for which ℏ2|k+G|2/2m is less than the specified maximum energy. When using WaveTrans, it is best to restrict the wavevector k to the 1st Brillouin zone, as further discussed in the Limitations section below.
Source code for a FORTRAN 77 version is available in WaveTrans.f and WAVECARin.f (the latter includes the routine vcross for computing cross-products for 3-component vectors). Source code for a FORTRAN 90 version with dynamic allocation of arrays is in WaveTrans.f90. An executable version of the FORTRAN 77 version (made using Gnu gfortran) that should run on any Windows PC is available in the file WaveTrans.exe. For other platforms, simply compile and link the source code on the specific platform. It should be noted that details regarding binary input vary from compiler to compiler. For the case of the ifort compiler (on Linux) the compiler option "-assume byterecl" must be specified so that the record length indicator in the program is interpreted in bytes. Similar types of option(s) may be required for other compilers.
A much more efficient way to construct the WAVEFCN.txt file is to write a program that combines the functions of WaveTrans and WaveFcnPlot, without generating the intermediate GCOEFF.txt file. Such a program is also posted, with source code WaveTransPlot.f and executable code WaveTransPlot.exe. This program reads in the WAVECAR file and produces an output file WAVEFCN.txt that is identical to the one produced by the combination of WaveTrans and WaveFcnPlot, but does so using only a small fraction of the CPU time and disk space that the combination requires.
The FORTRAN 90 version of WaveTransPlot, WaveTransPlot.f90, offers command line options, e.g. the command "WaveTransPlot -h" produces:
syntax: WaveTransPlot -f file -s spin -k k-point -b band -x coord -y coordThe program outputs a GCOEFF.txt file containing only the coefficients for the selected k-point, band, and spin channel. The z, Real(psi(z)), and Imag(psi(z)) values for the corresponding wavefunction are output to logical unit number 6.
defaults: -f WAVECAR -s 1 -k 1 -b 1 -x 0.0 -y 0.0
inputs: x and y are direct coordinates on axes a1 and a2
output: wavefunction psi(x,y,z) with z direct coordinate on a3 axis
For interpreting the WAVECAR files, WaveTrans makes an estimate of the maximum magnitude of each component of the G vectors that need to be considered. These estimates may be in error if the particular wavevector that the states are being evaluated at lies outside of the 1st Brillouin zone. Hence, wavevectors should be restricted to the 1st Brillouin zone. (Alternatively, for a wavevector well outside the 1st Brillouin zone, the user can manually increase the values of nb1max, nb2max, and nb3max, as well as npmax, in the program).
For both the f77 and f90 versions, the program makes an estimate of the maximum magnitude of each component of the G vectors that need to be considered. For the f90 version an estimate of the maximum number of plane waves is also made, as needed for the allocation of array space. If either of these estimates is incorrect, so that the number of plane waves computed by WaveTrans deviates from the actual number in the WAVECAR file, then an error message results. This was an issue for version 2.0 of WaveTrans.f90 and WaveTransPlot.f90 and for versions 1.1 and previous of WAVECARin.f, in which some of these estimates failed for unit cells that deviated significantly from cubic or orthorhombic. However, these estimates were revised in more recent versions, and they presently seem to be reliable for all cases.
Another situation that can lead to a discrepency between the number of plane waves computed by WaveTrans and that contained in the WAVECAR file has to do with the numerical value of 2m/ℏ2 employed in WaveTrans. This value must be precisely the same as that used in VASP, such the maximum energy cutoff has identically the same effect in the two programs. The value of 2m/ℏ2 in WaveTrans is presently equal to that in WAVECAR to 9 significant figures. However, a slight adjustment to the final decimal place (or one beyond that) might still be needed. If a user encounters a situation with an error message saying that "the computed number of plane waves is not equal to the input number", then a slight adjustment of the 2m/ℏ2 value (parameter "c" in the DATA statement at the top of the program/routine) is likely needed. If such an adjustment is successfully determined, then please contact email@example.com with the new value, so that it can be incorporated into a future version of WaveTrans.