From ab3a847483a0f81e2383f3bcccac0bbdae010ec1 Mon Sep 17 00:00:00 2001 From: Ying-Li Niu <64801511@qq.com> Date: Fri, 12 Jun 2026 06:51:59 +0800 Subject: [PATCH] =?UTF-8?q?fix:=20display.txt=20=E7=9A=84=20number=20of=20?= =?UTF-8?q?frames=20=E6=94=B9=E4=B8=BA=E5=AE=9E=E9=99=85=E6=8A=BD=E5=B8=A7?= =?UTF-8?q?=E6=95=B0=E8=80=8C=E9=9D=9E=E6=80=BB=E6=AD=A5=E6=95=B0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 之前 number of frames 错误地填入了 record_steps(=NT), 实际应该填入 n_frames_actual(=NT/NSTEP)。如 NT=20000, NSTEP=100 时抽得 200 帧,现在正确显示为 200。 总步数仍在 dynamic_steps 中记录。 --- compute.py | 2 +- dynamics.py | 5 +++-- 2 files changed, 4 insertions(+), 3 deletions(-) diff --git a/compute.py b/compute.py index b16911e..48bf7c4 100644 --- a/compute.py +++ b/compute.py @@ -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), diff --git a/dynamics.py b/dynamics.py index 964bad9..a0724b7 100644 --- a/dynamics.py +++ b/dynamics.py @@ -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):