Skip to content
Open
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
1 change: 1 addition & 0 deletions dpgen/auto_test/Gamma.py
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down
21 changes: 21 additions & 0 deletions tests/auto_test/test_gamma.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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):
Expand Down