Skip to content

Commit

Permalink
Fix slice issue with oszicar
Browse files Browse the repository at this point in the history
  • Loading branch information
sudarshanv01 committed Feb 22, 2024
1 parent 33c6f2a commit 8d47dad
Showing 1 changed file with 9 additions and 2 deletions.
11 changes: 9 additions & 2 deletions src/py4vasp/calculation/_OSZICAR.py
Original file line number Diff line number Diff line change
Expand Up @@ -65,9 +65,16 @@ def _read(self, key):
iteration_number = data[:, 0]
split_index = np.where(iteration_number == 1)[0]
data = np.vsplit(data, split_index)[1:][self._steps]
data = raw.VaspData(data)
if isinstance(self._steps, slice):
data = [raw.VaspData(_data) for _data in data]
else:
data = [raw.VaspData(data)]
data_index = INDEXING_OSZICAR[key]
return data[:, data_index] if not data.is_none() else {}
return_data = [list(_data[:, data_index]) for _data in data]
is_none = [_data.is_none() for _data in data]
if len(return_data) == 1:
return_data = return_data[0]
return return_data if not np.all(is_none) else {}

def to_graph(self, selection="free_energy"):
"""Graph the change in parameter with iteration number.
Expand Down

0 comments on commit 8d47dad

Please sign in to comment.