Trajectory Viewer¶
Export the full shell-relaxation trajectory as a self-contained HTML file with interactive playback.
Capturing the trajectory¶
Per-step positions and a per-atom cost history are only stored if
capture_trajectory=True is passed through to shell_relax:
cell.generate(
shell_target,
capture_trajectory=True,
**tc.Supercell.PRESETS["MRO"],
)
cell.export_trajectory_html("mro_trajectory.html")
The trajectory is stored on cell.shell_relax_history["trajectory"]
(shape (num_steps + 1, num_atoms, 3), float32) and the per-atom cost on
cell.shell_relax_history["atom_cost"] (shape (num_steps + 1, num_atoms)).
Features¶
Playback controls: play / pause, restart, loop, bounce (ping-pong), speed slider, and a frame scrubber.
Per-atom cost colouring: atoms and bonds are coloured through the Turbo colormap by each atom’s accumulated spring-network cost at that frame. The colour range is frozen for the whole trajectory and is shown as a vertical legend to the right of the canvas. Bonds take the mean cost of their two endpoints.
Cartoon shading: shiny Phong atoms and toon-shaded bonds, each with a thin black back-face outline so that individual atoms and bonds stay crisp against the structural background.
Periodic-image bond wrapping: bond cylinders use the minimum-image displacement across periodic boundaries.
Pointer interaction: drag to rotate, scroll to zoom.
Parameters¶
Parameter |
Default |
Description |
|---|---|---|
|
required |
File path for the generated HTML. |
|
from |
Maximum bond length in Å. Defaults to |
|
0.32 |
Multiplier on each atom’s covalent radius. |
|
0.06 |
Bond cylinder radius in Å. |
|
|
CSS colour for the viewer background. |
|
|
Optional text shown at the top of the viewer. |
|
|
Single-group polyhedra overlay (supersedes bonds). Detector dict with |
|
|
Multi-group polyhedra list (sp²/sp³ carbon blends etc.). Same entry shape as |
|
|
Auto-picks: |
Embedding in documentation¶
The file is fully self-contained and loads Three.js from a CDN, so it can
be dropped into a Sphinx docs tree and embedded with a plain <iframe>:
<iframe src="../_static/trajectories/mro.html"
width="100%" height="600"
style="border: 1px solid rgba(0,0,0,0.1); border-radius: 6px;"
loading="lazy"></iframe>