Skip to content

Commit 06bd270

Browse files
authored
Support forward files for simplify (#1092)
Support "user_forward_files" for `simplify` in the `02.fp` step. Use abspath to create symlinks to avoid unexpected problems.
1 parent ed26994 commit 06bd270

File tree

2 files changed

+7
-1
lines changed

2 files changed

+7
-1
lines changed

dpgen/generator/lib/utils.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -92,6 +92,7 @@ def symlink_user_forward_files(mdata, task_type, work_path, task_format = None):
9292
for task in tasks:
9393
if os.path.isfile(os.path.join(task, os.path.basename(file))):
9494
os.remove(os.path.join(task, os.path.basename(file)))
95-
os.symlink(file, os.path.join(task, os.path.basename(file)))
95+
abs_file = os.path.abspath(file)
96+
os.symlink(abs_file, os.path.join(task, os.path.basename(file)))
9697
return
9798

dpgen/simplify/simplify.py

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,7 @@
2929
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
3030
# TODO: maybe the following functions can be moved to dpgen.util
3131
from dpgen.generator.lib.utils import log_iter, make_iter_name, create_path, record_iter
32+
from dpgen.generator.lib.utils import symlink_user_forward_files
3233
from dpgen.generator.lib.gaussian import make_gaussian_input
3334
from dpgen.remote.decide_machine import convert_mdata
3435
from .arginfo import simplify_jdata_arginfo
@@ -411,6 +412,10 @@ def make_fp(iter_index, jdata, mdata):
411412
else:
412413
make_fp_configs(iter_index, jdata)
413414
make_fp_calculation(iter_index, jdata)
415+
# Copy user defined forward_files
416+
iter_name = make_iter_name(iter_index)
417+
work_path = os.path.join(iter_name, fp_name)
418+
symlink_user_forward_files(mdata=mdata, task_type="fp", work_path=work_path)
414419

415420

416421
def run_iter(param_file, machine_file):

0 commit comments

Comments
 (0)