Skip to main content

angle()

Measure the angle between three atoms.

Usage

Source

angle(
    geo,
    keys,
    *,
    degrees=False,
)

Parameters

geo: Geometry

Geometry.

keys: Sequence[int]

Indices of the three atoms, with the vertex in the middle.

degrees: bool = False
If True, return degrees instead of radians.

Returns

float
The angle, between 0 and pi.

Examples

    >>> import autogeom
    >>> geo = autogeom.Geometry(
    ...     symbols=["O", "H", "H"],
    ...     coordinates=[[0, 0, 0], [1, 0, 0], [0, 1, 0]],
    ...     charge=0,
    ...     spin=0,
    ... )
    >>> autogeom.angle(geo, [1, 0, 2], degrees=True)
90.0