Skip to content

Commit

Permalink
abacus: fix bug in collect force
Browse files Browse the repository at this point in the history
  • Loading branch information
pxlxingliang committed Jun 6, 2024
1 parent 4bb4069 commit 808a3a0
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions dpdata/abacus/scf.py
Original file line number Diff line number Diff line change
Expand Up @@ -190,7 +190,7 @@ def collect_force(outlines):
def get_force(outlines, natoms):
force = collect_force(outlines)
if len(force) == 0:
return [[]]
return None
else:
return np.array(force[-1]) # only return the last force

Expand Down Expand Up @@ -285,7 +285,7 @@ def get_frame(fname):
data["cells"] = cell[np.newaxis, :, :]
data["coords"] = coords[np.newaxis, :, :]
data["energies"] = np.array(energy)[np.newaxis]
data["forces"] = force[np.newaxis, :, :]
data["forces"] = np.empty((0,)) if force is None else force[np.newaxis, :, :]
if stress is not None:
data["virials"] = stress[np.newaxis, :, :]
data["orig"] = np.zeros(3)
Expand Down

0 comments on commit 808a3a0

Please sign in to comment.