compute_aromatic_cycles
go-to Main aromatic-ring API; caches cycles on the Atoms object after bond detection.
analyze.compute_aromatic_cycles(
ase_atoms,
*,
force_recompute=False,
expand_isomorphisms=True,
default_ring_sizes=None,
merge_duplicate_sites=True,
expand_to_unit_cell=True,
)Detect aromatic cycles and cache the result in ase_atoms.info.
Mirrors mgr.analyze.compute_aromatic_cycles:
- Ensures covalent bonds are present (calls :func:
update_with_covalent_bondsif needed). - Returns the cached
ase_atoms.info["aromatic_cycles"]whenforce_recompute=Falseand the info entry is already populated. - Otherwise detects rings (unit-cell chordless search by default), stores the result in
ase_atoms.info["aromatic_cycles"], and returns it.
When merge_duplicate_sites is True (default), atoms that share the same element and wrapped fractional coordinates are merged before graph construction. Cycle atom indices are mapped back to the input structure.
When expand_to_unit_cell is True (default), rings are found on the full structure with :func:find_aromatic_cycles_in_unit_cell (sizes default_ring_sizes, default 5–9) so every distinct linker in the cell is highlighted. When False, uses graph cycle detection on a merged or full structure (representative atoms only for merged sites).
Used by :func:~mofography.visualize.plot_aromatic_rings (Plotly) and :func:~mofography.movies.make_aromatic_rings_trace (Three.js) when a pre-computed cycle list is not supplied.