fix: display.txt 丢失 use_marker 导致强制使用 Sphere 渲染模式
新格式 display.txt 未包含 use_marker 字段,draw.py 中 USE_MARKER 被硬编码为 0(Sphere 模式),对 120 个原子 每帧更新 120 次 STTransform 极慢。 修复:将 use_marker 加入 display.txt header,draw.py 从 header 读取而非硬编码。case06 配置 use_marker: 1 会 自动启用 Marker(GPU 实例化)模式,动画流畅。
This commit is contained in:
+7
-1
@@ -64,6 +64,7 @@ ball_color_b = None
|
||||
box_color_r = None
|
||||
box_color_g = None
|
||||
box_color_b = None
|
||||
use_marker = 0
|
||||
|
||||
# 力开关
|
||||
GRAVITY_FIELD = 1 # 均匀重力场
|
||||
@@ -641,10 +642,13 @@ def run_from_config(config, out_dir=None):
|
||||
global X_MIN, X_MAX, Y_MIN, Y_MAX, Z_MIN, Z_MAX
|
||||
global ball_radius, ball_color_r, ball_color_g, ball_color_b
|
||||
global box_color_r, box_color_g, box_color_b
|
||||
global use_marker
|
||||
global warmup_steps, sample_start, sample_end
|
||||
global GRAVITY_FIELD, GRAVITY_INTERACTION, ELASTIC_FORCE, DAMPING_FORCE, GRAVITY_STRENGTH
|
||||
global DRIVING_FORCE, DRIVER_DATA
|
||||
|
||||
global use_marker
|
||||
...
|
||||
box_a = float(config.get("box_a", 10.0))
|
||||
raw_alpha = config.get("alpha", 0.2)
|
||||
if isinstance(raw_alpha, (list, tuple)):
|
||||
@@ -701,6 +705,7 @@ def run_from_config(config, out_dir=None):
|
||||
box_color_r = float(config.get("box_color_r", 0.8))
|
||||
box_color_g = float(config.get("box_color_g", 0.8))
|
||||
box_color_b = float(config.get("box_color_b", 0.85))
|
||||
use_marker = int(config.get("use_marker", 0))
|
||||
|
||||
# 力开关
|
||||
global GRAVITY_FIELD, GRAVITY_INTERACTION, ELASTIC_FORCE, DAMPING_FORCE, GRAVITY_STRENGTH
|
||||
@@ -1453,7 +1458,8 @@ def run_simulation(save_trajectory=0):
|
||||
"elastic_force": str(ELASTIC_FORCE),
|
||||
"damping_force": str(DAMPING_FORCE),
|
||||
"gravity_strength": str(GRAVITY_STRENGTH),
|
||||
"driving_force": str(DRIVING_FORCE)}
|
||||
"driving_force": str(DRIVING_FORCE),
|
||||
"use_marker": str(use_marker)}
|
||||
)
|
||||
print(f"[compute] display.txt 已保存至: {disp_path} ({n_frames_actual} 帧)")
|
||||
|
||||
|
||||
@@ -73,7 +73,7 @@ PLOT_ATOM_ID = int(ATOM_IDS[0])
|
||||
BOND_PAIRS = [] # display 格式不含成键信息,从原始数据加载
|
||||
|
||||
# 渲染方式:0=Sphere(网格球体), 1=Marker(GPU点精灵)
|
||||
USE_MARKER = 0
|
||||
USE_MARKER = int(h.get("use_marker", 0))
|
||||
|
||||
if N_FRAMES <= 0:
|
||||
raise ValueError(
|
||||
|
||||
+2
-1
@@ -244,7 +244,8 @@ def run_case(config_path, runtime_base, input_dir="input", output_dir="output",
|
||||
"elastic_force": str(data.get("elastic_force", 1)),
|
||||
"damping_force": str(data.get("damping_force", 0)),
|
||||
"gravity_strength": str(data.get("gravity_strength", 1.0)),
|
||||
"driving_force": str(data.get("driving_force", 0))}
|
||||
"driving_force": str(data.get("driving_force", 0)),
|
||||
"use_marker": str(config.get("use_marker", 0))}
|
||||
|
||||
n_frames = len(indices)
|
||||
compute.save_display_txt(
|
||||
|
||||
Reference in New Issue
Block a user