Skip to content

Commit 75794ff

Browse files
committed
fix: default init submissions to API 1.0
Fixes #1913 Coding-Agent: Codex Codex-Version: codex-cli 0.149.0 Model: gpt-5.6-sol Reasoning-Effort: xhigh
1 parent d5ce577 commit 75794ff

3 files changed

Lines changed: 68 additions & 4 deletions

File tree

dpgen/data/reaction.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -98,7 +98,7 @@ def run_reaxff(jdata, mdata, log_file="reaxff_log"):
9898
[trj_path],
9999
outlog=log_file,
100100
errlog=log_file,
101-
api_version=mdata.get("api_version", "0.9"),
101+
api_version=mdata.get("api_version", "1.0"),
102102
)
103103

104104

@@ -146,7 +146,7 @@ def run_build_dataset(jdata, mdata, log_file="build_log"):
146146
[f"dataset_{dataset_name}_gjf"],
147147
outlog=log_file,
148148
errlog=log_file,
149-
api_version=mdata.get("api_version", "0.9"),
149+
api_version=mdata.get("api_version", "1.0"),
150150
)
151151

152152

@@ -191,7 +191,7 @@ def run_fp(jdata, mdata, log_file="output", forward_common_files=[]):
191191
[log_file],
192192
outlog=log_file,
193193
errlog=log_file,
194-
api_version=mdata.get("api_version", "0.9"),
194+
api_version=mdata.get("api_version", "1.0"),
195195
)
196196

197197

dpgen/data/surf.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -601,7 +601,7 @@ def run_vasp_relax(jdata, mdata):
601601
forward_common_files,
602602
forward_files,
603603
backward_files,
604-
api_version=mdata.get("api_version", "0.9"),
604+
api_version=mdata.get("api_version", "1.0"),
605605
)
606606

607607

Lines changed: 64 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,64 @@
1+
import unittest
2+
from unittest.mock import patch
3+
4+
from dpgen.data import reaction, surf
5+
6+
7+
class TestInitApiVersionDefaults(unittest.TestCase):
8+
def test_reaction_stages_default_to_supported_api(self):
9+
mdata = {
10+
"reaxff_command": "lmp",
11+
"reaxff_machine": {},
12+
"reaxff_resources": {},
13+
"build_command": "build",
14+
"build_machine": {},
15+
"build_resources": {"cpu_per_node": 1},
16+
"fp_command": "fp",
17+
"fp_machine": {},
18+
"fp_resources": {"cpu_per_node": 1},
19+
"fp_group_size": 1,
20+
}
21+
jdata = {
22+
"type_map": ["H"],
23+
"cutoff": 3.0,
24+
"dataset_size": 1,
25+
"qmkeywords": "force",
26+
}
27+
28+
with (
29+
patch.object(reaction.glob, "glob", return_value=["task.000"]),
30+
patch.object(reaction, "make_submission_compat") as submit,
31+
):
32+
reaction.run_reaxff(jdata, mdata)
33+
reaction.run_build_dataset(jdata, mdata)
34+
reaction.run_fp(jdata, mdata)
35+
36+
self.assertEqual(submit.call_count, 3)
37+
for call in submit.call_args_list:
38+
self.assertEqual(call.kwargs["api_version"], "1.0")
39+
40+
def test_surface_relaxation_defaults_to_supported_api(self):
41+
jdata = {"out_dir": "out"}
42+
mdata = {
43+
"fp_command": "vasp",
44+
"fp_group_size": 1,
45+
"fp_resources": {},
46+
"fp_machine": {},
47+
}
48+
49+
with (
50+
patch.object(
51+
surf.glob,
52+
"glob",
53+
side_effect=[[], ["out/02.md/sys-0000/scale-1.000/000000"]],
54+
),
55+
patch.object(surf, "_vasp_check_fin", return_value=False),
56+
patch.object(surf, "make_submission_compat") as submit,
57+
):
58+
surf.run_vasp_relax(jdata, mdata)
59+
60+
self.assertEqual(submit.call_args.kwargs["api_version"], "1.0")
61+
62+
63+
if __name__ == "__main__":
64+
unittest.main()

0 commit comments

Comments
 (0)