From d67bce110962ede061ba3e5f94955d2581c8c210 Mon Sep 17 00:00:00 2001 From: koko <1429659362@qq.com> Date: Wed, 10 Dec 2025 00:32:35 +0800 Subject: [PATCH] =?UTF-8?q?nep=E6=A1=86=E6=9E=B6=E9=87=8D=E6=9E=84=2003.tr?= =?UTF-8?q?ain?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- config/param.yaml | 8 +++++--- src/workflow.py | 28 ++++++++++++++++------------ 2 files changed, 21 insertions(+), 15 deletions(-) diff --git a/config/param.yaml b/config/param.yaml index 7f0190c..d73fc7a 100644 --- a/config/param.yaml +++ b/config/param.yaml @@ -26,7 +26,7 @@ iterations: # Step 2: 筛选 - name: "01.select" method: "distance" - params: [0.01, 60, 120] + params: [0.012, 60, 120] # Step 3: SCF (VASP) # 逻辑:cp template/02.scf/INCAR; check KPOINTS; cp data/POTCAR @@ -43,14 +43,16 @@ iterations: steps: - name: "00.md" sub_tasks: + - template_sub: "preheat" - template_sub: "production" # 第二轮可能只需要 sampling # 注意:这一轮的 nep.txt 会自动指向 iter_00/03.train/nep.txt - name: "01.select" method: "distance" - params: [0.012, 60, 120] + params: [0.01, 60, 120] - name: "02.scf" executor: "vasp_std" - - name: "03.train" \ No newline at end of file + - name: "03.train" + executor: "nep_local" \ No newline at end of file diff --git a/src/workflow.py b/src/workflow.py index f5fc37d..d14ed83 100644 --- a/src/workflow.py +++ b/src/workflow.py @@ -76,7 +76,19 @@ class Workflow: return else: self.logger.info("Skipping Init (Already Done).") + else: + # --- [新增逻辑] 后续轮次:从上一轮复制 model.xyz --- + # 只要当前目录下没有 model.xyz,就去搬运 + if not os.path.exists(os.path.join(step_dir, "model.xyz")): + prev_iter_name = f"iter_{iter_id - 1:02d}" + prev_model_src = os.path.join(self.workspace, prev_iter_name, "00.md", "model.xyz") + if os.path.exists(prev_model_src): + self.logger.info(f"Copying model.xyz from {prev_iter_name}...") + shutil.copy(prev_model_src, os.path.join(step_dir, "model.xyz")) + else: + self.logger.error(f"Previous model.xyz not found: {prev_model_src}") + return # 确保 gpumdkit 路径可用 kit_path = self.machine.config['paths'].get('gpumdkit', 'gpumdkit.sh') @@ -525,26 +537,18 @@ class Workflow: run_cmd_with_log(cmd_plt, step_dir, "plot.log") - # 检查并移动图片 - # gpumdkit 通常生成 loss.png, energy.png, force.png 等,或者你说的 train.png - # 我们创建一个专门的 output 目录存放这一轮的成果 - output_dir = os.path.join(self.workspace, "05.output", iter_name) + # [修改] 创建 output 目录在当前 iter 内部 + output_dir = os.path.join(iter_path, "05.output") os.makedirs(output_dir, exist_ok=True) - # 移动 loss.png / train.png 到 output - # 假设生成的文件名包含 png + # 移动 png 图片 for file in os.listdir(step_dir): if file.endswith(".png"): src_png = os.path.join(step_dir, file) - dst_png = os.path.join(output_dir, file) # 保持原名 + dst_png = os.path.join(output_dir, file) shutil.copy(src_png, dst_png) self.logger.info(f"Archived plot: {file}") - # 特别处理:你提到的 train.png - if os.path.exists(os.path.join(step_dir, "train.png")): - # 如果你需要重命名或者确保它存在 - pass - self.tracker.mark_done(task_id_train) else: