Including total magnetization and number of electrons in vasprun.xml

Queries about input and output files, running specific calculations, etc.


Moderators: Global Moderator, Moderator

Post Reply
Message
Author
sean_kavanagh
Newbie
Newbie
Posts: 5
Joined: Mon Nov 18, 2019 3:22 pm

Including total magnetization and number of electrons in vasprun.xml

#1 Post by sean_kavanagh » Wed Apr 16, 2025 7:42 pm

Dear VASP developers,
I was wondering if it was possible to include the total magnetization (and ideally total electron count, and total orbital-projected magnetization values) in the vasprun.xml outputs in future VASP versions?
These are very useful outputs which are included in the OUTCAR files, however many codes (such as pymatgen, ASE, doped etc) aim to use the vasprun.xml files as the core outputs to parse from VASP, as it usually contains most/all relevant information from a VASP calculation for most cases. However these useful outputs mentioned here are not written to the vasprun.xml (e.g. see the specific properties parsed by pymatgen's OUTCAR parser, which are mostly those that are not included in the vasprun.xml; https://pymatgen.org/pymatgen.io.vasp.h ... uts.Outcar), so makes it harder to parse and automatically include them in follow-on analyses (adding user and maintenance burdens). They are also lightweight so would not add any noticeable bloat to the vasprun.xml file.

I can reverse-engineer/estimate most of these properties from the eigenvalues and projected magnetisation arrays in the vasprun.xml, but having these total values would be much faster and cleaner. I'm not sure if the vaspout.h5 is intended to be the core VASP summary file in future.

Thanks for your time and work on this code!
Best,
Seán

PS: It is specifically the "number of electron 563.9999897 magnetization -1.0172531 0.0009025 0.8805008" and "magnetization (x)" etc outputs in the OUTCAR I'm referring to here.


michael_wolloch
Global Moderator
Global Moderator
Posts: 164
Joined: Tue Oct 17, 2023 10:17 am

Re: Including total magnetization and number of electrons in vasprun.xml

#2 Post by michael_wolloch » Thu Apr 17, 2025 10:24 am

Hi Sean Kavanagh,

I am sorry to tell you that there are no plans to extend the contents of the vasprun.xml file. We are fully committed to the HDF5 file format for machine-readable output.

I have to agree that the situation is not perfect right now. As you wrote, not a single file contains all the information. We are in contact with pymatgen and ASE regularly, and ultimately, everyone agrees that the HDF5 file(s) are the way forward.

Since VASP version 6.5.0, the magnetic moments (spin, and orbitals as well, if they are computed) are written to the vaspout.h5 and can be printed with py4vasp at each ionic step. E.g., for the last step:

Code: Select all

from py4vasp import Calculation
calc = Calculation.from_file("vaspout.h5")
calc.magnetism[-1].moments()

While the total number of electrons (NELECT) is written to the vaspout.h5, file (dataset "nelectrons"), I do not think that the "number of electron ..." lines of the OUTCAR are written at every electronic step. If that is something you require, I can see if that is feasible to do.

Feel free to suggest additions for the vaspout.h5 file, and features for py4vasp!
Cheers, Michael


Post Reply