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.

3D Structure Viewer

Interactive WebGL viewer in Jupyter, built on Three.js via anywidget.

cell.view_structure()

Default behaviour

For recognised materials (Si / C, Cu, SiO₂, SrTiO₃, …) the viewer picks a coordination polyhedron and renders it as a translucent mesh around every atom whose first shell passes the detector, with no bond cylinders by default:

SpeciesPolyhedronCentre-vertex bondScale
Si / C (diamond)tetrahedron2.35 / 1.54 Å (self)0.5 (vertices at bond midpoints)
C (graphite, sp²)triangle (3-sub-triangle fan, 120°)1.42 Å (self)0.5
Cucuboctahedron (FCC 12-coord)2.56 Å (self)0.5
SiO₂SiO₄ tetrahedron1.61 Å (Si → O)1.0
SrTiO₃TiO₆ octahedron1.96 Å (Ti → O)1.0

For blended materials (sp²/sp³ carbon; SiO₂/Si₃N₄ mixes, …) pass polyhedra_groups=[...] to export_overview_html or export_trajectory_html. Each entry carries its own kind (triangles, tetrahedra, octahedra, cuboctahedra), colour, opacity, and an optional virtual_species filter that restricts detection to atoms flagged with that shell-target species index. See Carbon for a worked example where green sp²-C triangle fans and navy sp³-C tetrahedra render in the same scene.

Override with the polyhedra= kwarg:

# Explicit kind + tolerances
cell.view_structure(polyhedra={
    'kind': 'octahedra',
    'center_symbol': 'Ti', 'vertex_symbol': 'O',
    'bond_length': 1.96, 'bond_length_tol': 0.15,
    'angle_tol_deg': 18.0, 'scale': 1.0,
})

# Disable polyhedra, show bonds instead
cell.view_structure(polyhedra=False, show_bonds=True)

Live controls

All sliders recompute on release, pushing the result back through the anywidget traitlet bridge so the 3D scene updates without a full rebuild:

Parameters

ParameterDefaultDescription
polyhedraTrue (auto-pick)Config dict; True / None auto-picks from species, False disables. See table above for auto-pick rules.
atom_scale0.2Sphere radius scale factor (covalent_radius × scale).
bond_cutofffrom shell_target.max_pair_outerMaximum bond length (Å).
bond_radius0.08Cylinder radius for bonds (Å).
show_bondsFalseRender bonds. Auto-default flipped to False once polyhedra became the primary overlay.
show_cellTrueRender cell outline.
orthographicFalseStart in orthographic mode.
slab_x, slab_y, slab_z(0, 1)Fractional range to display.

Colours come from ASE’s jmol colour scheme; the polyhedra colour defaults to a material-specific hint (blue for Si-tets, orange for Ti-octa, copper-orange for Cu-cubocta, …).

Example: silicon MRO

Here is the live widget as rendered from am.Supercell.PRESETS["MRO"] on Si at 40 × 40 × 40 Å. The blue tetrahedra mark Si atoms whose four nearest neighbours pass the 109.5° / 2.35 Å first-shell filter, with the tets shrunk to half-size so their corners meet at Si-Si bond midpoints:

(The embedded viewer above is the exported trajectory version; the notebook view_structure() widget uses the same Three.js scene + controls on a single final frame.)