Skip to main content

from_geometry()

The stereo graph of a geometry, keeping its atom order.

Usage

Source

from_geometry(geo)

Bonds come from covalent radii (autogeom.adjacency_matrix, with valences capped), and a Lewis structure from autogeom’s solver, with the geometry’s charge and spin. The LS sites are the ones from_smiles would give for that structure (the low-T approximation), and every site’s parity is read from the coordinates, trivial sites included, so the graph describes this geometry atom for atom. A site whose coordinates don’t decide it (a flat centre, a double bond twisted by about 90°) stays undetermined.

>>> import autogeom
>>> geo = autogeom.Geometry(
...     symbols=["O", "H", "H"],
...     coordinates=[[0.0, 0.0, 0.0], [0.96, 0.0, 0.0], [-0.24, 0.93, 0.0]],
...     charge=0,
...     spin=0,
... )
>>> from_geometry(geo).bonds

((0, 1), (0, 2))

Raises

GraphError
If no Lewis structure fits the bonds, charge and spin.