easyunfold.wavecar#

Code for reading the eigenvalues and plane wave coefficients from the WAVECAR file.

Module Contents#

Classes#

Wavecar

Class for processing VASP Pseudowavefunction stored in WAVECAR.

API#

class easyunfold.wavecar.Wavecar(fnm='WAVECAR', lsorbit=False, lgamma=False, gamma_half='x')#

Class for processing VASP Pseudowavefunction stored in WAVECAR.

This class is a trimmed-down from that of PyVaspwfc by QijingZheng zqj.kaka@gmail.com.

Only the functions needed for band unfolding remains. The original class has many other functionalities such as ELF calculation.

The format of VASP WAVECAR, as shown in http://www.andrew.cmu.edu/user/feenstra/wavetrans/ is:

    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 spin

Initialization

Initialization.

Parameters:
  • fnm – Path to the WAVECAR file

  • lsorbit – Whether the WAVECAR is from a spint-orbit coupling calculation

  • lgamma – Wether the WAVECAR is from a \(\Gamma\)-only calculation

close()#

Close the file handle

is_soc()#

Return True if the WAVECAR from an SOC calculation.

is_gamma()#

Return True is the WAVECAR is from an \(\Gamma\)-only calculation.

read_wf_header()#

Read the system information from WAVECAR, which is written in the first two record.

Rec1:

recl, nspin, rtag

Rec2:

nkpts, nbands, encut, ((cell(i,j) i=1, 3), j=1, 3)

set_wf_prec()#

Set wavefunction coefficients precision:

TAG = 45200:

single precision complex, np.complex64, or complex(qs)

TAG = 45210:

double precision complex, np.complex128, or complex(q)

read_bands() tuple#

Extract KS energies and Fermi occupations from WAVECAR.

get_gvectors(ikpt=1, force_gamma=False, check_consistency=True)#

Generate the G-vectors that satisfies the following relation

\[ \frac{|\vec{G} + \vec{k}|^2}{2} < E_{cut} \]
read_band_coeffs(ispin=1, ikpt=1, iband=1, norm=False)#

Read the planewave coefficients of specified KS states.

locate_rec(ispin=1, ikpt=1, iband=1)#

Return the rec position for specified KS state.

check_index(ispin, ikpt, iband)#

Check if the index is valid!