Multi-Cell Overview¶
Render a grid of finished structures side-by-side with synchronised rotation. Useful for comparing how the same material looks across the full disorder spectrum, or for showing several materials at once.
Usage¶
import tricor as tc
cells = []
for name in ["liquid", "amorphous", "SRO", "MRO",
"LRO", "nanocrystalline"]:
cell = tc.Supercell.from_atoms(atoms, (40, 40, 40), rng_seed=42)
cell.generate(shell_target, **tc.Supercell.PRESETS[name])
cells.append((cell, name))
tc.export_overview_html("silicon_overview.html", cells)
Each entry in cells_and_labels is a (Supercell, label) pair. Labels
are rendered as text badges in the top-left corner of each panel.
Features¶
One WebGL context, many scenes: each panel renders into its own viewport using
setScissor/setViewport, so even six structures in one file stay responsive.Synchronised rotation: all panels share a single camera. The structure auto-rotates at ~14°/s. Dragging any panel pauses the spin and lets the user orbit manually; the spin resumes ~0.5 s after release.
Aspect-aware framing: the camera distance is recomputed every frame to fit each cube’s bounding sphere, so cubes stay in-frame whether the iframe is tall or wide.
Cartoon style: ASE jmol colours for atoms, thin black outlines, red bonds.
Tetrahedral bond filter: only bonds that sit inside ±
bond_length_tolof the first-neighbour distance and whose 4 nearest neighbours subtend angles withinbond_angle_tol_degofideal_angle_degare drawn. Atoms that fail either test contribute no bonds, so disordered regimes naturally show fewer bonds than crystalline ones.
Parameters¶
Parameter |
Default |
Description |
|---|---|---|
|
required |
File path for the generated HTML. |
|
required |
Iterable of |
|
3 |
Number of columns in the grid. Rows are inferred. |
|
0.18 |
Multiplier on each atom’s covalent radius. |
|
0.07 |
Bond cylinder radius in Å. |
|
|
RGB bond colour in |
|
|
CSS colour for the viewport. |
|
|
Unused; text should go in the surrounding page. |
|
|
Unused; text should go in the surrounding page. |
|
1.2 |
Bond search cutoff = |
|
4 |
Maximum bonds kept per atom before the angular filter. |
|
0.10 |
Accept bonds within |
|
109.47 |
Ideal angle for the tetrahedral check (Si-like). |
|
18.0 |
Maximum deviation of any pairwise angle from the ideal. |
|
|
Single-group polyhedra config (one kind per scene). Dict of detector keys ( |
|
|
Multi-group polyhedra: list of dicts, each with a |
For a non-tetrahedral material, set ideal_angle_deg and
bond_angle_tol_deg appropriately, or disable the angular filter by
setting bond_angle_tol_deg to a large value (e.g. 90).
Multi-group polyhedra (carbon sp²/sp³)¶
For materials with a phase mix, pass a polyhedra_groups list so
each group runs its own detector and renders with its own colour.
Each group may also carry virtual_species=N to restrict detection
to atoms flagged with that shell-target species index (see
Supercell.generate(..., grain_sources=...)):
tc.export_overview_html(
"carbon_overview.html",
cells,
polyhedra_groups=[
dict(kind="triangles", center_symbol="C", vertex_symbol="C",
bond_length=1.42, ideal_angle_deg=120.0, angle_tol_deg=22.0,
virtual_species=0, scale=0.5,
color=(0.25, 0.65, 0.35), opacity=0.85), # sp² green
dict(kind="tetrahedra", center_symbol="C", vertex_symbol="C",
bond_length=1.54, ideal_angle_deg=109.47, angle_tol_deg=22.0,
virtual_species=1, scale=0.5,
color=(0.20, 0.30, 0.75), opacity=0.65), # sp³ navy
],
)
The triangles kind emits a 4-vertex motif [centre, j, k, l]
rendered as three sub-triangles all anchored at the centre
((i, j, k), (i, k, l), (i, l, j)), so the mesh always
touches the parent atom even at unequal bond lengths after relax.