Skip to content
Merged
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
5 changes: 3 additions & 2 deletions dpdata/qe/scf.py
Original file line number Diff line number Diff line change
Expand Up @@ -107,9 +107,10 @@ def get_energy(lines):
return energy


def get_force(lines):
def get_force(lines, natoms):
blk = get_block(lines, "Forces acting on atoms", skip=1)
ret = []
blk = blk[0 : sum(natoms)]
for ii in blk:
ret.append([float(jj) for jj in ii.split("=")[1].split()])
ret = np.array(ret)
Expand Down Expand Up @@ -146,7 +147,7 @@ def get_frame(fname):
cell = get_cell(inlines)
atom_names, natoms, types, coords = get_coords(inlines, cell)
energy = get_energy(outlines)
force = get_force(outlines)
force = get_force(outlines, natoms)
stress = get_stress(outlines) * np.linalg.det(cell)
return (
atom_names,
Expand Down