Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fixes outcar parsing for VASP >6.1.0 #864

Merged
merged 1 commit into from
Nov 11, 2022
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
15 changes: 14 additions & 1 deletion pyiron_atomistics/vasp/outcar.py
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand All @@ -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
Expand Down Expand Up @@ -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
Expand Down Expand Up @@ -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:]])
Expand Down