Skip to content

Commit 336d385

Browse files
zjgemipre-commit-ci[bot]wanghan-iapcmcoderabbitai[bot]
authored
Fix bugs related to lammps PIMD (#266)
<!-- This is an auto-generated comment: release notes by coderabbit.ai --> ## Summary by CodeRabbit - **Bug Fixes** - Improved control flow for LAMMPS task execution by adjusting file merging process. - Enhanced validation of optional outputs to ensure they contain valid values. - Added checks to prevent errors when validating file paths. - **Style** - Improved code readability with formatting adjustments and additional newlines. <!-- end of auto-generated comment: release notes by coderabbit.ai --> --------- Signed-off-by: zjgemi <[email protected]> Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com> Co-authored-by: Han Wang <[email protected]> Co-authored-by: coderabbitai[bot] <136622811+coderabbitai[bot]@users.noreply.github.com>
1 parent 850eb22 commit 336d385

File tree

3 files changed

+5
-4
lines changed

3 files changed

+5
-4
lines changed

dpgen2/op/collect_data.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -95,9 +95,9 @@ def execute(
9595

9696
ms = dpdata.MultiSystems(type_map=type_map)
9797
for ii in labeled_data:
98-
if len(list(ii.rglob("fparam.npy"))) > 0:
98+
if ii and len(list(ii.rglob("fparam.npy"))) > 0:
9999
setup_ele_temp(False)
100-
if len(list(ii.rglob("aparam.npy"))) > 0:
100+
if ii and len(list(ii.rglob("aparam.npy"))) > 0:
101101
setup_ele_temp(True)
102102
ss = dpdata.LabeledSystem(ii, fmt="deepmd/npy")
103103
ms.append(ss)

dpgen2/op/run_lmp.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -195,7 +195,8 @@ def execute(
195195
with open("job.json", "w") as f:
196196
json.dump(data, f, indent=4)
197197

198-
merge_pimd_files()
198+
merge_pimd_files()
199+
199200
ret_dict = {
200201
"log": work_dir / lmp_log_name,
201202
"traj": work_dir / lmp_traj_name,

dpgen2/op/select_confs.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -126,7 +126,7 @@ def validate_trajs(
126126
if tt is not None and mm is not None:
127127
rett.append(tt)
128128
retm.append(mm)
129-
if optional_outputs:
129+
if optional_outputs and any(optional_outputs):
130130
oo = optional_outputs[i]
131131
if oo is not None:
132132
reto.append(oo)

0 commit comments

Comments
 (0)