Skip to content

Commit 8eb0497

Browse files
committed
fix: pass interaction to gamma reproduce
Fixes #1899 Coding-Agent: Codex Codex-Version: codex-cli 0.149.0 Model: gpt-5.6-sol Reasoning-Effort: xhigh
1 parent d5ce577 commit 8eb0497

2 files changed

Lines changed: 22 additions & 0 deletions

File tree

dpgen/auto_test/Gamma.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -129,6 +129,7 @@ def make_confs(self, path_to_work, path_to_equi, refine=False):
129129
raise RuntimeError("please provide the initial data path to reproduce")
130130
init_data_path = os.path.abspath(self.parameter["init_data_path"])
131131
task_list = make_repro(
132+
self.inter_param,
132133
init_data_path,
133134
self.init_from_suffix,
134135
path_to_work,

tests/auto_test/test_gamma.py

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,9 @@
22
import os
33
import shutil
44
import sys
5+
import tempfile
56
import unittest
7+
from unittest.mock import patch
68

79
from pymatgen.core.structure import Structure
810
from pymatgen.io.vasp import Incar
@@ -72,6 +74,25 @@ def test_task_type(self):
7274
def test_task_param(self):
7375
self.assertEqual(self.prop_param[0], self.gamma.task_param())
7476

77+
@patch("dpgen.auto_test.Gamma.make_repro", return_value=[])
78+
def test_reproduce_passes_interaction_parameters(self, make_repro):
79+
inter_param = {"type": "deepmd", "model": "graph.pb"}
80+
gamma = Gamma(
81+
{"type": "gamma", "reproduce": True, "init_data_path": "."},
82+
inter_param,
83+
)
84+
with tempfile.TemporaryDirectory() as tmpdir:
85+
path_to_work = os.path.join(tmpdir, "gamma_reprod")
86+
gamma.make_confs(path_to_work, tmpdir)
87+
88+
make_repro.assert_called_once_with(
89+
inter_param,
90+
os.path.abspath("."),
91+
"00",
92+
os.path.abspath(path_to_work),
93+
True,
94+
)
95+
7596
def test_make_confs_bcc(self):
7697
if not os.path.exists(os.path.join(self.equi_path, "CONTCAR")):
7798
with self.assertRaises(RuntimeError):

0 commit comments

Comments
 (0)