Skip to main content

dihedral()

Measure the dihedral angle between four atoms.

Usage

Source

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

Looking down the 2-3 bond, the angle is positive when atom 4 is rotated clockwise from atom 1.

Parameters

geo: Geometry

Geometry.

keys: Sequence[int]

Indices of the four atoms.

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

Returns

float
The dihedral angle, between -pi and pi.

Examples

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