from pymatgen.io.vasp.outputs import Vasprun vasp_run = Vasprun('vasprun.xml') vasprun_dict = vasp_run.as_dict() print(vasprun_dict.keys())
from pymatgen.io.vasp.outputs import Vasprun vasp_run = Vasprun('vasprun.xml') magnetization = vasp_run.as_dict()['calculation']['magnetization'] print(magnetization)This code snippet reads the vasprun.xml file and converts it into a dictionary using as_dict method. It then extracts the magnetization data from the resulting dictionary and prints it. The package library for this code is pymatgen.