vasprun-xml is a Python package designed for rapid analysis of VASP calculation results directly from the `vasprun.xml` file. It supports features like band gap calculation, plotting of Density of States (DOS) and band structures, generation of INCAR/POTCAR/POSCAR files, force analysis, and Kohn-Sham orbital eigenvalue analysis. The current PyPI version is 1.0.4, with active development and regular updates.
pip install vasprun-xmlVerified import paths — ran on the pinned version, not inferred.
Initializes the `vasprun` parser with a `vasprun.xml` file, then demonstrates how to check for calculation errors and extract basic properties like chemical formula and band gap. Note that plotting functions require a complete `vasprun.xml` containing the relevant data sections.
Ensure your environment uses Python 3.6.1 or newer. Upgrade your Python installation if necessary.
Ensure VASP calculations terminate gracefully. If using a job scheduler or workflow manager, implement mechanisms for graceful termination (e.g., writing a `STOPCAR` file). For existing corrupted files, manual editing may be required, or the VASP calculation must be re-run.
Consult the `vasprun-xml` documentation or GitHub issues for known compatibility notes with specific VASP versions. If encountering parsing issues, verify the XML structure against an expected format for your VASP version.
Verify that your VASP calculation completed successfully. If not, re-run the calculation ensuring a graceful termination. For partially written files, try opening the XML in a text editor to identify and potentially manually fix truncation points, though a re-run is generally more reliable.
Use `from vasprun import vasprun` or `import vasprun` in your Python code. The installation command `pip install vasprun-xml` installs the package under the `vasprun` module name.
First, ensure `matplotlib` is installed (`pip install matplotlib`). Second, confirm that your `vasprun.xml` file contains the relevant sections (e.g., `EIGENVAL` for bands, `DOS` for density of states) as output by VASP.