"""Client-side trajectory playback with changing atom counts and bonds.""" import html import json def trajectory_viewer(records, sample): record = next((r for r in records if r["index"] == int(sample or 0)), None) if record is None or not record.get("frames"): return "

Generate molecules to play their trajectories.

" frames = json.dumps(record["frames"], separators=(",", ":")).replace("

Drag to rotate · Scroll to zoom · Frames show the sampled states, including atom insertions and deletions.

""".replace("__FRAMES__", frames) return ( '' )