fix: display.txt 的 number of frames 改为实际抽帧数而非总步数

之前 number of frames 错误地填入了 record_steps(=NT),
实际应该填入 n_frames_actual(=NT/NSTEP)。如 NT=20000,
NSTEP=100 时抽得 200 帧,现在正确显示为 200。
总步数仍在 dynamic_steps 中记录。
This commit is contained in:
2026-06-12 06:51:59 +08:00
parent 0c332b7dfc
commit ab3a847483
2 changed files with 4 additions and 3 deletions
+1 -1
View File
@@ -1441,7 +1441,7 @@ def run_simulation(save_trajectory=0):
disp_path,
sampled_x[:n_frames_actual], sampled_y[:n_frames_actual], sampled_z[:n_frames_actual],
sampled_vx[:n_frames_actual], sampled_vy[:n_frames_actual], sampled_vz[:n_frames_actual],
np.array(ATOM_IDS), record_steps, n_atoms,
np.array(ATOM_IDS), n_frames_actual, n_atoms,
header_fields={"DT": str(DT), "NSTEP": str(NSTEP), "method": str(METHOD),
"warmup_steps": str(warmup_steps or 0),
"dynamic_steps": str(record_steps),
+3 -2
View File
@@ -245,13 +245,14 @@ def run_case(config_path, runtime_base, input_dir="input", output_dir="output",
"gravity_strength": str(data.get("gravity_strength", 1.0)),
"driving_force": str(data.get("driving_force", 0))}
n_frames = len(indices)
compute.save_display_txt(
disp_path_new,
traj_x[indices], traj_y[indices], traj_z[indices],
traj_vx[indices], traj_vy[indices], traj_vz[indices],
np.array(data["atom_ids"]), record_steps, n_atoms,
np.array(data["atom_ids"]), n_frames, n_atoms,
header_fields=hf)
print(f"[run] 从 trajectory.txt 抽帧生成 display.txt ({len(indices)} 帧)")
print(f"[run] 从 trajectory.txt 抽帧生成 display.txt ({n_frames} 帧)")
# 4. 绘图(可选)
if not no_plot and config.get("step_plot", 1):