twist()
Rotate a group about a bond, e.g. a methyl or amine group.
Usage
twist(
geo,
keys,
angle,
*,
degrees=False,
)Everything on the side of atom j of the bond (i, j) rotates about the axis from i to j, by the right-hand rule (thumb from i to j). Bond lengths and angles are kept; only the dihedral angles about the bond change.
Parameters
geo: Geometry-
Geometry.
keys: Sequence[int]-
The bond,
(i, j). The side ofjmoves. angle: float-
Angle to rotate by.
degrees: bool = False-
If
True, angle is in degrees instead of radians.
Returns
Geometry- The twisted geometry.
Raises
ValueError-
If
iandjaren’t bonded, or the bond is in a ring.
Examples
>>> import autogeom
>>> geo = autogeom.Geometry(
... symbols=["H", "O", "O", "H"],
... coordinates=[[1, 0, 0], [0, 0, 0], [0, 0, 1.4], [1, 0, 1.4]],
... charge=0,
... spin=0,
... )
>>> geo = autogeom.twist(geo, (1, 2), 90, degrees=True)
>>> round(autogeom.dihedral(geo, [0, 1, 2, 3], degrees=True), 6)90.0