Skip to content

Commit d8acbb8

Browse files
authored
Bug fix of memory overflow when calculating model deviation (#1154)
1 parent 9eb78bf commit d8acbb8

File tree

1 file changed

+7
-6
lines changed

1 file changed

+7
-6
lines changed

deepmd/infer/model_devi.py

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -195,12 +195,13 @@ def make_model_devi(
195195
nframes_tot = 0
196196
devis = []
197197
for data in data_sets:
198-
coord = data["coord"]
199-
box = data["box"]
200-
atype = data["type"][0]
201-
devi = calc_model_devi(coord, box, atype, dp_models, nopbc=nopbc)
202-
nframes_tot += coord.shape[0]
203-
devis.append(devi)
198+
coords = data["coord"]
199+
boxs = data["box"]
200+
atypes = data["type"]
201+
for coord, box, atype in zip(coords, boxs, atypes):
202+
devi = calc_model_devi(np.array([coord]), np.array([box]), atype, dp_models, nopbc=nopbc)
203+
nframes_tot += 1
204+
devis.append(devi)
204205
devis = np.vstack(devis)
205206
devis[:, 0] = np.arange(nframes_tot) * frequency
206207
write_model_devi_out(devis, output)

0 commit comments

Comments
 (0)