I’ve been converting an outcar file of VASP AIMD to extxyz using ase to prepare training set for NequIP and MACE using a following script:
from ase.io import read, write
input_file="./input.outcar"
output_file="./output.extxyz"
input_data = read(input_file, index=':', format='vasp-out')
write(output_file, input_data, format='extxyz')
But now, if I want to calculate virial and print out to information line, I need to use get volume() and get_stress() but those cannot be used for list data (because I read the whole file using index : ).
input_data.info["virial"] = -input_data.get_volume() * input_data.get_stress(voigt=True)
Also, my Vasp outcar file has hirshfeld charge for all atoms of all frames. I hope to print those Hirshfeld charge value as additional column of extxyz file for all frames. But get_charges() requires calculator, I can’t find any example to follow…
How can I print out extxyz of all frames from Outcar file, that includes virial in information line & charge as new column for all frames?