Skip to article frontmatterSkip to article content
Site not loading correctly?

This may be due to an incorrect BASE_URL configuration. See the MyST Documentation for reference.

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,
    **am.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

Parameters

ParameterDefaultDescription
output_pathrequiredFile path for the generated HTML.
bond_cutofffrom shell_targetMaximum bond length in Å. Defaults to shell_target.pair_peak.max() × 1.2.
atom_scale0.32Multiplier on each atom’s covalent radius.
bond_radius0.06Bond cylinder radius in Å.
background_color"#f7f8f5"CSS colour for the viewer background.
title""Optional text shown at the top of the viewer.
tetrahedra / octahedra / cuboctahedraNoneSingle-group polyhedra overlay (supersedes bonds). Detector dict with center_symbol, vertex_symbol, bond_length, bond_length_tol, ideal_angle_deg, angle_tol_deg, scale.
polyhedra_groupsNoneMulti-group polyhedra list (sp²/sp³ carbon blends etc.). Same entry shape as export_overview_html; each dict may carry a virtual_species filter keyed to Supercell._atom_shell_species_index. Suppresses bonds automatically.
show_bondsNoneAuto-picks: True when no polyhedra are requested, False when a single-group overlay or polyhedra_groups is set.

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="https://ophusgroup.github.io/atomode-docs/viewers/trajectories/mro.html" width="100%" height="600"
        style="border: 1px solid rgba(0,0,0,0.1); border-radius: 6px;"
        loading="lazy"></iframe>