Skip to content

Commit

Permalink
Merge pull request #17 from link89/fix-2023-support
Browse files Browse the repository at this point in the history
adapt to CP2K 2023.1 data format
  • Loading branch information
robinzyb authored Sep 7, 2023
2 parents 7142fae + 5bb5e78 commit ba8b826
Showing 1 changed file with 8 additions and 8 deletions.
16 changes: 8 additions & 8 deletions cp2kdata/block_parser/coordinates.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@

INIT_ATOMIC_COORDINATES_RE = re.compile(
r"""
\sMODULE\sQUICKSTEP:\s\sATOMIC\sCOORDINATES\sIN\sangstrom\s*\n
\sMODULE\sQUICKSTEP:\s+ATOMIC\sCOORDINATES\sIN\sangstrom\s*\n
\n
\s+Atom\s+Kind\s+Element\s+X\s+Y\s+Z\s+Z\(eff\)\s+Mass\s*\n
(\n)?
Expand All @@ -12,15 +12,15 @@
\s+(?P<kind>\d+)
\s+(?P<element>\w+)
\s+\d+
\s+(?P<x>[\s-]\d+\.\d+)
\s+(?P<y>[\s-]\d+\.\d+)
\s+(?P<z>[\s-]\d+\.\d+)
\s+[\s-]\d+\.\d+
\s+[\s-]\d+\.\d+
\s+(?P<x>[-]?\d+\.\d+)
\s+(?P<y>[-]?\d+\.\d+)
\s+(?P<z>[-]?\d+\.\d+)
\s+[-]?\d+\.\d+
\s+[-]?\d+\.\d+
\n
)+
""",
re.VERBOSE
re.VERBOSE | re.IGNORECASE,
)


Expand All @@ -34,7 +34,7 @@ def parse_init_atomic_coordinates(output_file):
init_atomic_coordinates.append([x, y, z])
atom_kind_list = [int(kind) for kind in match.captures("kind")]
chemical_symbols = match.captures("element")

if init_atomic_coordinates:
return np.array(init_atomic_coordinates, dtype=float), np.array(atom_kind_list, dtype=int), chemical_symbols
else:
Expand Down

0 comments on commit ba8b826

Please sign in to comment.