Skip to content

Commit

Permalink
Modify the post_fp_cp2k function to generate multisystem data. Allows…
Browse files Browse the repository at this point in the history
… to run different system at one single iteration model_devi step. (#1513)

Modify the post_fp_cp2k function to generate multisystem data. Allows to
run different system at one single iteration model_devi step.

---------

Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
Co-authored-by: Yifan Li李一帆 <[email protected]>
  • Loading branch information
3 people authored Apr 12, 2024
1 parent d28dbe6 commit db13fa6
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 11 deletions.
16 changes: 7 additions & 9 deletions dpgen/generator/run.py
Original file line number Diff line number Diff line change
Expand Up @@ -4437,20 +4437,18 @@ def post_fp_cp2k(iter_index, jdata, rfailed=None):
sys_output = glob.glob(os.path.join(work_path, "task.%s.*/output" % ss))
sys_output.sort()
tcount += len(sys_output)
all_sys = None
all_sys = dpdata.MultiSystems(type_map=jdata["type_map"])
for oo in sys_output:
_sys = dpdata.LabeledSystem(oo, fmt="cp2k/output")
# _sys.check_type_map(type_map = jdata['type_map'])
if all_sys is None:
all_sys = _sys
else:
all_sys.append(_sys)
_sys = dpdata.LabeledSystem(
oo, fmt="cp2kdata/e_f", type_map=jdata["type_map"]
)
all_sys.append(_sys)
icount += 1

icount += len(all_sys)
if (all_sys is not None) and (len(all_sys) > 0):
sys_data_path = os.path.join(work_path, "data.%s" % ss)
all_sys.to_deepmd_raw(sys_data_path)
all_sys.to_deepmd_npy(sys_data_path, set_size=len(sys_output))
all_sys.to_deepmd_npy(sys_data_path)

if tcount == 0:
rfail = 0.0
Expand Down
3 changes: 2 additions & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,8 @@ classifiers = [
]
dependencies = [
'numpy>=1.14.3',
'dpdata>=0.2.16',
'dpdata>=0.2.17',
'cp2kdata>=0.6.6',
'pymatgen>=2022.11.1',
'ase',
'monty>2.0.0',
Expand Down
2 changes: 1 addition & 1 deletion tests/generator/test_post_fp.py
Original file line number Diff line number Diff line change
Expand Up @@ -281,7 +281,7 @@ def setUp(self):
post_fp(0, jdata)
self.system_1 = dpdata.LabeledSystem("iter.000000/orig", fmt="deepmd/raw")
self.system_2 = dpdata.LabeledSystem(
"iter.000000/02.fp/data.000", fmt="deepmd/raw"
"iter.000000/02.fp/data.000/C2H2N2", fmt="deepmd/raw"
)


Expand Down

0 comments on commit db13fa6

Please sign in to comment.