diff --git a/compute.py b/compute.py index b35bdcc..2cdcd2f 100644 --- a/compute.py +++ b/compute.py @@ -1461,7 +1461,10 @@ def run_simulation(save_trajectory=0): "driving_force": str(DRIVING_FORCE), "use_marker": str(use_marker), "alpha": ",".join(str(a) for a in (alpha if isinstance(alpha, list) else [alpha])), - "atom_radii": ",".join(str(r) for r in ATOM_RADII)} + "atom_radii": ",".join(str(r) for r in ATOM_RADII), + "camera_distance": str(config.get("camera_distance", 40.0)), + "camera_elevation": str(config.get("camera_elevation", 0)), + "camera_azimuth": str(config.get("camera_azimuth", 0))} ) print(f"[compute] display.txt 已保存至: {disp_path} ({n_frames_actual} 帧)") diff --git a/draw.py b/draw.py index e8656f5..19283b1 100644 --- a/draw.py +++ b/draw.py @@ -114,9 +114,9 @@ info_margin = 8 axis_length = 10.0 initial_camera = { - "distance": 40.0, - "elevation": 0, - "azimuth": 0, + "distance": float(h.get("camera_distance", 40.0)), + "elevation": float(h.get("camera_elevation", 0)), + "azimuth": float(h.get("camera_azimuth", 0)), "center": (0, 0, 0), } diff --git a/dynamics.py b/dynamics.py index 1842a3f..7274b36 100644 --- a/dynamics.py +++ b/dynamics.py @@ -254,7 +254,10 @@ def run_case(config_path, runtime_base, input_dir="input", output_dir="output", "driving_force": str(data.get("driving_force", 0)), "use_marker": str(config.get("use_marker", 0)), "alpha": _fmt_alpha(data.get("alpha", 0.2)), - "atom_radii": _fmt_alpha(data.get("atom_radii", []))} + "atom_radii": _fmt_alpha(data.get("atom_radii", [])), + "camera_distance": str(config.get("camera_distance", 40.0)), + "camera_elevation": str(config.get("camera_elevation", 0)), + "camera_azimuth": str(config.get("camera_azimuth", 0))} n_frames = len(indices) compute.save_display_txt( diff --git a/examples/case06/input/input.txt b/examples/case06/input/input.txt index cef3232..d0be85b 100644 --- a/examples/case06/input/input.txt +++ b/examples/case06/input/input.txt @@ -19,7 +19,7 @@ save_trajectory: 0 # 0=不保留完整轨迹文件, 1=保留 trajectory.txt( # ── 计算引擎 ────────────────────────────────── # 可选: python, c, cpp, fortran, java -engine: fortran # 默认使用 python 引擎 +engine: c # 默认使用 python 引擎 # ── 盒子 ────────────────────────────────────── box_a: 80.0 # 立方体半边长,粒子被限制在 [-box_a, box_a]³ 内 @@ -100,3 +100,8 @@ ball_color_b: 0.90 # B 分量 box_color_r: 0.80 box_color_g: 0.80 box_color_b: 0.85 + +# ── 摄像机初始位置 ──────────────────────────── +camera_distance: 40.0 # 摄像机到场景中心的距离 +camera_elevation: 0 # 俯仰角(度),负值=俯视 +camera_azimuth: 0 # 方位角(度)