From 081540c27493033de9dd5a340c3f3c26f99d3bc1 Mon Sep 17 00:00:00 2001 From: koko <1429659362@qq.com> Date: Tue, 9 Dec 2025 11:30:26 +0800 Subject: [PATCH] =?UTF-8?q?NEP=E6=A1=86=E6=9E=B6=E9=87=8D=E6=9E=8400?= =?UTF-8?q?=E9=98=B6=E6=AE=B5?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/workflow.py | 24 +++++++++++++++++++----- 1 file changed, 19 insertions(+), 5 deletions(-) diff --git a/src/workflow.py b/src/workflow.py index 2c018e7..4c94c29 100644 --- a/src/workflow.py +++ b/src/workflow.py @@ -125,7 +125,7 @@ class Workflow: self.logger.info(">>> Starting Production...") os.makedirs(prod_dir, exist_ok=True) - # 软链接 + # 1. 准备基础文件到 production 根目录 src_sample = os.path.abspath(os.path.join(preheat_dir, "sampled_structures.xyz")) dst_sample = os.path.join(prod_dir, "sampled_structures.xyz") if os.path.exists(dst_sample): os.remove(dst_sample) @@ -135,7 +135,8 @@ class Workflow: shutil.copy(os.path.join(self.template_dir, "00.md", "production", "run.in"), os.path.join(prod_dir, "run.in")) - # A. 运行 302 生成 presub.sh + # 2. 运行 302 (生成 md 文件夹, sample_* 文件夹, presub.sh) + # 302 通常会读取当前目录的 run.in 并在 md/ 下生成拆分后的 run_x.in input_str_302 = "302" if not run_cmd_with_log(kit_path, prod_dir, "step_exec.log", input_str=input_str_302): self.logger.error("302 command failed.") @@ -145,7 +146,20 @@ class Workflow: self.logger.error("presub.sh not found.") return - # B. 运行 presub.sh + # --------------------------------------------------------- + # [新增] 3. 补全文件:将 nep.txt 和 run.in 复制到 md 文件夹 + # --------------------------------------------------------- + md_subdir = os.path.join(prod_dir, "md") + if os.path.exists(md_subdir): + self.logger.info("Copying nep.txt and run.in to 'md' folder...") + shutil.copy(os.path.join(prod_dir, "nep.txt"), os.path.join(md_subdir, "nep.txt")) + # 复制 run.in,虽然 302 可能已经生成了 run_1.in 等,但为了保险或用户习惯,我们也拷进去 + shutil.copy(os.path.join(prod_dir, "run.in"), os.path.join(md_subdir, "run.in")) + else: + self.logger.error("'md' folder was not created by 302 command.") + return + + # 4. 运行 presub.sh os.chmod(os.path.join(prod_dir, "presub.sh"), 0o755) self.logger.info(">>> Executing presub.sh...") @@ -153,14 +167,14 @@ class Workflow: self.logger.error("presub.sh execution failed.") return - # C. 合并 dump + # 5. 合并 dump + self.logger.info("Merging dump files...") run_cmd_with_log("cat sample_*/dump.xyz > dump.xyz", prod_dir, "step_exec.log") self.last_dump_path = os.path.join(prod_dir, "dump.xyz") self.tracker.mark_done(task_id_prod) else: self.logger.info("Skipping Production (Already Done).") - # 即使跳过,也要更新变量给下一步用 self.last_dump_path = os.path.join(prod_dir, "dump.xyz") # ==========================