Skip to content

Overlay Comparison

OverlayViewer draws several structures in one frame of reference — conformers, optimization steps, reactant and product.

from ase.io import read
from aseview import OverlayViewer

conformers = read("conformers.xyz", index=":")
# These ethanol conformers share C(0), C(1), O(2) in the same atom order.
OverlayViewer(conformers, align_structures=True, reorder_atoms=False,
              align_indices="0-2").show()
aseview reactant.xyz product.xyz          # several files
aseview conformers.xyz -v overlay         # frames of one file

The ethanol example starts aligned on its C–C–O backbone (atoms 0–2), keeping the hydrogen differences visible. Turn Align (Kabsch) off to see the original conformer coordinates. For another molecule, choose the indices of its shared backbone; leaving Fit on atoms empty fits all atoms, including hydrogens, so the backbone need not overlap exactly.

Coloring

color_by Colors
structure (default) One color per structure
colormap Along the sequence with overlay_colormap (viridis, plasma, coolwarm, jet, rainbow, grayscale)
element Element colors

A colormap suits an optimization path:

trajectory = read("optimization.xyz", index=":")
OverlayViewer(trajectory, color_by="colormap", overlay_colormap="viridis", all_visible=True)
aseview optimization.xyz -v overlay --cmap viridis

Alignment

align_structures=True Kabsch-fits every structure onto the first. By default atoms are first matched element by element, so different atom orders still align; reorder_atoms=False pairs atoms by index. align_indices="0-5" fits on a subset (for example a shared ring) and moves the whole structure with it. The Align switch in the sidebar toggles between original and aligned coordinates.

Which structures and atoms

  • The first three structures are visible at the start; all_visible=True shows all, and visible_indices=[0, len(trajectory) - 1] picks them. Every structure can be toggled, recolored and faded in the sidebar.
  • index_list=[0, 1, 2] keeps the same atoms in every structure; index_list=[[0, 1, 2], [4, 5, 6]] gives one list per structure.
  • Structures are labelled with atoms.info["name"] when set.