Skip to content

LiteViewer

A MolecularViewer without the sidebar and toolbar: just the structure and, for trajectories, the player. Use it for quick PyMOL-style renders in notebooks; for the settings panel and export buttons use MolecularViewer.

See the Lightweight view() example for an embedded preview.

Constructor

LiteViewer(data, *, topology=None, index=":", format=None, topology_format=None,
           style="cinematic", fps=30, hide_hydrogens=False,
           center=False, theme=None, **settings)
Parameter Type Description Default
topology, index, format, topology_format Paired MD read controls, as in MolecularViewer. None, ":", None, None
data Atoms, list[Atoms], dict, str Structure(s) to show Required
style str Rendering style (Styles) "cinematic"
fps float Playback speed for trajectories 30
hide_hydrogens bool Hide hydrogen atoms and their bonds False
center bool Center each frame on its center of mass False
theme str Viewer theme; None uses get_theme() None
**settings Any MolecularViewer setting, e.g. bond_threshold (default 1.3 here), view_direction=[1, 1, 1], show_bond=False

LiteViewer sets the chrome="minimal" setting; any viewer accepts it.

view() helper

view(data, *, width=500, height=500, **kwargs) -> LiteViewer

Builds a LiteViewer, shows it inline, and returns it (so it can also be saved with save_html()). kwargs are LiteViewer arguments.

from aseview import view

viewer = view(atoms, style="cinematic", hide_hydrogens=True, center=True,
              width=400, height=400)
viewer.save_html("lite_view.html")

Methods

show(), get_html(), save_html(), save_png() and save_gif() work as in MolecularViewer.