From 9d20f19d9fc608cee81ab726f112bc4a498e7b0b Mon Sep 17 00:00:00 2001 From: HuangJiameng <105633685+HuangJiameng@users.noreply.github.com> Date: Thu, 29 Dec 2022 16:59:56 +0800 Subject: [PATCH 1/3] support "user_forward_files" for `simplify` support "user_forward_files" for `simplify` in 02.fp step, use abspath to create symlink --- dpgen/generator/lib/utils.py | 3 ++- dpgen/simplify/simplify.py | 4 ++++ 2 files changed, 6 insertions(+), 1 deletion(-) diff --git a/dpgen/generator/lib/utils.py b/dpgen/generator/lib/utils.py index 772d379ce..6a8fb2f46 100644 --- a/dpgen/generator/lib/utils.py +++ b/dpgen/generator/lib/utils.py @@ -92,6 +92,7 @@ def symlink_user_forward_files(mdata, task_type, work_path, task_format = None): for task in tasks: if os.path.isfile(os.path.join(task, os.path.basename(file))): os.remove(os.path.join(task, os.path.basename(file))) - os.symlink(file, os.path.join(task, os.path.basename(file))) + abs_file = os.path.abspath(file) + os.symlink(abs_file, os.path.join(task, os.path.basename(file))) return \ No newline at end of file diff --git a/dpgen/simplify/simplify.py b/dpgen/simplify/simplify.py index 1aeabe14c..4ca4afd82 100644 --- a/dpgen/simplify/simplify.py +++ b/dpgen/simplify/simplify.py @@ -411,6 +411,10 @@ def make_fp(iter_index, jdata, mdata): else: make_fp_configs(iter_index, jdata) make_fp_calculation(iter_index, jdata) + # Copy user defined forward_files + iter_name = make_iter_name(iter_index) + work_path = os.path.join(iter_name, fp_name) + symlink_user_forward_files(mdata=mdata, task_type="fp", work_path=work_path) def run_iter(param_file, machine_file): From 99cb0854aef2cde8a792a21913c4c27be1c80106 Mon Sep 17 00:00:00 2001 From: HuangJiameng <105633685+HuangJiameng@users.noreply.github.com> Date: Fri, 30 Dec 2022 12:38:32 +0800 Subject: [PATCH 2/3] user_forward_files should be applied only when labeled is False --- dpgen/simplify/simplify.py | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/dpgen/simplify/simplify.py b/dpgen/simplify/simplify.py index 4ca4afd82..c1cb39c70 100644 --- a/dpgen/simplify/simplify.py +++ b/dpgen/simplify/simplify.py @@ -411,10 +411,10 @@ def make_fp(iter_index, jdata, mdata): else: make_fp_configs(iter_index, jdata) make_fp_calculation(iter_index, jdata) - # Copy user defined forward_files - iter_name = make_iter_name(iter_index) - work_path = os.path.join(iter_name, fp_name) - symlink_user_forward_files(mdata=mdata, task_type="fp", work_path=work_path) + # Copy user defined forward_files + iter_name = make_iter_name(iter_index) + work_path = os.path.join(iter_name, fp_name) + symlink_user_forward_files(mdata=mdata, task_type="fp", work_path=work_path) def run_iter(param_file, machine_file): From fa5eb166a14305881ad063cfab71e7ed2af4e8c3 Mon Sep 17 00:00:00 2001 From: HuangJiameng <105633685+HuangJiameng@users.noreply.github.com> Date: Fri, 30 Dec 2022 15:41:22 +0800 Subject: [PATCH 3/3] fix dependency --- dpgen/simplify/simplify.py | 1 + 1 file changed, 1 insertion(+) diff --git a/dpgen/simplify/simplify.py b/dpgen/simplify/simplify.py index c1cb39c70..839259932 100644 --- a/dpgen/simplify/simplify.py +++ b/dpgen/simplify/simplify.py @@ -29,6 +29,7 @@ from dpgen.generator.run import make_train, run_train, post_train, run_fp, post_fp, fp_name, model_devi_name, train_name, train_task_fmt, sys_link_fp_vasp_pp, make_fp_vasp_incar, make_fp_vasp_kp, make_fp_vasp_cp_cvasp, data_system_fmt, model_devi_task_fmt, fp_task_fmt # TODO: maybe the following functions can be moved to dpgen.util from dpgen.generator.lib.utils import log_iter, make_iter_name, create_path, record_iter +from dpgen.generator.lib.utils import symlink_user_forward_files from dpgen.generator.lib.gaussian import make_gaussian_input from dpgen.remote.decide_machine import convert_mdata from .arginfo import simplify_jdata_arginfo