diff --git a/dpgen/generator/run.py b/dpgen/generator/run.py index 0ce513a96..1cdb30ee3 100644 --- a/dpgen/generator/run.py +++ b/dpgen/generator/run.py @@ -1881,7 +1881,10 @@ def _make_model_devi_native_gromacs(iter_index, jdata, mdata, conf_systems): # input.json for DP-Gromacs with open(os.path.join(cc, "input.json")) as f: input_json = json.load(f) - input_json["graph_file"] = models[0] + # Tasks run in a remote staging directory, so a local absolute + # training path would not resolve after DPDispatcher transfers + # the model into the model-deviation work directory. + input_json["graph_file"] = task_model_list[0] input_json["lambda"] = ll with open(os.path.join(task_path, "input.json"), "w") as _outfile: json.dump(input_json, _outfile, indent=4) diff --git a/tests/generator/test_gromacs_engine.py b/tests/generator/test_gromacs_engine.py index d74d1333d..fbc5aa6d7 100644 --- a/tests/generator/test_gromacs_engine.py +++ b/tests/generator/test_gromacs_engine.py @@ -1,4 +1,5 @@ import importlib +import json import os import shutil import sys @@ -94,6 +95,10 @@ def _check_dir(self, wdir, post=True): ) ) + with open(os.path.join(wdir, "input.json")) as f: + input_json = json.load(f) + self.assertEqual(input_json["graph_file"], "../graph.000.pb") + def _copy_outputs(self, path_1, path_2): shutil.copy( os.path.join(path_1, "deepmd_traj.gro"),