From 8eb049799d2e6bed95d8ce976dc58679cdac2586 Mon Sep 17 00:00:00 2001 From: njzjz-bot Date: Mon, 24 Aug 2026 03:33:59 +0800 Subject: [PATCH] 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 --- dpgen/auto_test/Gamma.py | 1 + tests/auto_test/test_gamma.py | 21 +++++++++++++++++++++ 2 files changed, 22 insertions(+) diff --git a/dpgen/auto_test/Gamma.py b/dpgen/auto_test/Gamma.py index 6bce02380..18c9cea2e 100644 --- a/dpgen/auto_test/Gamma.py +++ b/dpgen/auto_test/Gamma.py @@ -129,6 +129,7 @@ def make_confs(self, path_to_work, path_to_equi, refine=False): raise RuntimeError("please provide the initial data path to reproduce") init_data_path = os.path.abspath(self.parameter["init_data_path"]) task_list = make_repro( + self.inter_param, init_data_path, self.init_from_suffix, path_to_work, diff --git a/tests/auto_test/test_gamma.py b/tests/auto_test/test_gamma.py index 7268c58a2..7851374f6 100644 --- a/tests/auto_test/test_gamma.py +++ b/tests/auto_test/test_gamma.py @@ -2,7 +2,9 @@ import os import shutil import sys +import tempfile import unittest +from unittest.mock import patch from pymatgen.core.structure import Structure from pymatgen.io.vasp import Incar @@ -72,6 +74,25 @@ def test_task_type(self): def test_task_param(self): self.assertEqual(self.prop_param[0], self.gamma.task_param()) + @patch("dpgen.auto_test.Gamma.make_repro", return_value=[]) + def test_reproduce_passes_interaction_parameters(self, make_repro): + inter_param = {"type": "deepmd", "model": "graph.pb"} + gamma = Gamma( + {"type": "gamma", "reproduce": True, "init_data_path": "."}, + inter_param, + ) + with tempfile.TemporaryDirectory() as tmpdir: + path_to_work = os.path.join(tmpdir, "gamma_reprod") + gamma.make_confs(path_to_work, tmpdir) + + make_repro.assert_called_once_with( + inter_param, + os.path.abspath("."), + "00", + os.path.abspath(path_to_work), + True, + ) + def test_make_confs_bcc(self): if not os.path.exists(os.path.join(self.equi_path, "CONTCAR")): with self.assertRaises(RuntimeError):