Skip to content

Commit

Permalink
Fix bugs related to lammps PIMD (#266)
Browse files Browse the repository at this point in the history
<!-- 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>
  • Loading branch information
4 people authored Oct 15, 2024
1 parent 850eb22 commit 336d385
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 4 deletions.
4 changes: 2 additions & 2 deletions dpgen2/op/collect_data.py
Original file line number Diff line number Diff line change
Expand Up @@ -95,9 +95,9 @@ def execute(

ms = dpdata.MultiSystems(type_map=type_map)
for ii in labeled_data:
if len(list(ii.rglob("fparam.npy"))) > 0:
if ii and len(list(ii.rglob("fparam.npy"))) > 0:
setup_ele_temp(False)
if len(list(ii.rglob("aparam.npy"))) > 0:
if ii and len(list(ii.rglob("aparam.npy"))) > 0:
setup_ele_temp(True)
ss = dpdata.LabeledSystem(ii, fmt="deepmd/npy")
ms.append(ss)
Expand Down
3 changes: 2 additions & 1 deletion dpgen2/op/run_lmp.py
Original file line number Diff line number Diff line change
Expand Up @@ -195,7 +195,8 @@ def execute(
with open("job.json", "w") as f:
json.dump(data, f, indent=4)

merge_pimd_files()
merge_pimd_files()

ret_dict = {
"log": work_dir / lmp_log_name,
"traj": work_dir / lmp_traj_name,
Expand Down
2 changes: 1 addition & 1 deletion dpgen2/op/select_confs.py
Original file line number Diff line number Diff line change
Expand Up @@ -126,7 +126,7 @@ def validate_trajs(
if tt is not None and mm is not None:
rett.append(tt)
retm.append(mm)
if optional_outputs:
if optional_outputs and any(optional_outputs):
oo = optional_outputs[i]
if oo is not None:
reto.append(oo)
Expand Down

0 comments on commit 336d385

Please sign in to comment.