Skip to content

Commit 0c87625

Browse files
committed
modify default array when file do not exits
1 parent aafccb2 commit 0c87625

File tree

1 file changed

+7
-7
lines changed

1 file changed

+7
-7
lines changed

deepmd/utils/data.py

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -843,13 +843,13 @@ def _load_single_data(
843843
raise RuntimeError(f"{path} not found!")
844844

845845
# Create a default array based on requirements
846-
if (
847-
vv["atomic"]
848-
and vv["type_sel"] is not None
849-
and not vv["output_natoms_for_type_sel"]
850-
):
851-
natoms = natoms_sel
852-
data = np.full([natoms, ndof], vv["default"], dtype=dtype)
846+
if vv["atomic"]:
847+
if vv["type_sel"] is not None and not vv["output_natoms_for_type_sel"]:
848+
natoms = natoms_sel
849+
data = np.full([natoms, ndof], vv["default"], dtype=dtype)
850+
else:
851+
# For non-atomic data, shape should be [ndof]
852+
data = np.full([ndof], vv["default"], dtype=dtype)
853853
return np.float32(0.0), data
854854

855855
# Branch 2: File exists, use memmap

0 commit comments

Comments
 (0)