Skip to content

Commit

Permalink
fix cp2k 2023 output (#533)
Browse files Browse the repository at this point in the history
fix #508,
#507

---------

Signed-off-by: link89 <[email protected]>
Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
  • Loading branch information
link89 and pre-commit-ci[bot] authored Sep 6, 2023
1 parent 002e073 commit ec7985b
Showing 1 changed file with 10 additions and 16 deletions.
26 changes: 10 additions & 16 deletions dpdata/cp2k/output.py
Original file line number Diff line number Diff line change
Expand Up @@ -409,24 +409,18 @@ def get_frames(fname):
cell.append(ii.split()[4:7])
if "Atomic kind:" in ii:
atom_symbol_list.append(ii.split()[3])
if "Atom Kind Element" in ii:

# beginning of coords block
if "Atom Kind Element" in ii or "Atom Kind Element" in ii:
coord_flag = True
coord_idx = idx
# parse coords lines
elif coord_flag:
if ii == "\n":
coord_flag = len(coord) == 0 # skip empty line at the beginning
else:
coord.append(ii.split()[4:7])
atom_symbol_idx_list.append(ii.split()[1])

# get the coord block info
if coord_flag:
if idx == coord_idx + 1:
if ii == "\n":
pass
else:
coord.append(ii.split()[4:7])
atom_symbol_idx_list.append(ii.split()[1])
if idx > coord_idx + 1:
if ii == "\n":
coord_flag = False
else:
coord.append(ii.split()[4:7])
atom_symbol_idx_list.append(ii.split()[1])
if "ENERGY|" in ii:
energy = ii.split()[8]
if " Atom Kind " in ii:
Expand Down

0 comments on commit ec7985b

Please sign in to comment.