nep框架重构 03.train
This commit is contained in:
@@ -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"
|
||||
executor: "nep_local"
|
||||
@@ -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:
|
||||
|
||||
Reference in New Issue
Block a user