diff --git a/pyiron_atomistics/vasp/outcar.py b/pyiron_atomistics/vasp/outcar.py index e784fc513..22871e2e5 100644 --- a/pyiron_atomistics/vasp/outcar.py +++ b/pyiron_atomistics/vasp/outcar.py @@ -74,6 +74,8 @@ def from_file(self, filename="OUTCAR"): system_time = self.get_system_time(filename=filename, lines=lines) elapsed_time = self.get_elapsed_time(filename=filename, lines=lines) memory_used = self.get_memory_used(filename=filename, lines=lines) + vasp_version = self.get_vasp_version(filename=filename, lines=lines) + try: ( irreducible_kpoints, @@ -89,7 +91,7 @@ def from_file(self, filename="OUTCAR"): filename=filename, lines=lines ) broyden_mixing = self.get_broyden_mixing_mesh(filename=filename, lines=lines) - + self.parse_dict["vasp_version"] = vasp_version self.parse_dict["energies"] = energies self.parse_dict["energies_int"] = energies_int self.parse_dict["energies_zero"] = energies_zero @@ -177,6 +179,9 @@ def from_hdf(self, hdf, group_name="outcar"): for key in hdf5_output.list_nodes(): self.parse_dict[key] = hdf5_output[key] + def get_vasp_version(self, filename="OUTCAR", lines=None): + return lines[0].lstrip().split(sep=" ")[0] + def get_positions_and_forces(self, filename="OUTCAR", lines=None, n_atoms=None): """ Gets the forces and positions for every ionic step from the OUTCAR file @@ -952,6 +957,14 @@ def get_band_properties(filename="OUTCAR", lines=None): is_spin_polarized = True for line in lines_new[ind + 1 :]: data = line.strip().split() + # This if "Fermi" bypass needs to exist because of VASP changing it's OUTCAR format after 6.1.0 + # In all versions prior, searching "Fermi" will only yield 2 mentions in the OUTCAR + # In the new versions, a Fermi energy is printed immediately after each spin-component k-point text block: + # i.e. Fermi energy: XXXXX + # This breaks the (old) parser, and thus this bypass is necessary to skip this last line at each spin component block + # Ugly and hacky, but parsing the OUTCAR is a ugly and hacky endeavour in general + if "Fermi" in data: + continue if len(data) != 3: break band_data.append([float(d) for d in data[1:]])