Polyhedra & Rings
Two ways to show structure beyond atoms and bonds: coordination polyhedra for crystals, and filled rings for molecules. Both are in the sidebar under Bonds & polyhedra; every related setting is in Viewer Settings.
Coordination polyhedra
SiO₄ tetrahedra and CaO₈ polyhedra in a 2×2×2 CaSiO₃ supercell:
from ase.build import bulk
from aseview import MolecularViewer
atoms = bulk("NaCl", "rocksalt", a=5.64) * (2, 2, 2)
MolecularViewer(
atoms,
show_polyhedron=True,
polyhedron_color_mode="geometry",
polyhedron_opacity=0.25,
).show()
How polyhedra are chosen:
- Centres follow the Crystal Toolkit rule: a site with at least four
neighbours that are all more electronegative. Rock salt therefore shows only
Na-centred octahedra.
polyhedron_pairs=["Si-O"]names the centre–vertex pairs explicitly. - Vertices are the nearest coordination shell: atoms within
(1 + polyhedron_tolerance)× the closest distance, periodic images included.polyhedron_neighbors="bonds"uses the drawn bonds instead. - A polyhedron is drawn only when all its vertex atoms are drawn. At the
cell boundary, add
cell_repeatorshow_bonded_neighbors=Trueto close the shells.
polyhedron_color_mode colors faces by the center atom (default), the
neighbor atoms, the coordination number, or the geometry: the vertex
angles are matched to ideal shapes (tetrahedral, square-planar, octahedral, …)
and poor fits get the "other" color.
Ring highlight
show_rings=True fills every smallest ring of 4 to 8 atoms with the color of
its most common element. Larger macrocycles are not filled.
from ase.io import read
atoms = read("carbazole.xyz")
MolecularViewer(atoms, show_rings=True, ring_opacity=0.35).show()
Polyhedra and rings can be combined in one viewer.