Skip to main content

Fast parser for VASP vasprun.xml files

Project description

vasprunrs

A fast parser for VASP vasprun.xml files, written in Rust with Python bindings.

vasprunrs is a drop-in replacement for pymatgen.io.vasp.outputs.Vasprun that parses the same files 5–10x faster using a streaming Rust XML parser. It returns native pymatgen objects (Structure, CompleteDos, BandStructure, etc.) so existing code needs only a one-line import change.

Installation

pip install vasprunrs

# with pymatgen compatibility shim (recommended)
pip install "vasprunrs[pymatgen]"

Usage

Drop-in replacement for pymatgen

# Before
from pymatgen.io.vasp import Vasprun

# After
from vasprunrs.pymatgen import Vasprunrs as Vasprun
vr = Vasprun("vasprun.xml")

structure      = vr.final_structure       # pymatgen Structure
dos            = vr.complete_dos          # pymatgen CompleteDos
band_structure = vr.get_band_structure()  # pymatgin BandStructure
eigenvalues    = vr.eigenvalues           # {Spin.up: ndarray, ...}

Native API (no pymatgen required)

from vasprunrs import Vasprun

vr = Vasprun("vasprun.xml", parse_dos=True, parse_eigen=True)

print(vr.version)           # "6.4.2"
print(vr.efermi)            # 4.123 (eV)
print(vr.final_structure)   # dict with lattice, positions, species
print(vr.eigenvalues.shape) # (nspins, nkpts, nbands, 2)
print(vr.dos)               # dict with efermi, total, partial

Features

Feature Status
INCAR parameters (typed) supported
Atomic info (mass, valence, pseudopotential) supported
K-points (mesh, weights, labels) supported
Initial and final structures supported
Ionic steps (forces, stress, energies) supported
Eigenvalues and occupancies supported
Projected eigenvalues (LORBIT ≥ 10) supported (opt-in)
Total DOS supported
Partial DOS (site + orbital) supported
Dielectric function supported
Fermi level supported
Spin-polarized calculations supported
Non-collinear / SOC supported
Line-mode k-points (band structure) supported
GW post-processing supported
Overflow values (NaN) handled
Magnetic moments (per-atom, collinear + non-collinear) supported
Force constants / phonons not yet implemented
Born effective charges not yet implemented

Performance

vasprunrs uses a streaming XML parser that does not load the entire file into memory. Parse times are typically 5–10x faster than pymatgen's Python parser.

Parse options

Both the native Vasprun and the compatibility Vasprunrs accept the same options:

Option Default Description
parse_dos True Parse density of states
parse_eigen True Parse eigenvalues
parse_projected_eigen False Parse projected eigenvalues (can be large)
ionic_step_skip None Parse every Nth ionic step
ionic_step_offset 0 Skip the first N ionic steps

Known limitations

  • converged_electronic and converged_ionic are not tracked separately (both reflect the same value)
  • Epsilon static/ionic tensors (epsilon_static, epsilon_ionic) are not parsed from the DFPT block
  • Force constants / phonons and Born effective charges are not yet implemented

Note on per-atom magnetic moments: Vasprunrs.magnetization reads the <varray name="magnetization"> block from each ionic step. This block is written by VASP 5.x but is absent in VASP 6.x output, so magnetization will return None for all VASP 6.x files regardless of whether the calculation is magnetic. Per-atom moments for VASP 6.x can be recovered by integrating the partial DOS up to the Fermi energy (spin-up minus spin-down per atom), which requires parse_dos=True and LORBIT ≥ 11 in the INCAR.

Requirements

  • Python 3.9+
  • numpy
  • pymatgen (optional, for vasprunrs[pymatgen])

License

MIT

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

vasprunrs-0.1.0.tar.gz (7.0 MB view details)

Uploaded Source

Built Distributions

If you're not sure about the file name format, learn more about wheel file names.

vasprunrs-0.1.0-cp313-cp313-win_amd64.whl (482.5 kB view details)

Uploaded CPython 3.13Windows x86-64

vasprunrs-0.1.0-cp313-cp313-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (643.0 kB view details)

Uploaded CPython 3.13manylinux: glibc 2.17+ x86-64

vasprunrs-0.1.0-cp313-cp313-manylinux_2_17_aarch64.manylinux2014_aarch64.whl (632.0 kB view details)

Uploaded CPython 3.13manylinux: glibc 2.17+ ARM64

vasprunrs-0.1.0-cp313-cp313-macosx_11_0_arm64.whl (584.0 kB view details)

Uploaded CPython 3.13macOS 11.0+ ARM64

vasprunrs-0.1.0-cp313-cp313-macosx_10_12_x86_64.whl (594.1 kB view details)

Uploaded CPython 3.13macOS 10.12+ x86-64

vasprunrs-0.1.0-cp312-cp312-win_amd64.whl (483.0 kB view details)

Uploaded CPython 3.12Windows x86-64

vasprunrs-0.1.0-cp312-cp312-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (643.6 kB view details)

Uploaded CPython 3.12manylinux: glibc 2.17+ x86-64

vasprunrs-0.1.0-cp312-cp312-manylinux_2_17_aarch64.manylinux2014_aarch64.whl (633.2 kB view details)

Uploaded CPython 3.12manylinux: glibc 2.17+ ARM64

vasprunrs-0.1.0-cp312-cp312-macosx_11_0_arm64.whl (584.3 kB view details)

Uploaded CPython 3.12macOS 11.0+ ARM64

vasprunrs-0.1.0-cp312-cp312-macosx_10_12_x86_64.whl (594.4 kB view details)

Uploaded CPython 3.12macOS 10.12+ x86-64

vasprunrs-0.1.0-cp311-cp311-win_amd64.whl (481.6 kB view details)

Uploaded CPython 3.11Windows x86-64

vasprunrs-0.1.0-cp311-cp311-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (641.9 kB view details)

Uploaded CPython 3.11manylinux: glibc 2.17+ x86-64

vasprunrs-0.1.0-cp311-cp311-manylinux_2_17_aarch64.manylinux2014_aarch64.whl (631.3 kB view details)

Uploaded CPython 3.11manylinux: glibc 2.17+ ARM64

vasprunrs-0.1.0-cp311-cp311-macosx_11_0_arm64.whl (585.4 kB view details)

Uploaded CPython 3.11macOS 11.0+ ARM64

vasprunrs-0.1.0-cp311-cp311-macosx_10_12_x86_64.whl (595.7 kB view details)

Uploaded CPython 3.11macOS 10.12+ x86-64

File details

Details for the file vasprunrs-0.1.0.tar.gz.

File metadata

  • Download URL: vasprunrs-0.1.0.tar.gz
  • Upload date:
  • Size: 7.0 MB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: maturin/1.12.6

File hashes

Hashes for vasprunrs-0.1.0.tar.gz
Algorithm Hash digest
SHA256 809bd01b8a3517ea178287a95f70426465c1694566e9b6ed5f1e26a9cfa00cdc
MD5 62cc4a98c54eb37d22f4c522e66af7bb
BLAKE2b-256 9a98a635fc03adcd7b5b97caa8eb02d31d951df10423eddb9830f539c3763add

See more details on using hashes here.

File details

Details for the file vasprunrs-0.1.0-cp313-cp313-win_amd64.whl.

File metadata

File hashes

Hashes for vasprunrs-0.1.0-cp313-cp313-win_amd64.whl
Algorithm Hash digest
SHA256 48bc9c6dc7cb578e99b99b5c2df744a7c56f027eae0043b4087a24b4219f2ebf
MD5 c4e89f5c1e0ada328b63b80f1f2e484f
BLAKE2b-256 29104944fa03e61b5d8fc24332d3ee1476e775b0bfe2a8433eed0bea34b62e35

See more details on using hashes here.

File details

Details for the file vasprunrs-0.1.0-cp313-cp313-manylinux_2_17_x86_64.manylinux2014_x86_64.whl.

File metadata

File hashes

Hashes for vasprunrs-0.1.0-cp313-cp313-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 7b40f2e945bbe8ceb768c346e953f5df17f408a36eaa8e98537390ed31599b6a
MD5 2e616017955491f77eed7d3568d4956a
BLAKE2b-256 ecf1b9dd5e1e7844128919be4a61f40ff76a16fe34cdf0964d9b9b0e406e4d6f

See more details on using hashes here.

File details

Details for the file vasprunrs-0.1.0-cp313-cp313-manylinux_2_17_aarch64.manylinux2014_aarch64.whl.

File metadata

File hashes

Hashes for vasprunrs-0.1.0-cp313-cp313-manylinux_2_17_aarch64.manylinux2014_aarch64.whl
Algorithm Hash digest
SHA256 a40cf46f0a0dd8c9bf8979f5461d5e9583c9bfeeb332bad88ae562d4bb7a8fed
MD5 d46ae01c4f19b535a2f9d699ca9f5eb4
BLAKE2b-256 0982742ea8cea405fba02e22ec0cf7fda033b57c2baae291839cd5f1a0db55bd

See more details on using hashes here.

File details

Details for the file vasprunrs-0.1.0-cp313-cp313-macosx_11_0_arm64.whl.

File metadata

File hashes

Hashes for vasprunrs-0.1.0-cp313-cp313-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 57f4fdfa2e51eb4097a034bba00ccee1a3c8d453ab2597815e33188621d04c49
MD5 4aea300574a5d58b7427f3e88eb31f16
BLAKE2b-256 8951ea07414a2f81127dc0606bec08ab5ab7bfbf338a91ee454bf02f6ec75d01

See more details on using hashes here.

File details

Details for the file vasprunrs-0.1.0-cp313-cp313-macosx_10_12_x86_64.whl.

File metadata

File hashes

Hashes for vasprunrs-0.1.0-cp313-cp313-macosx_10_12_x86_64.whl
Algorithm Hash digest
SHA256 7cb46ad99f64abb20ed656eec6e01f100dd75b30fffbf2c4d092cab6f833027f
MD5 3fc81f490adccab8c7334e77397e93f7
BLAKE2b-256 fe47421aab877823a396f6ec2a9d66533ce1e0b5b8c9e8a3f72847758143916f

See more details on using hashes here.

File details

Details for the file vasprunrs-0.1.0-cp312-cp312-win_amd64.whl.

File metadata

File hashes

Hashes for vasprunrs-0.1.0-cp312-cp312-win_amd64.whl
Algorithm Hash digest
SHA256 6e190f1fc8abd60a14f782721176e3ef7a8beb8e89f69c71ebb8ce9ec18996c0
MD5 be4fcf16c9bc45248eece7dca07fda71
BLAKE2b-256 aeb29f487a183492fcc4d2d639a6bba7ae28e5febcc1e8613e2cf45dead52bcd

See more details on using hashes here.

File details

Details for the file vasprunrs-0.1.0-cp312-cp312-manylinux_2_17_x86_64.manylinux2014_x86_64.whl.

File metadata

File hashes

Hashes for vasprunrs-0.1.0-cp312-cp312-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 65a7910a27749848c070d96a6af7173815dc570a546ed2720e4124c1326bcbf7
MD5 6827ffad34fe8268ce362dbf622f1e63
BLAKE2b-256 dd62560572dbff10957ac5fb873386455aa004801fb1400c43a7a39a4f9ce3cc

See more details on using hashes here.

File details

Details for the file vasprunrs-0.1.0-cp312-cp312-manylinux_2_17_aarch64.manylinux2014_aarch64.whl.

File metadata

File hashes

Hashes for vasprunrs-0.1.0-cp312-cp312-manylinux_2_17_aarch64.manylinux2014_aarch64.whl
Algorithm Hash digest
SHA256 e7b73b00fe1ec58b885ba35f60eb82c3bbcd93fdc04564cf0e014a8c5000975e
MD5 a48a3e4f68534d3b5fc560f10fdf9a05
BLAKE2b-256 ea20e5297fd6cba5e3d9deff67dfd2c33f2deab6f6f483ffc63067c21bb30dd4

See more details on using hashes here.

File details

Details for the file vasprunrs-0.1.0-cp312-cp312-macosx_11_0_arm64.whl.

File metadata

File hashes

Hashes for vasprunrs-0.1.0-cp312-cp312-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 49cd3901d55906113d712145ff260da4ebd4f466bf92d1e01381a45bbb4edb4a
MD5 cd826a067c5fdb69f350a6b528483284
BLAKE2b-256 c37bf4e11912ae1b29d4d607bfcccd5ea6648a13c05020a927a4e91890938a70

See more details on using hashes here.

File details

Details for the file vasprunrs-0.1.0-cp312-cp312-macosx_10_12_x86_64.whl.

File metadata

File hashes

Hashes for vasprunrs-0.1.0-cp312-cp312-macosx_10_12_x86_64.whl
Algorithm Hash digest
SHA256 ae3c9eb5a4f63d7e6a50bf3b80a9c632b3815973079817fd710c4dac7ee4a9c1
MD5 c250443d2162532ea50199a853518c47
BLAKE2b-256 3f098a03b5afb61da3697ab75d7d70affa0dc7edd04d255c35123967437d89c4

See more details on using hashes here.

File details

Details for the file vasprunrs-0.1.0-cp311-cp311-win_amd64.whl.

File metadata

File hashes

Hashes for vasprunrs-0.1.0-cp311-cp311-win_amd64.whl
Algorithm Hash digest
SHA256 7b760df70165f05a6bb35b211c6005846482b693cb0b630981df7820b22d4c2f
MD5 2399350da5d1420c710408793d8d928d
BLAKE2b-256 cc64425250ea9bc6de8a0aa10c49c27ae422b42d1f97d7003d2b569574e0166b

See more details on using hashes here.

File details

Details for the file vasprunrs-0.1.0-cp311-cp311-manylinux_2_17_x86_64.manylinux2014_x86_64.whl.

File metadata

File hashes

Hashes for vasprunrs-0.1.0-cp311-cp311-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 a5a91c839ba7a12383f502234f4301f4533b17215d2bfac9c4cb7c1c6c200044
MD5 5a024d2046beeb6312f555c66ed093b0
BLAKE2b-256 d03a58d0c8a88dda10ac1a5fa31de4fefd7917eefa234412b36d1ceb1cb145a1

See more details on using hashes here.

File details

Details for the file vasprunrs-0.1.0-cp311-cp311-manylinux_2_17_aarch64.manylinux2014_aarch64.whl.

File metadata

File hashes

Hashes for vasprunrs-0.1.0-cp311-cp311-manylinux_2_17_aarch64.manylinux2014_aarch64.whl
Algorithm Hash digest
SHA256 9b456596cf924acdb044e38c04e2712375476c43690814ac26f4453ddcbc4071
MD5 95d674576687bc49bab530d95366ee44
BLAKE2b-256 247c00aaad693c623c49e6eebced8f13b17c34ee38e6e7122438192eb35014b6

See more details on using hashes here.

File details

Details for the file vasprunrs-0.1.0-cp311-cp311-macosx_11_0_arm64.whl.

File metadata

File hashes

Hashes for vasprunrs-0.1.0-cp311-cp311-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 73dcd2a9a07f9f40a1a535ba7d7528b00cf50d59d66ec366d42e9dbdfafc4c0a
MD5 7a9474b89555d0e3dc45414b9fdd7a19
BLAKE2b-256 5f6e7ad22151afddcdca14a2d33584d77f690b4acfb21587fdb6956d7d61d092

See more details on using hashes here.

File details

Details for the file vasprunrs-0.1.0-cp311-cp311-macosx_10_12_x86_64.whl.

File metadata

File hashes

Hashes for vasprunrs-0.1.0-cp311-cp311-macosx_10_12_x86_64.whl
Algorithm Hash digest
SHA256 e3d38cd7330d8cfd9f1abcdd81b5bcb5e04a7b4da7bedbcd429096a446494fad
MD5 90dbfdb5457c6b7fba3f94e757b0f97c
BLAKE2b-256 1321f8e424fa90df6fbd1dd9faac93c148da8154acfb64b17a4ae704ee728e84

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page