Jump to content

Requests for technical support from the VASP team should be posted in the VASP Forum.

Vasprun.xml: Difference between revisions

From VASP Wiki
Csheldon (talk | contribs)
Csheldon (talk | contribs)
 
(28 intermediate revisions by 2 users not shown)
Line 1: Line 1:
In addition to {{FILE|OUTCAR}}, output from VASP is stored using XML format in the {{FILE|vasprun.xml}} file for ease of use. Below, the structure of such a file is given with links to the corresponding pages:
{{DISPLAYTITLE:vasprun.xml}}The {{FILE|vasprun.xml}} is written in xml format and contains both, general output that is written for any calculation and specific output depending on the method or quantity that is being computed. Below you see details regarding the general output, while the specific output, e.g. the dielectric function ({{TAG|LOPTICS}}), partial density of states ({{TAG|LORBIT}}), the electronic self-energy ({{TAG|LSELFENERGY}}) etc., are detailed on the corresponding tag documentation. Mind that newer features tend to write to {{FILE|vaspout.h5}}. The {{FILE|vaspout.h5}} should generally be preferred for reading large datasets.


== Contents of file ==
== File format ==
The structure of {{FILE|vasprun.xml}} has the following main hierarchy:


# generator
The root element is <code><modeling></code>. The file uses four repeating XML primitives throughout:
# incar
# primitive cell
# kpoints
# parameters
# atom info
# structure
# calculation


Each section will be shown, with links to the relevant pages in the Wiki.
* <code><i name="..." type="...">value</i></code> — a named scalar (real, integer, logical, or string).
* <code><v name="...">x y z</v></code> — a named row vector.
* <code><varray name="..."></code> — a named array of vectors, each on a <code><v></code> line.
* <code><array></code> — a labelled multi-field table with named dimensions; rows are stored as <code><r></code> elements inside <code><set></code> blocks.


== Generator ==
The overall layout of {{FILE|vasprun.xml}} is:
Contains all the information about the calculation run.


* '''program'''
<syntaxhighlight lang="xml">
** VASP
<modeling>
* '''version'''
  <generator>  ...  </generator>
** VASP version
  <incar>      ...  </incar>
* '''subversion'''
  <primitive_cell> ... </primitive_cell>
** Subversion and build details, including compilation details.
  <kpoints>    ...  </kpoints>
* '''platform'''
  <parameters>  ... </parameters>
** Operating system and compiler used.
  <atominfo>    ...  </atominfo>
* '''date'''
  <structure name="initialpos"> ... </structure>
** Date the calculation was performed (YYYY MM DD)
* '''time'''
  <!-- one block per ionic step (MD, relaxation): -->
** Time the calculation was performed (HH:MM:SS)
  <structure> ... </structure>
  <varray name="forces"> ... </varray>
  <varray name="stress"> ... </varray>
  <energy> ... </energy>
  <time name="totalsc"> ... </time>
  ...
  <!-- OR a single calculation block (single-point, GW, BSE): -->
  <calculation> ... </calculation>
  <structure name="finalpos"> ... </structure>
</modeling>
</syntaxhighlight>


== Incar ==
== Sections ==
Input parameters read from the {{FILE|INCAR}} file.


* '''SYSTEM'''
=== Generator ===
** System description: e.g., face-centered cubic Silicon.
* '''{{TAG|ISTART}}'''
** Controls how the wave functions are initialized.
* '''{{TAG|ICHARG}}'''
** Controls how the charge density is initialized.
* '''{{TAG|ENCUT}}'''
** Energy cutoff for plane-wave basis set in eV.
* '''{{TAG|ISMEAR}}'''
** Smearing method for occupations.
* '''{{TAG|SIGMA}}'''
** Smearing width in eV.


== Primitive cell ==
Contains the VASP version, build details, and the date and time of the run.
* '''Structure'''
** Structure details of the primitive cell.
*'''Crystal'''
** Crystal lattice information.
*'''Basis'''
** Basis vectors of the primitive unit cell in Angstroms: <math>a_1, a_2, a_3</math>
*'''Volume'''
** Volume of the primitive unit cell in ų.
*'''Rec_Basis'''
** Reciprocal lattice basis vectors: <math>b_1, b_2, b_3</math>
*'''Positions'''
** Atomic positions within the primitive cell (in direct coordinates). ''?????''
*'''Primitive_Index''' ''?????''
** Index representing the primitive cell.


== Kpoints ==
<syntaxhighlight lang="xml">
Specifies the Bloch vectors (k points) used in the {{FILE|KPOINTS}} file to sample the Brillouin zone.
<generator>
  <i name="program"    type="string">vasp </i>
  <i name="version"    type="string">6.5.0  </i>
  <i name="subversion" type="string">29Jan2024 (build Feb 14 2024) complex parallel</i>
  <i name="platform"  type="string">LinuxGNU </i>
  <i name="date"      type="string">2024 01 01 </i>
  <i name="time"      type="string">12:00:00 </i>
</generator>
</syntaxhighlight>


*'''Generation'''
=== INCAR ===
** Method used for k-point generation: e.g., Monkhorst-Pack.
*'''Divisions'''
** Divisions along each reciprocal lattice vector for the Monkhorst-Pack mesh.
*'''Usershift'''
** User-defined shift for the k-point mesh.
*'''Genvec1'''
** First generator vector for the k-points.
*'''Genvec2'''
** Second generator vector for the k-points.
*'''Genvec3'''
** Third generator vector for the k-points.
*'''Shift'''
** Shift applied to the k-point mesh.
*'''Kpointlist'''
** Explicit list of k-points in reciprocal space.
*'''Weights'''
** Weights corresponding to each k-point.


== Parameters ==
Contains only the tags explicitly set in the {{FILE|INCAR}} file, without defaults. This is a compact record of the user-specified settings for the run.
Parameters used for running the calculation.


=== General ===
<syntaxhighlight lang="xml">
General calculation parameters.
<incar>
*'''SYSTEM'''
  <i type="string" name="SYSTEM">diamond Si</i>
**System name.
  <i type="string" name="ALGO">Normal</i>
*'''{{TAG|LCOMPAT}}'''
  <i name="ENCUT">    500.00000000</i>
** Compatibility flag for older versions. ?????
  <i type="int" name="ISMEAR">    0</i>
=== Electronic ===
  <i name="SIGMA">      0.05000000</i>
Electronic structure calculation parameters.
</incar>
*'''{{TAG|PREC}}'''
</syntaxhighlight>
** Precision setting for calculations (normal).
*'''{{TAG|ENMAX}}'''
** Maximum energy cutoff for plane waves in eV.
*'''{{TAG|ENAUG}}'''
** Augmentation charge cutoff in eV.
*'''{{TAG|EDIFF}}'''
** Convergence criterion for electronic self-consistency loop in eV.
*'''{{TAG|IALGO}}'''
** Algorithm for electronic minimization.
*'''{{TAG|IWAVPR}}'''
** Controls when wavefunctions are written to WAVECAR.
*'''{{TAG|NBANDS}}'''
** Number of bands to be calculated.
*'''{{TAG|NBANDSLOW}}'''
** Lower bound for bands considered in certain calculations. ?????
*'''{{TAG|NBANDSHIGH}}'''
** Upper bound for bands considered in certain calculations. ?????
*'''{{TAG|NELECT}}'''
** Total number of electrons in the system.
*'''{{TAG|TURBO}}'''
** Controls turbo molecular dynamics.
*'''{{TAG|IRESTART}}'''
** Controls restarts.
*'''{{TAG|NREBOOT}}'''
** Controls how many times the calculation restarts. ?????
*'''{{TAG|NMIN}}'''
** Minimum number of electronic steps.
*'''{{TAG|EREF}}'''
** Reference energy for some calculations. ?????
=== Electronic Smearing ===
Parameters related to electronic smearing.
*'''{{TAG|ISMEAR}}'''
** Smearing method.
*'''{{TAG|SIGMA}}'''
** Smearing width in eV.
*'''{{TAG|KSPACING}}'''
** K-point spacing for automatically generated KPOINTS.
*'''{{TAG|KGAMMA}}'''
** Enforces Gamma-centered k-point mesh. ?????
*'''{{TAG|KBLOWUP}}'''
** Controls blow-up of k-point mesh. ?????
=== Electronic Projectos' ===
Parameters for projectors in PAW method.
*'''{{TAG|LREAL}}'''
** Controls projection operators in real space.
*'''{{TAG|ROPT}}'''
** Controls real-space grid for projections. ?????
*'''{{TAG|LMAXPAW}}'''
** Maximum angular momentum for PAW projectors. ?????
*'''{{TAG|LMAXMIX}}'''
** Maximum angular momentum for charge density mixing. ?????
*'''{{TAG|NLSPLINE}}'''
** Controls non-local spline interpolation. ?????
=== Electronic Startup ===
Parameters for initializing the electronic calculation.
*'''{{TAG|ISTART}}'''
** Controls how the wave functions are initialized.
*'''{{TAG|ICHARG}}'''
** Controls how the charge density is initialized.
*'''{{TAG|INIWAV}}'''
** Controls how initial wavefunctions are generated. ?????
=== Electronic Spin ===
Parameters for spin polarization.
*'''{{TAG|ISPIN}}'''
** Spin polarization.
*'''{{TAG|LNONCOLLINEAR}}'''
** Non-collinear magnetism.
*'''{{TAG|MAGMOM}}'''
** Initial magnetic moments for each atom.
*'''{{TAG|NUPDOWN}}'''
** Net magnetic moment. ??????
*'''{{TAG|LSORBIT}}'''
** Spin-orbit coupling.
*'''{{TAG|SAXIS}}'''
** Axis for spin quantization.
*'''{{TAG|LSPIRAL}}'''
** Spiral magnetism. ?????
*'''{{TAG|QSPIRAL}}'''
** Q-vector for spiral magnetism. ?????
*'''{{TAG|LZEROZ}}'''
** For zeroing magnetization in z-direction. ?????
=== Electronic Exchange-Correlation ===
Parameters for exchange-correlation functional.
*'''{{TAG|LASPH}}'''
** Controls non-spherical contributions to the PAW potentials.
=== Electronic Convergence ===
Parameters for convergence criteria.
*'''{{TAG|NELM}}'''
** Maximum number of electronic self-consistency steps.
*'''{{TAG|NELMDL}}'''
** Number of non-self-consistent steps at the beginning.
*'''{{TAG|NELMIN}}'''
** Minimum number of electronic steps.
*'''{{TAG|ENINI}}'''
** Initial energy cutoff for basis set in eV.
=== Electronic Convergence Detail ===
Detailed convergence parameters.
*'''{{TAG|LDIAG}}'''
** Controls diagonalization.
*'''{{TAG|LSUBROT}}'''
** Controls subspace rotation.
*'''{{TAG|WEIMIN}}'''
** Minimum weight for bands.
*'''{{TAG|EBREAK}}'''
** Energy difference convergence criterion in conjugate gradient.
*'''{{TAG|DEPER}}'''
** Damping parameter.
*'''{{TAG|NRMM}}'''
** Number of vectors kept in RMM-DIIS.
*'''{{TAG|TIME}}'''
** Maximum time for one SCF step.
=== Electronic Mixer ===
Parameters for charge density mixer.
*'''{{TAG|AMIX}}'''
** Linear mixing parameter.
*'''{{TAG|BMIX}}'''
** Kerker mixing parameter.
*'''{{TAG|AMIN}}'''
** Minimum linear mixing parameter.
*'''{{TAG|AMIX_MAG}}'''
** Linear mixing parameter for magnetization density.
*'''{{TAG|BMIX_MAG}}'''
** Kerker mixing parameter for magnetization density.
*'''Electronic Mixer Details'''
** Detailed mixer parameters.
*'''{{TAG|IMIX}}'''
** Mixing type.
*'''{{TAG|MIXFIRST}}'''
** Mixes charge density from first step.
*'''{{TAG|MAXMIX}}'''
** Maximum number of steps for mixing.
*'''{{TAG|WC}}'''
** Kerker screening parameter.
*'''{{TAG|INIMIX}}'''
** Initial mixing type.
*'''{{TAG|MIXPRE}}'''
** Type of preconditioning for mixing.
*'''{{TAG|MREMOVE}}'''
** Number of old vectors removed from mixing history.
=== Electronic Dipolcorrection ===
Parameters for dipole correction.
*'''{{TAG|LDIPOL}}'''
** Dipole correction.
*'''{{TAG|LMONO}}'''
** Monopole correction.
*'''{{TAG|IDIPOL}}'''
** Direction for dipole correction.
*'''{{TAG|EPSILON}}'''
** Dielectric constant for dipole correction.
*'''{{TAG|DIPOL}}'''
** Position of the dipole.
*'''{{TAG|EFIELD}}'''
** External electric field.
*'''{{TAG|LVACPOTAV}}'''
** Writes averaged vacuum potential.
=== Grids ===
Parameters for real-space grids.
*'''{{TAG|NGX}}'''
** Number of grid points in x-direction for charge density.
*'''{{TAG|NGY}}'''
** Number of grid points in y-direction for charge density.
*'''{{TAG|NGZ}}'''
** Number of grid points in z-direction for charge density.
*'''{{TAG|NGXF}}'''
** Number of grid points in x-direction for wavefunctions.
*'''{{TAG|NGYF}}'''
** Number of grid points in y-direction for wavefunctions.
*'''{{TAG|NGZF}}'''
** Number of grid points in z-direction for wavefunctions.
*'''{{TAG|ADDGRID}}'''
** Adds a finer grid for PAW.
=== Ionic ===
Parameters for ionic relaxation/molecular dynamics.
*'''{{TAG|NSW}}'''
** Maximum number of ionic steps.
*'''{{TAG|IBRION}}'''
** Ionic relaxation algorithm.
*'''{{TAG|MDALGO}}'''
** Molecular dynamics algorithm. LINK TO MD CALCULATIONS????
*'''{{TAG|ISIF}}'''
** Controls what is relaxed.
*'''{{TAG|PSTRESS}}'''
** External pressure in kB.
*'''{{TAG|EDIFFG}}'''
** Convergence criterion for forces in eV/Å.
*'''{{TAG|NFREE}}'''
** Number of degrees of freedom to relax.
*'''{{TAG|POTIM}}'''
** Time step for ionic relaxation or MD in fs.
*'''{{TAG|SMASS}}'''
** Specifies the "mass" of the ions for damped MD.
*'''{{TAG|SCALEE}}'''
** Scales all calculated energies.
=== Ionic MD ===
Parameters for molecular dynamics specifics.
*'''{{TAG|TEBEG}}'''
** Initial temperature for MD in K.
*'''{{TAG|TEEND}}'''
** Final temperature for MD in K.
*'''{{TAG|NBLOCK}}'''
** Writes output every NBLOCK steps.
*'''{{TAG|KBLOCK}}'''
** Controls specific output for MD.
*'''{{TAG|NPACO}}'''
** Number of plane waves for the augmentation charge.
*'''{{TAG|APACO}}'''
** Controls the cutoff for augmentation charge.
*'''Symmetry'''
** Parameters for symmetry detection.
*'''{{TAG|ISYM}}'''
** Controls symmetry handling.
*'''{{TAG|SYMPREC}}'''
** Precision for symmetry detection.
=== DOS ===
Parameters for Density of States (DOS) calculations.
*'''{{TAG|LORBIT}}'''
** Controls local orbital projected DOS (0: no projected DOS).
*'''{{TAG|RWIGS}}'''
** Wigner-Seitz radii for DOS projection.
*'''{{TAG|NEDOS}}'''
** Number of energy points for DOS.
*'''{{TAG|EMIN}}'''
** Minimum energy for DOS.
*'''{{TAG|EMAX}}'''
** Maximum energy for DOS.
*'''{{TAG|EFERMI}}'''
** Fermi energy.
=== Writing ===
Parameters for writing output files.
*'''{{TAG|NWRITE}}'''
** Controls verbosity of output.
*'''{{TAG|LWAVE}}'''
** Writes WAVECAR file.
*'''{{TAG|LDOWNSAMPLE}}'''
** Downsamples wave functions.
*'''{{TAG|LCHARG}}'''
** Writes {{FILE|CHGCAR}} and {{FILE|CHG}} files.
*'''{{TAG|LPARD}}'''
** Writes partial charge densities.
*'''{{TAG|LVTOT}}'''
** Writes total local potential.
*'''{{TAG|LVHAR}}'''
** Writes Hartree potential.
*'''{{TAG|LELF}}'''
** Writes Electron Localization Function (ELF).
*'''{{TAG|LOPTICS}}'''
** Calculates optical properties.
*'''{{TAG|STM}}'''
** Parameters for scanning tunneling microscopy.


=== Performance ===
=== Primitive cell ===
Parameters for performance optimization.
 
*'''{{TAG|NPAR}}'''
Contains the structure and lattice of the primitive unit cell, along with the mapping of primitive-cell ion indices to the full simulation-cell ion indices.
** Number of bands or k-points grouped on a node.
 
*'''{{TAG|NSIM}}'''
<syntaxhighlight lang="xml">
** Number of bands treated simultaneously.
<primitive_cell>
*'''{{TAG|NBLK}}'''
  <structure name="primitive_cell">
** Block size for band diagonalization.
    <crystal>
*'''{{TAG|LPLANE}}'''
      <varray name="basis">            <!-- lattice vectors in A -->
** Parallelization over plane waves.
        <v>  1.92  1.92  0.00 </v>
*'''{{TAG|LSCALAPACK}}'''
        <v>  0.00  1.92  1.92 </v>
** Uses ScaLAPACK for diagonalization.
        <v>  1.92  0.00  1.92 </v>
*'''{{TAG|LSCAAWARE}}'''
      </varray>
** Enables ScaLAPACK-aware mode.
      <i name="volume">    28.35 </i>  <!-- volume in A^3 -->
*'''{{TAG|LSCALU}}'''
      <varray name="rec_basis">        <!-- reciprocal lattice vectors in A^-1 -->
** Uses LU decomposition for ScaLAPACK.
        <v>  0.26  0.26 -0.26 </v>
*'''{{TAG|LASYNC}}'''
        <v> -0.26  0.26  0.26 </v>
** Asynchronous communication.
        <v>  0.26 -0.26  0.26 </v>
*'''{{TAG|LORBITALREAL}}'''
      </varray>
** Uses real orbitals.
    </crystal>
=== Miscellaneous ===
    <varray name="positions">          <!-- fractional (direct) coordinates -->
Miscellaneous parameters.
      <v> 0.00  0.00  0.00 </v>
*'''{{TAG|IDIOT}}'''
      <v> 0.25  0.25  0.25 </v>
** Controls some internal settings.
    </varray>
*'''{{TAG|PHON_NSTRUCT}}'''
  </structure>
** Number of structures for phonon calculations.
  <varray name="primitive_index">      <!-- index of each primitive ion in the full cell -->
*'''{{TAG|LMUSIC}}'''
    <v type="int"> 1 </v>
** Enables MUSIC code coupling.
    <v type="int"> 2 </v>
*'''{{TAG|POMASS}}'''
  </varray>
** Mass of the pseudo-ion for MD.
</primitive_cell>
*'''{{TAG|DARWINR}}'''  
</syntaxhighlight>
** Related to Darwin-Foldy term.
 
*'''{{TAG|DARWINV}}'''
=== k points ===
** Related to Darwin-Foldy term.
 
*'''{{TAG|LCORR}}'''
Specifies the '''k'''-point sampling of the Brillouin zone, mirroring the {{FILE|KPOINTS}} file.
** Applies core correction.
 
*'''{{TAG|GGA_COMPAT}}'''
<syntaxhighlight lang="xml">
** Ensures compatibility for GGA functionals.
<kpoints>
*'''{{TAG|LBERRY}}'''
  <generation param="Gamma">            <!-- generation scheme: Gamma, Monkhorst-Pack, or Explicit -->
** Enables Berry phase calculation.
    <v type="int" name="divisions"> 4 4 4 </v>
*'''{{TAG|ICORELEVEL}}'''
    <v name="usershift"> 0.0  0.0  0.0 </v>
** Controls core level spectroscopy.
    <v name="genvec1">  0.25 0.00 0.00 </v>
*'''{{TAG|LDAU}}'''
    <v name="genvec2">  0.00 0.25 0.00 </v>
** Enables LDA+U correction.
    <v name="genvec3">  0.00 0.00 0.25 </v>
*'''{{TAG|I_CONSTRAINED_M}}'''
    <v name="shift">    0.00 0.00 0.00 </v>
** Constrained magnetization calculation.
  </generation>
*'''Electronic Exchange-Correlation'''
  <varray name="kpointlist">            <!-- '''k'''-point coordinates in reciprocal space -->
** Parameters for exchange-correlation functional.
    <v>  0.000  0.000  0.000 </v>
*'''{{TAG|GGA}}'''
    <v>  0.250  0.000  0.000 </v>
** Functional used.
    ...
*'''{{TAG|XC_C}}'''
  </varray>
** Specific correlation functional choice.
  <varray name="weights">              <!-- integration weights, normalized to sum to 1 -->
*'''{{TAG|VOSKOWN}}'''
    <v> 0.00463 </v>
** Voskown correlation.
    <v> 0.03704 </v>
*'''{{TAG|LHFCALC}}'''
    ...
** Enables Hartree-Fock calculations.
  </varray>
*'''{{TAG|PRECFOCK}}'''
</kpoints>
** Precision for Fock exchange.
</syntaxhighlight>
*'''{{TAG|LSYMGRAD}}'''
 
** Uses symmetric gradients in Fock exchange.
=== Parameters ===
*'''{{TAG|LHFONE}}'''
 
** One-shot Hartree-Fock calculation.
Contains a complete record of all effective {{FILE|INCAR}} parameters, including those not set explicitly (with their default values). The block is organized into named <code><separator></code> subsections corresponding to groups of related tags, for example:
*'''{{TAG|LRHFCALC}}'''
 
** Performs real-space Hartree-Fock calculation.
* <code>general</code>
*'''{{TAG|LTHOMAS}}'''
* <code>electronic</code> (with sub-separators: <code>smearing</code>, <code>projectors</code>, <code>startup</code>, <code>spin</code>, <code>exchange-correlation</code>, <code>convergence</code>, <code>mixer</code>, <code>dipolcorrection</code>)
** Includes Thomas-Fermi screening.
* <code>grids</code>
*'''{{TAG|LMODELHF}}'''
* <code>ionic</code> and <code>ionic md</code>
** Uses a model Hartree-Fock.
* <code>symmetry</code>
*'''{{TAG|LFOCKACE}}'''
* <code>dos</code>
** Uses accelerated Fock exchange.
* <code>writing</code>
*'''{{TAG|ENCUT4O}}'''
* <code>performance</code>
** Energy cutoff for 4-center integrals in hybrid functionals.
* <code>miscellaneous</code>
*'''{{TAG|EXXOEP}}'''
* <code>orbital magnetization</code>
** Exact exchange for optimized effective potential.
* <code>response functions</code> (GW/BSE calculations)
*'''{{TAG|FOURORBIT}}'''
* <code>vdW DFT</code>
** Controls 4-orbital calculations.
 
*'''{{TAG|AEXX}}'''
There are several other groups that we have not included here. The full documentation for each tag is found on its individual tag page.
** Mixing parameter for exact exchange.
 
*'''{{TAG|HFALPHA}}'''
=== Atom info ===
** Mixing parameter for Hartree-Fock.
 
*'''{{TAG|MCALPHA}}'''
Contains the atomic species and per-ion type information.
** Mixing parameter for Monte Carlo.
 
*'''{{TAG|ALDAX}}'''
<syntaxhighlight lang="xml">
** Mixing parameter for LDA exchange.
 
*'''{{TAG|AGGAX}}'''
<atominfo>
** Mixing parameter for GGA exchange.
  <atoms> 2 </atoms>              <!-- total number of ions -->
*'''{{TAG|AMGGAX}}'''
  <types> 1 </types>              <!-- number of distinct species -->
** Mixing parameter for meta-GGA exchange.
  <array name="atoms">            <!-- per-ion element label and type index -->
*'''{{TAG|ALDAC}}'''
    <dimension dim="1">ion</dimension>
** Mixing parameter for LDA correlation.
    <field type="string">element</field>
*'''{{TAG|AGGAC}}'''
    <field type="int">atomtype</field>
** Mixing parameter for GGA correlation.
    <set>
*'''{{TAG|AMGGAC}}'''
      <rc><c>Si </c><c>  1</c></rc>
** Mixing parameter for meta-GGA correlation.
      <rc><c>Si </c><c>  1</c></rc>
*'''{{TAG|NKREDX}}'''
    </set>
** Reduction of k-points in x-direction for Fock exchange.
  </array>
*'''{{TAG|NKREDY}}'''
  <array name="atomtypes">        <!-- per-species data -->
** Reduction of k-points in y-direction for Fock exchange.
    <dimension dim="1">type</dimension>
*'''{{TAG|NKREDZ}}'''
    <field type="int">atomspertype</field>
** Reduction of k-points in z-direction for Fock exchange.
    <field type="string">element</field>
*'''{{TAG|SHIFTRED}}'''
    <field>mass</field>            <!-- atomic mass in u -->
** Shifts the reduced k-mesh.
    <field>valence</field>        <!-- number of valence electrons -->
*'''{{TAG|ODDONLY}}'''
    <field type="string">pseudopotential</field>  <!-- PAW potential label -->
** Uses odd k-points only.
    <set>
*'''{{TAG|EVENONLY}}'''
      <rc><c>  2</c><c>Si </c><c>    28.08500000</c><c>      4.00000000</c><c>PAW_PBE Si 05Jan2001</c></rc>
** Uses even k-points only.
    </set>
*'''{{TAG|LMAXFOCK}}'''
  </array>
** Maximum angular momentum for Fock exchange.
</atominfo>
*'''{{TAG|NMAXFOCKAE}}'''
</syntaxhighlight>
** Controls basis set for all-electron Fock exchange.
 
*'''{{TAG|LFOCKAEDFT}}'''
=== Initial structure ===
** Performs all-electron Fock exchange.
 
*'''{{TAG|HFSCREEN}}'''
The ionic positions at the start of the run, read from {{FILE|POSCAR}}. For [[:Category:Molecular Dynamics|molecular-dynamics]] runs, this block also contains the initial ionic velocities.
** Screening parameter for hybrid functionals.
 
*'''{{TAG|HFSCREENC}}'''
<syntaxhighlight lang="xml">
** Screening parameter for correlation in hybrid functionals.
<structure name="initialpos">
*'''{{TAG|NBANDSGWLOW}}'''
  <crystal>
** Lower band index for GW calculations.
    <varray name="basis">            <!-- lattice vectors in A -->
*'''VdW DFT'''
      <v>  5.43  0.00  0.00 </v>
** Parameters for van der Waals (vdW) density functional theory.
      <v>  0.00  5.43  0.00 </v>
*'''{{TAG|LUSE_VDW}}'''
      <v>  0.00  0.00  5.43 </v>
** Enables vdW density functional.
    </varray>
*'''{{TAG|IVDW_NL}}'''
    <i name="volume">  160.10 </i>  <!-- cell volume in A^3 -->
** Chooses specific non-local vdW functional.
    <varray name="rec_basis">
*'''{{TAG|LSPIN_VDW}}'''
      <v>  0.184  0.000  0.000 </v>
** Includes spin in vdW calculations.
      <v>  0.000  0.184  0.000 </v>
*'''{{TAG|ZAB_VDW}}'''
      <v>  0.000  0.000  0.184 </v>
** Parameter for vdW-DF.
    </varray>
*'''{{TAG|GAMMA_VDW}}'''
  </crystal>
** Parameter for vdW-DF.
  <varray name="positions">          <!-- fractional (direct) coordinates -->
*'''{{TAG|ALPHA_VDW}}'''
    <v>  0.000  0.000  0.000 </v>
** Parameter for vdW-DF.
    <v>  0.250  0.250  0.250 </v>
*'''{{TAG|PARAM1}}'''
  </varray>
** General parameter for vdW calculations.
  <!-- MD only: -->
*'''{{TAG|PARAM2}}'''
  <varray name="velocities">        <!-- ionic velocities in A/fs -->
** General parameter for vdW calculations.
    <v>  0.0005 -0.0004  0.0002 </v>
*'''{{TAG|BPARAM}}'''
    <v> -0.0009  0.0004  0.0005 </v>
** Parameter for DFT-D3.
  </varray>
*'''{{TAG|CPARAM}}'''
</structure>
** Parameter for DFT-D3.
</syntaxhighlight>
=== '''Model GW''' ===
 
Parameters for model GW calculations.
=== Ionic steps ===
*'''{{TAG|MODEL_GW}}'''
 
** Type of model GW calculation.
For runs with ionic motion ([[:Category:Ionic minimization|relaxations]], [[:Category:Molecular Dynamics|MD]], [[:Category:Transition states|NEB]]), each ionic step is written as a sequence of flat blocks directly under <code><modeling></code>. There is no enclosing <code><calculation></code> element; each step contains:
*'''{{TAG|MODEL_EPS0}}'''
 
** Static dielectric constant for model GW.
<syntaxhighlight lang="xml">
*'''{{TAG|MODEL_ALPHA}}'''
<!-- ionic step i (repeated for each step) -->
** Mixing parameter for model GW.
<structure>
*'''Linear Response Parameters'''
  <crystal>
** Parameters for linear response calculations.
    <varray name="basis"> ... </varray>
*'''{{TAG|LEPSILON}}'''
    <i name="volume"> ... </i>
** Calculates dielectric function.
    <varray name="rec_basis"> ... </varray>
*'''{{TAG|LRPA}}'''
  </crystal>
** Uses RPA for response functions.
  <varray name="positions"> ... </varray>  <!-- fractional coordinates -->
*'''{{TAG|LNABLA}}'''
</structure>
** Calculates derivatives with respect to nabla.
<varray name="forces">              <!-- Hellmann-Feynman forces in eV/A -->
*'''{{TAG|LVEL}}'''
  <v>  0.12 -0.03  0.00 </v>
** Calculates current-current response.
  ...
*'''{{TAG|CSHIFT}}'''
</varray>
** Complex shift for dielectric function.
<varray name="stress">              <!-- stress tensor in kB -->
*'''{{TAG|OMEGAMAX}}'''
  <v> -0.16  0.00  0.11 </v>
** Maximum frequency for response functions.
  <v>  0.00  0.00  0.00 </v>
*'''{{TAG|DEG_THRESHOLD}}'''
  <v>  0.11  0.00 -0.08 </v>
** Threshold for degeneracy.
</varray>
*'''{{TAG|RTIME}}'''
<energy>
** Imaginary part of the frequency in real-time propagation.
  <i name="e_fr_energy"> -53.93 </i>  <!-- free energy F = E - TS (eV) -->
*'''{{TAG|WPLASMAI}}'''
  <i name="e_wo_entrp">  -53.93 </i>  <!-- energy without entropy (eV) -->
** Imaginary part of plasma frequency.
  <i name="e_0_energy">  -53.93 </i>  <!-- energy extrapolated to sigma->0 (eV) -->
*'''{{TAG|DFIELD}}'''
  <!-- MD only: -->
** Applied displacement field.
  <i name="kinetic">      0.10 </i>  <!-- ionic kinetic energy (eV) -->
*'''{{TAG|WPLASMA}}'''
  <i name="lattice kinetic"> 0.00 </i> <!-- lattice kinetic energy, e.g. for NPT (eV) -->
** Plasma frequency parameters.
  <i name="total">      -53.83 </i>  <!-- total energy E + E_kin, conserved in NVE (eV) -->
*'''Orbital Magnetization'''
</energy>
** Parameters for orbital magnetization calculations.
<time name="totalsc"> 0.04 0.01 </time>  <!-- CPU and wall time for this step (s) -->
*'''{{TAG|NUCIND}}'''
</syntaxhighlight>
** Nuclear induced magnetic field.
{{NB|mind|For {{TAG|IBRION}}{{=}}0 ([[:Category:Molecular Dynamics|MD]]) with a large number of steps ({{TAG|NSW}} >> 1), {{FILE|vasprun.xml}} can become very large. Consider using {{FILE|vaspout.h5}} instead, or reading with a streaming XML parser (see [[#Direct XML parsing|below]]).}}
*'''{{TAG|MAGPOS}}'''
 
** Position for local orbital magnetization.
=== Electronic-structure calculation block ===
*'''{{TAG|LNICSALL}}'''
 
** Calculates non-local orbital magnetization for all atoms.
For a [[Setting up an electronic minimization|single-point electronic minimization calculations]] ({{TAG|NSW|0}}) and [[:Category:Many-body perturbation theory|post-DFT methods]] (GW, BSE), a single <code><calculation></code> block instead of per-step ionic-step blocks is written. It contains eigenvalues, the density of states (DOS), the partial DOS ({{TAG|LORBIT}}) and, for optical calculations, the dielectric function ({{TAG|LOPTICS}}).
*'''{{TAG|ORBITALMAG}}'''
 
** Calculates orbital magnetization.
For [[GW calculations]] (e.g., {{TAG|ALGO}}{{=}}EVGW0 or GW0), <code><eigenvalues></code> contains the quasiparticle energies updated by the GW self-energy. Multiple <code><dielectricfunction></code> blocks appear in the same <code><calculation></code>, each labelled by its <code>comment</code> attribute.
*'''{{TAG|LMAGBLOCH}}'''  
 
** Bloch-orbital magnetization.
=== Final structure ===
*'''{{TAG|LCHIMAG}}'''  
 
** Magnetic susceptibility.
The ionic positions at the end of the run. For [[MD runs]], this block also contains the final ionic velocities (also see {{TAG|VELOCITY}} for {{FILE|vaspout.h5}} output), suitable for restarting the trajectory.
*'''{{TAG|LGAUGE}}'''
 
** Applies a gauge transformation.
<syntaxhighlight lang="xml">
*'''{{TAG|MAGATOM}}'''
<structure name="finalpos">
** Specifies atom for local orbital magnetization.
  <crystal>
*'''{{TAG|MAGDIPOL}}'''
    <varray name="basis"> ... </varray>
** Magnetic dipole moments.
    <i name="volume"> ... </i>
*'''{{TAG|AVECCONST}}'''
    <varray name="rec_basis"> ... </varray>
** Constant vector potential.
  </crystal>
*'''Response Functions'''
  <varray name="positions"> ... </varray>
** Parameters for various response function calculations.
  <!-- MD only: -->
*'''{{TAG|LALL_IN_ONE}}'''
  <varray name="velocities"> ... </varray>
** Calculates all response functions in one run.
</structure>
*'''{{TAG|IALL_IN_ONE}}'''
</syntaxhighlight>
** Selects specific response functions.
 
*'''{{TAG|NBANDS_WAVE}}'''  
== Reading vasprun.xml ==
** Number of bands for response function calculations.
=== pymatgen ===
*'''{{TAG|LFINITE_TEMPERATURE}}'''
 
** Finite temperature effects.
The [https://pymatgen.org pymatgen] library provides the <code>Vasprun</code> class:
*'''{{TAG|LADDER}}'''
 
** Includes ladder diagrams.
<syntaxhighlight lang="python">
*'''{{TAG|LRPAFORCE}}'''
from pymatgen.io.vasp import Vasprun
** Calculates RPA forces.
 
*'''{{TAG|LFXC}}'''
vr = Vasprun("vasprun.xml")
** Includes beyond RPA exchange-correlation kernel.
 
*'''{{TAG|LHARTREE}}'''
print(vr.final_energy)        # total energy of the final ionic step (eV)
** Includes Hartree term in response.
 
*'''{{TAG|IBSE}}'''
# Iterate over ionic steps
** Specifies the type of Bethe-Salpeter Equation (BSE) calculation.
for step in vr.ionic_steps:
*'''{{TAG|KPOINT}}'''
    e = step["electronic_steps"][-1]["e_fr_energy"]
** Specific k-point for some response calculations.
    print(e)
*'''{{TAG|LTCTC}}'''
 
** Calculates current-current correlation function.
print(vr.final_structure)    # pymatgen Structure object
*'''{{TAG|LTCTE}}'''
dos = vr.complete_dos        # total and projected DOS
** Calculates current-energy correlation function.
</syntaxhighlight>
*'''{{TAG|LTETE}}'''
 
** Calculates energy-energy correlation function.
=== ASE ===
*'''{{TAG|LTRIPLET}}'''
 
** Includes triplet states in BSE.
The [https://wiki.fysik.dtu.dk/ase/ Atomic Simulation Environment] (ASE) reads {{FILE|vasprun.xml}} as a sequence of <code>Atoms</code> objects:
*'''{{TAG|LFXCEPS}}'''
 
** Includes exchange-correlation effects in the dielectric function.
<syntaxhighlight lang="python">
*'''{{TAG|LFXHEG}}'''
from ase.io import read
** Uses uniform electron gas approximation for exchange-correlation effects.
 
*'''{{TAG|NATURALO}}'''
images = read("vasprun.xml", index=":")  # all ionic steps
** Controls natural orbital calculations.
atoms  = images[-1]                      # final structure
*'''{{TAG|LHOLEGF}}'''
 
** Calculates hole Green's function.
print(atoms.get_potential_energy())      # total energy (eV)
*'''{{TAG|L2ORDER}}'''
print(atoms.get_forces())                # forces (eV/Å)
** Performs second order calculations.
</syntaxhighlight>
*'''{{TAG|LDMP1}}'''
 
** First damping parameter.
=== Direct XML parsing ===
*'''{{TAG|LMP2LT}}'''
==== ElementTree ====
** Performs MP2 calculation for lattice dynamics.
 
*'''{{TAG|LSMP2LT}}'''
For custom workflows, parse {{FILE|vasprun.xml}} with Python's standard library:
** Performs spin-polarized MP2 calculation for lattice dynamics.
 
*'''{{TAG|LGWLF}}'''
<syntaxhighlight lang="python">
** Calculates GW quasiparticle lifetimes.
import xml.etree.ElementTree as ET
*'''{{TAG|ENCUTGW}}'''
 
** Energy cutoff for GW calculations.
tree = ET.parse("vasprun.xml")
*'''{{TAG|ENCUTGWSOFT}}'''
root = tree.getroot()
** Soft energy cutoff for GW calculations.
 
*'''{{TAG|ENCUTLF}}'''
# Read INCAR tags
** Energy cutoff for local field effects.
for tag in root.find("incar"):
*'''{{TAG|ESF_SPLINES}}'''
    print(tag.attrib.get("name"), "=", tag.text.strip())
** Uses splines for energy shift function.
 
*'''{{TAG|ESF_CONV}}'''
# Read forces from each ionic step
** Convergence for energy shift function.
for forces in root.iter("varray"):
*'''{{TAG|ESF_NINTER}}'''
    if forces.attrib.get("name") == "forces":
** Number of interpolation points for energy shift function.
        data = [[float(x) for x in v.text.split()] for v in forces]
*'''{{TAG|LMAXM}}'''
        print(data)
** ADD DESCRIPTION
</syntaxhighlight>
{{NB|mind|For large MD trajectories, use <code>xml.etree.ElementTree.iterparse</code> to stream the file element by element and avoid loading it entirely into memory.}}
 
==== lxml ====
 
There are also plenty of other Python packages that can be used to read {{FILE|vasprun.xml}}, e.g., <code>lxml</code>:
 
<syntaxhighlight lang="python">
from lxml import etree
 
# Parse XML
tree = etree.parse("vasprun.xml")
root = tree.getroot()
 
# Read INCAR tags
incar = root.find("incar")
 
for tag in incar:
    name = tag.attrib.get("name")
    value = tag.text.strip() if tag.text else None
    print(name, "=", value)
 
# Read the final energy
energies = root.xpath(".//i[@name='e_0_energy']/text()")
final_energy = float(energies[-1])
 
print(final_energy)
 
# Read forces from each ionic step
forces_blocks = root.xpath(".//varray[@name='forces']")
 
for forces in forces_blocks:
    data = [
        [float(x) for x in v.text.split()]
        for v in forces
    ]
    print(data)
</syntaxhighlight>
 
There are plenty of other Python packages that can be used, or other languages if you prefer, which we will not describe here.
 
=== Terminal commands ===
==== xmllint ====
The [https://xmllint.com/ xmllint] tool can be used to view the contents of the {{FILE|vasprun.xml}} file based from command line. E.g.,
<syntaxhighlight lang="shell">
xmllint --xpath '//dos/partial' vasprun.xml
</syntaxhighlight>
will print the partial density of states to terminal.  
 
==== xmlstarlet ====
Alternatively, the [https://xmlstar.sourceforge.net/ xmlstarlet] tool can be used {{FILE|vasprun.xml}}, e.g.,
<syntaxhighlight lang="shell">
xmlstarlet sel -t -c '//dos/partial' vasprun.xml
</syntaxhighlight>
will print the partial density of states to terminal.
 
There are several other command line tools that can be used for analysis, e.g., [https://pymatgen.org/#pmg-command-line-interface mpg] that we will not go into detail in here.
 
== Related tags and articles ==
 
* {{FILE|OUTCAR}} — the human-readable logfile.
* {{FILE|vaspout.h5}} — the HDF5 alternative to {{FILE|vasprun.xml}}, preferred for large runs and newer features.
 
[[Category:Files]]
[[Category:Output files]]

Latest revision as of 08:25, 17 June 2026

The vasprun.xml is written in xml format and contains both, general output that is written for any calculation and specific output depending on the method or quantity that is being computed. Below you see details regarding the general output, while the specific output, e.g. the dielectric function (LOPTICS), partial density of states (LORBIT), the electronic self-energy (LSELFENERGY) etc., are detailed on the corresponding tag documentation. Mind that newer features tend to write to vaspout.h5. The vaspout.h5 should generally be preferred for reading large datasets.

File format

The root element is <modeling>. The file uses four repeating XML primitives throughout:

  • value — a named scalar (real, integer, logical, or string).
  • <v name="...">x y z</v> — a named row vector.
  • <varray name="..."> — a named array of vectors, each on a <v> line.
  • <array> — a labelled multi-field table with named dimensions; rows are stored as <r> elements inside <set> blocks.

The overall layout of vasprun.xml is:

 <modeling>
   <generator>   ...  </generator>
   <incar>       ...  </incar>
   <primitive_cell> ... </primitive_cell>
   <kpoints>     ...  </kpoints>
   <parameters>  ...  </parameters>
   <atominfo>    ...  </atominfo>
   <structure name="initialpos"> ... </structure>
 
   <!-- one block per ionic step (MD, relaxation): -->
   <structure> ... </structure>
   <varray name="forces"> ... </varray>
   <varray name="stress"> ... </varray>
   <energy> ... </energy>
   <time name="totalsc"> ... </time>
   ...
 
   <!-- OR a single calculation block (single-point, GW, BSE): -->
   <calculation> ... </calculation>
 
   <structure name="finalpos"> ... </structure>
 </modeling>

Sections

Generator

Contains the VASP version, build details, and the date and time of the run.

 <generator>
   <i name="program"    type="string">vasp </i>
   <i name="version"    type="string">6.5.0  </i>
   <i name="subversion" type="string">29Jan2024 (build Feb 14 2024) complex parallel</i>
   <i name="platform"   type="string">LinuxGNU </i>
   <i name="date"       type="string">2024 01 01 </i>
   <i name="time"       type="string">12:00:00 </i>
 </generator>

INCAR

Contains only the tags explicitly set in the INCAR file, without defaults. This is a compact record of the user-specified settings for the run.

 <incar>
   <i type="string" name="SYSTEM">diamond Si</i>
   <i type="string" name="ALGO">Normal</i>
   <i name="ENCUT">    500.00000000</i>
   <i type="int" name="ISMEAR">     0</i>
   <i name="SIGMA">      0.05000000</i>
 </incar>

Primitive cell

Contains the structure and lattice of the primitive unit cell, along with the mapping of primitive-cell ion indices to the full simulation-cell ion indices.

 <primitive_cell>
   <structure name="primitive_cell">
     <crystal>
       <varray name="basis">            <!-- lattice vectors in A -->
         <v>  1.92  1.92  0.00 </v>
         <v>  0.00  1.92  1.92 </v>
         <v>  1.92  0.00  1.92 </v>
       </varray>
       <i name="volume">     28.35 </i>  <!-- volume in A^3 -->
       <varray name="rec_basis">        <!-- reciprocal lattice vectors in A^-1 -->
         <v>  0.26  0.26 -0.26 </v>
         <v> -0.26  0.26  0.26 </v>
         <v>  0.26 -0.26  0.26 </v>
       </varray>
     </crystal>
     <varray name="positions">          <!-- fractional (direct) coordinates -->
       <v> 0.00  0.00  0.00 </v>
       <v> 0.25  0.25  0.25 </v>
     </varray>
   </structure>
   <varray name="primitive_index">      <!-- index of each primitive ion in the full cell -->
     <v type="int"> 1 </v>
     <v type="int"> 2 </v>
   </varray>
 </primitive_cell>

k points

Specifies the k-point sampling of the Brillouin zone, mirroring the KPOINTS file.

 <kpoints>
   <generation param="Gamma">             <!-- generation scheme: Gamma, Monkhorst-Pack, or Explicit -->
     <v type="int" name="divisions"> 4 4 4 </v>
     <v name="usershift"> 0.0  0.0  0.0 </v>
     <v name="genvec1">   0.25 0.00 0.00 </v>
     <v name="genvec2">   0.00 0.25 0.00 </v>
     <v name="genvec3">   0.00 0.00 0.25 </v>
     <v name="shift">     0.00 0.00 0.00 </v>
   </generation>
   <varray name="kpointlist">             <!-- '''k'''-point coordinates in reciprocal space -->
     <v>  0.000  0.000  0.000 </v>
     <v>  0.250  0.000  0.000 </v>
     ...
   </varray>
   <varray name="weights">               <!-- integration weights, normalized to sum to 1 -->
     <v> 0.00463 </v>
     <v> 0.03704 </v>
     ...
   </varray>
 </kpoints>

Parameters

Contains a complete record of all effective INCAR parameters, including those not set explicitly (with their default values). The block is organized into named <separator> subsections corresponding to groups of related tags, for example:

  • general
  • electronic (with sub-separators: smearing, projectors, startup, spin, exchange-correlation, convergence, mixer, dipolcorrection)
  • grids
  • ionic and ionic md
  • symmetry
  • dos
  • writing
  • performance
  • miscellaneous
  • orbital magnetization
  • response functions (GW/BSE calculations)
  • vdW DFT

There are several other groups that we have not included here. The full documentation for each tag is found on its individual tag page.

Atom info

Contains the atomic species and per-ion type information.

 <atominfo>
   <atoms> 2 </atoms>               <!-- total number of ions -->
   <types> 1 </types>               <!-- number of distinct species -->
   <array name="atoms">             <!-- per-ion element label and type index -->
     <dimension dim="1">ion</dimension>
     <field type="string">element</field>
     <field type="int">atomtype</field>
     <set>
       <rc><c>Si </c><c>   1</c></rc>
       <rc><c>Si </c><c>   1</c></rc>
     </set>
   </array>
   <array name="atomtypes">         <!-- per-species data -->
     <dimension dim="1">type</dimension>
     <field type="int">atomspertype</field>
     <field type="string">element</field>
     <field>mass</field>            <!-- atomic mass in u -->
     <field>valence</field>         <!-- number of valence electrons -->
     <field type="string">pseudopotential</field>   <!-- PAW potential label -->
     <set>
       <rc><c>   2</c><c>Si </c><c>     28.08500000</c><c>      4.00000000</c><c>PAW_PBE Si 05Jan2001</c></rc>
     </set>
   </array>
 </atominfo>

Initial structure

The ionic positions at the start of the run, read from POSCAR. For molecular-dynamics runs, this block also contains the initial ionic velocities.

 <structure name="initialpos">
   <crystal>
     <varray name="basis">            <!-- lattice vectors in A -->
       <v>  5.43  0.00  0.00 </v>
       <v>  0.00  5.43  0.00 </v>
       <v>  0.00  0.00  5.43 </v>
     </varray>
     <i name="volume">   160.10 </i>  <!-- cell volume in A^3 -->
     <varray name="rec_basis">
       <v>  0.184  0.000  0.000 </v>
       <v>  0.000  0.184  0.000 </v>
       <v>  0.000  0.000  0.184 </v>
     </varray>
   </crystal>
   <varray name="positions">          <!-- fractional (direct) coordinates -->
     <v>  0.000  0.000  0.000 </v>
     <v>  0.250  0.250  0.250 </v>
   </varray>
   <!-- MD only: -->
   <varray name="velocities">         <!-- ionic velocities in A/fs -->
     <v>  0.0005 -0.0004  0.0002 </v>
     <v> -0.0009  0.0004  0.0005 </v>
   </varray>
 </structure>

Ionic steps

For runs with ionic motion (relaxations, MD, NEB), each ionic step is written as a sequence of flat blocks directly under <modeling>. There is no enclosing <calculation> element; each step contains:

 <!-- ionic step i (repeated for each step) -->
 <structure>
   <crystal>
     <varray name="basis"> ... </varray>
     <i name="volume"> ... </i>
     <varray name="rec_basis"> ... </varray>
   </crystal>
   <varray name="positions"> ... </varray>   <!-- fractional coordinates -->
 </structure>
 <varray name="forces">               <!-- Hellmann-Feynman forces in eV/A -->
   <v>  0.12 -0.03  0.00 </v>
   ...
 </varray>
 <varray name="stress">               <!-- stress tensor in kB -->
   <v> -0.16  0.00  0.11 </v>
   <v>  0.00  0.00  0.00 </v>
   <v>  0.11  0.00 -0.08 </v>
 </varray>
 <energy>
   <i name="e_fr_energy"> -53.93 </i>  <!-- free energy F = E - TS (eV) -->
   <i name="e_wo_entrp">  -53.93 </i>  <!-- energy without entropy (eV) -->
   <i name="e_0_energy">  -53.93 </i>  <!-- energy extrapolated to sigma->0 (eV) -->
   <!-- MD only: -->
   <i name="kinetic">       0.10 </i>  <!-- ionic kinetic energy (eV) -->
   <i name="lattice kinetic"> 0.00 </i> <!-- lattice kinetic energy, e.g. for NPT (eV) -->
   <i name="total">       -53.83 </i>  <!-- total energy E + E_kin, conserved in NVE (eV) -->
 </energy>
 <time name="totalsc"> 0.04 0.01 </time>   <!-- CPU and wall time for this step (s) -->

Electronic-structure calculation block

For a single-point electronic minimization calculations (NSW = 0) and post-DFT methods (GW, BSE), a single <calculation> block instead of per-step ionic-step blocks is written. It contains eigenvalues, the density of states (DOS), the partial DOS (LORBIT) and, for optical calculations, the dielectric function (LOPTICS).

For GW calculations (e.g., ALGO=EVGW0 or GW0), <eigenvalues> contains the quasiparticle energies updated by the GW self-energy. Multiple <dielectricfunction> blocks appear in the same <calculation>, each labelled by its comment attribute.

Final structure

The ionic positions at the end of the run. For MD runs, this block also contains the final ionic velocities (also see VELOCITY for vaspout.h5 output), suitable for restarting the trajectory.

 <structure name="finalpos">
   <crystal>
     <varray name="basis"> ... </varray>
     <i name="volume"> ... </i>
     <varray name="rec_basis"> ... </varray>
   </crystal>
   <varray name="positions"> ... </varray>
   <!-- MD only: -->
   <varray name="velocities"> ... </varray>
 </structure>

Reading vasprun.xml

pymatgen

The pymatgen library provides the Vasprun class:

from pymatgen.io.vasp import Vasprun

vr = Vasprun("vasprun.xml")

print(vr.final_energy)        # total energy of the final ionic step (eV)

# Iterate over ionic steps
for step in vr.ionic_steps:
    e = step["electronic_steps"][-1]["e_fr_energy"]
    print(e)

print(vr.final_structure)     # pymatgen Structure object
dos = vr.complete_dos         # total and projected DOS

ASE

The Atomic Simulation Environment (ASE) reads vasprun.xml as a sequence of Atoms objects:

from ase.io import read

images = read("vasprun.xml", index=":")   # all ionic steps
atoms  = images[-1]                       # final structure

print(atoms.get_potential_energy())       # total energy (eV)
print(atoms.get_forces())                 # forces (eV/Å)

Direct XML parsing

ElementTree

For custom workflows, parse vasprun.xml with Python's standard library:

import xml.etree.ElementTree as ET

tree = ET.parse("vasprun.xml")
root = tree.getroot()

# Read INCAR tags
for tag in root.find("incar"):
    print(tag.attrib.get("name"), "=", tag.text.strip())

# Read forces from each ionic step
for forces in root.iter("varray"):
    if forces.attrib.get("name") == "forces":
        data = [[float(x) for x in v.text.split()] for v in forces]
        print(data)

lxml

There are also plenty of other Python packages that can be used to read vasprun.xml, e.g., lxml:

from lxml import etree

# Parse XML
tree = etree.parse("vasprun.xml")
root = tree.getroot()

# Read INCAR tags
incar = root.find("incar")

for tag in incar:
    name = tag.attrib.get("name")
    value = tag.text.strip() if tag.text else None
    print(name, "=", value)

# Read the final energy
energies = root.xpath(".//i[@name='e_0_energy']/text()")
final_energy = float(energies[-1])

print(final_energy)

# Read forces from each ionic step
forces_blocks = root.xpath(".//varray[@name='forces']")

for forces in forces_blocks:
    data = [
        [float(x) for x in v.text.split()]
        for v in forces
    ]
    print(data)

There are plenty of other Python packages that can be used, or other languages if you prefer, which we will not describe here.

Terminal commands

xmllint

The xmllint tool can be used to view the contents of the vasprun.xml file based from command line. E.g.,

 xmllint --xpath '//dos/partial' vasprun.xml

will print the partial density of states to terminal.

xmlstarlet

Alternatively, the xmlstarlet tool can be used vasprun.xml, e.g.,

 xmlstarlet sel -t -c '//dos/partial' vasprun.xml

will print the partial density of states to terminal.

There are several other command line tools that can be used for analysis, e.g., mpg that we will not go into detail in here.

Related tags and articles

  • OUTCAR — the human-readable logfile.
  • vaspout.h5 — the HDF5 alternative to vasprun.xml, preferred for large runs and newer features.