Modulet for analzing VASP outputs.

Module Contents



Class handling VASP CHGCAR file data.


Read LOCPOT files.


Construct Oszicar object.


Construct OUTCAR object.


Class for reading a WAVEDER file.


Class for VASP Pseudowavefunction stored in WAVECAR.


Construct vasprun.xml handling object.



Parse vasp_raman.dat .






jarvis.io.vasp.outputs.RYTOEV = 13.605826
jarvis.io.vasp.outputs.AUTOA = 0.529177249
class jarvis.io.vasp.outputs.Chgcar(filename='', atoms=None, chg=[], chgdif=None, aug=None, augdiff=None, dim=None, nsets=1, lines='')[source]

Bases: object

Class handling VASP CHGCAR file data.


Convert to a dictionary.

classmethod from_dict(self, d={})[source]

Construct class from a dictionary.


Check if the calculations is spin-polarized, ISPIN=2.


Check if the calculations is spin-orbit, LSORBIT=T.

modify_grid(self, chg_set=0, multiply_volume=True, final_grid=[50, 50, 50], write_file=True, filename='New_CHGCAR')[source]

Modify grid and Write a charge set to a file for visualization.

read_file(self, lines='')[source]


chg_set(self, text, start, end, volume, ng)[source]

Return CHGCAR sets.

class jarvis.io.vasp.outputs.Locpot(filename='', atoms=None, chg=[], chgdif=None, aug=None, augdiff=None, dim=None, nsets=1, lines='')[source]

Bases: Chgcar

Read LOCPOT files.

vac_potential(self, direction='X', Ef=0, filename='Avg.png', plot=True)[source]

Calculate vacuum potential used in work-function calculation.

class jarvis.io.vasp.outputs.Oszicar(filename, data={})[source]

Bases: object

Construct Oszicar object.

classmethod from_dict(self, d={})[source]

Construct class from a dictionary.


Convert class to a dictionary.

property magnetic_moment(self)

Get magnetic moment.

property ionic_steps(self)

Get all ionic steps realted data.

property electronic_steps(self)

Get all electronic steps realted data.

class jarvis.io.vasp.outputs.Outcar(filename, data={})[source]

Bases: object

Construct OUTCAR object.

classmethod from_dict(self, d={})[source]

Construct class from a dictionary.


Convert class to a dictionary.

property nions(self)

Get number of ions.

property nbands(self)

Get number of bands.

property nedos(self)

Get number of dos points.

property efermi(self)

Get Fermi energy.

property all_band_energies(self)

Get all band energies.

property bandgap(self)

Get bandgap.

magnetization(self, dir='x', elements=[])[source]

Get magnetization in x,y,z.

total_charge(self, elements=[])[source]

Get total charge.

property nelect(self)

Get number of electrons.

property phonon_eigenvalues(self)

Get phonon eigenvalues.

property converged(self)

Check if calculation is converged.

efg_tensor_diag(self, std_conv=True, prec=3)[source]

Get diagonalized electric field gradient tensor.

property efg_raw_tensor(self)

Get raw electric field gradient tensor.

property quad_mom(self)

Get quadrupole momemnt.

property piezoelectric_tensor(self)

Get piezoelectric tensor.


Parse dielectric function.

elastic_props(self, atoms=None, vacuum=False)[source]

Obtain elastic tensor and calculate related properties.

For 3D and 2D cases.


outcar: OUTCAR file path

vacuum: whether the structure has vaccum such as 2D materials for vacuum structures bulk and shear mod. Needs extra attention and elastic tensor are in Nm^-1 rather than GPa


info: data for elastic tensor (in string and object representation), bulk, shear modulus, and phonon modes

class jarvis.io.vasp.outputs.Waveder(filename, gamma_only=False)[source]

Bases: object

Class for reading a WAVEDER file.

The LOPTICS tag produces a WAVEDER file. The WAVEDER contains the derivative of the orbitals with respect to k.

property cder_data(self)

Return the orbital derivative between states.

property nbands(self)

Return the number of bands in the calculation.

property nkpoints(self)

Return the number of k-points in the calculation.

property nelect(self)

Return the number of electrons in the calculation.

get_orbital_derivative_between_states(self, band_i, band_j, kpoint, spin, cart_dir)[source]

Return a valuebetween bands band_i and band_j.

For k-point index, spin-channel and cartesian direction.


band_i (Integer): Index of band i

band_j (Integer): Index of band j

kpoint (Integer): Index of k-point

spin (Integer): Index of spin-channel (0 or 1)

cart_dir (Integer): Index of cartesian direction (0,1,2)


a float value

class jarvis.io.vasp.outputs.Wavecar(filename='WAVECAR', lsorbit=False, lgamma=False, recl=None, nspin=None, rtag=None, nkpts=None, nbands=None, encut=None, lattice_mat=None, nplws=None, wfc=None, efermi=None, kvecs=None, energies=None, occs=None, gvec=None)[source]

Bases: object

Class for VASP Pseudowavefunction stored in WAVECAR.

The format of VASP WAVECAR, as shown in



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


Check if the WAVECAR is from an SOC calculation.


Read the system information from WAVECAR.

It 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 wavefunction coefficients precision.

TAG = 45200: single precision complex, np.complex64, or complex(qs) TAG = 45210: double precision complex, np.complex128, or complex(q)

readWFBand(self, ispin=1, ikpt=1, iband=1)[source]

Extract KS energies and Fermi occupations from WAVECAR.

gvectors(self, ikpt=1)[source]

Generate the G-vectors.

satisfies the following relation

(G + k)**2 / 2 < ENCUT

readBandCoeff(self, ispin=1, ikpt=1, iband=1, norm=False)[source]

Read the planewave coefficients of specified KS states.

whereRec(self, ispin=1, ikpt=1, iband=1)[source]

Return the rec position for specified KS state.

checkIndex(self, ispin, ikpt, iband)[source]

Check if the index is valid.

class jarvis.io.vasp.outputs.Vasprun(filename='vasprun.xml', data={})[source]

Bases: object

Construct vasprun.xml handling object.

classmethod from_dict(self, d={})[source]

Construct class from a dictionary.


Convert class to a dictionary.


Convert XML to dictionary.

property final_energy(self)

Get final energy.

property nbands(self)

Get number of electronic bands.

property nkpoints(self)

Get number of kpoints.

property nspins(self)

Get total numnber of spins.

property efermi(self)

Get Fermi-energy.

property num_atoms(self)

Get number of simulation atoms.

property num_types(self)

Get number of atom types.

property dielectric_loptics(self)

Get real and imag. dielectric function data.

property avg_absorption_coefficient(self, max_axis=3)

Get average absoprtion coefficient. Used in solar-cell module.

phonon_data(self, fc_mass=True)[source]

Get phonon data.

property converged_electronic(self)

Check whether electronically converged.

property converged_ionic(self)

Check whether ionically converged.

property converged(self)

Check whether both electronically and ionically converged.

property dfpt_data(self, fc_mass=True)

Get DFPT IBRION=8 LEPSILON lated data.

property get_dir_gap(self)

Get direct bandgap.

property get_indir_gap(self)

Get indirect bandgap.

bandgap_occupation_tol(self, occu_tol=0.1)[source]

Get bandgap based on occupation tolerance.

property fermi_velocities(self)

Get fermi velocities in m/s.

property elements(self)

Get atom elements.

vrun_structure_to_atoms(self, s={})[source]

Convert structure to Atoms object.

property all_energies(self)

Get all total energies.

property is_spin_polarized(self)

Check if the calculation is spin polarized.

property is_spin_orbit(self)

Check if the calculation is spin orbit.

property all_structures(self)

Get all structures.

property eigenvalues(self)

Get all eigenvalues.

property all_forces(self)

Get all forces.

property all_stresses(self)

Get all stresses.

property all_input_parameters(self)

Get all explicit input parameters. Need to add a few more.

property kpoints(self)

Get Kpoints.

get_bandstructure(self, E_low=- 4, E_high=4, spin=0, zero_efermi=True, kpoints_file_path='KPOINTS', plot=False, filename=None)[source]

Get electronic bandstructure plot.

property total_dos(self)

Get total density of states.

property partial_dos_spdf(self)

Get partial density of states.

property projected_spins_kpoints_bands(self)

Use for spin, kpoint and band projected bandstructure plots.

property projected_atoms_spins_kpoints_bands(self)

Use for atom,spin,kpoint and band projected bandstructures.

get_spdf_dos(self, plot=False)[source]

Get spdf resolved partial density of states.

get_atom_resolved_dos(self, plot=False)[source]

Get atom resolved density of states.


Parse vasp_raman.dat .

generated by https://github.com/raman-sc/VASP

Activities to Intensities: J. At. Mol. Sci. 3 (2012) 1-22 Intensity = const0 * (nu0-nu)**4/nu * 1/(1-exp(-h*c*nu/(kB*T))) * activity Data for computing intensities, as in Materials Project’s paper:

T=300K, nu0=18796.9925 cm-1