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):