Skip to content
Closed
Show file tree
Hide file tree
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
12 changes: 5 additions & 7 deletions dpdata/abacus/md.py
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,7 @@ def get_coords_from_dump(dumplines, natoms):
for iline in range(nlines):
if "MDSTEP" in dumplines[iline]:
# read in LATTICE_CONSTANT
celldm = float(dumplines[iline + 1].split(" ")[-1])
celldm = float(dumplines[iline + 1].split(" ")[-2])
# read in LATTICE_VECTORS
for ix in range(3):
cells[iframe, ix] = (
Expand All @@ -98,7 +98,7 @@ def get_coords_from_dump(dumplines, natoms):
[
float(i)
for i in re.split("\s+", dumplines[iline + 11 + iat])[
-6:-3
3:6
]
]
)
Expand All @@ -107,7 +107,7 @@ def get_coords_from_dump(dumplines, natoms):
forces[iframe, iat] = np.array(
[
float(i)
for i in re.split("\s+", dumplines[iline + 11 + iat])[-3:]
for i in re.split("\s+", dumplines[iline + 11 + iat])[6:9]
]
)
else:
Expand All @@ -116,7 +116,7 @@ def get_coords_from_dump(dumplines, natoms):
[
float(i)
for i in re.split("\s+", dumplines[iline + 7 + iat])[
-6:-3
3:6
]
]
)
Expand All @@ -125,16 +125,14 @@ def get_coords_from_dump(dumplines, natoms):
forces[iframe, iat] = np.array(
[
float(i)
for i in re.split("\s+", dumplines[iline + 7 + iat])[-3:]
for i in re.split("\s+", dumplines[iline + 7 + iat])[6:9]
]
)
iframe += 1
assert iframe == nframes_dump, (
"iframe=%d, nframe_dump=%d. Number of frames does not match number of lines in MD_dump."
% (iframe, nframes_dump)
)
cells *= bohr2ang
coords *= bohr2ang
stresses *= kbar2evperang3
return coords, cells, forces, stresses

Expand Down
Loading