Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Merged
merged 7 commits into from
Apr 12, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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',
njzjz marked this conversation as resolved.
Show resolved Hide resolved
'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"
njzjz marked this conversation as resolved.
Show resolved Hide resolved
)


Expand Down