Skip to content

Commit ed36276

Browse files
amcadmusHan Wang
andauthored
fix data_modifier OOM problem when set size is too large (#1117)
Co-authored-by: Han Wang <[email protected]>
1 parent 97be2f5 commit ed36276

File tree

1 file changed

+10
-1
lines changed

1 file changed

+10
-1
lines changed

deepmd/infer/data_modifier.py

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -358,7 +358,16 @@ def _extend_system(self, coord, box, atype, charge):
358358
ref_coord = coord3[:,sel_idx_map,:]
359359
ref_coord = np.reshape(ref_coord, [nframes, nsel * 3])
360360

361-
dipole = DeepDipole.eval(self, coord, box, atype)
361+
batch_size = 8
362+
all_dipole = []
363+
for ii in range(0,nframes,batch_size):
364+
dipole = DeepDipole.eval(self,
365+
coord[ii:ii+batch_size],
366+
box[ii:ii+batch_size],
367+
atype)
368+
all_dipole.append(dipole)
369+
dipole = np.concatenate(all_dipole, axis = 0)
370+
assert(dipole.shape[0] == nframes)
362371
dipole = np.reshape(dipole, [nframes, nsel * 3])
363372

364373
wfcc_coord = ref_coord + dipole

0 commit comments

Comments
 (0)