## axis_alignment_rotation()


Find the smallest rotation pointing the vector between two atoms along an axis.


Usage

``` python
axis_alignment_rotation(
    geo,
    keys,
    axis=(0.0, 0.0, 1.0),
)
```


Use it to put a bond or other molecular axis along a coordinate axis, e.g. before spinning the geometry about that axis.


## Parameters


`geo: Geometry`  
Geometry.

`keys: Sequence[int]`  
Two atoms, `(i, j)`. The vector from `i` to `j` is aligned.

`axis: ArrayLike = (0.0, 0.0, 1.0)`  
Direction to point it in.


## Returns


`Rotation`  
The rotation, to apply with [rotate](rotate.md#autogeom.rotate) (about atom `i` to keep it in

place, e.g. `rotate(geo, rot, origin=geo.coordinates[i])`).


## Raises


`ValueError`  
If `keys` isn't two distinct atoms at different positions.


## Examples

``` python
    >>> import autogeom
    >>> geo = autogeom.Geometry(
    ...     symbols=["H", "H"], coordinates=[[0, 0, 0], [1, 0, 0]], charge=0, spin=0
    ... )
    >>> rot = autogeom.axis_alignment_rotation(geo, [0, 1], axis=[0, 1, 0])
    >>> autogeom.rotate(geo, rot).coordinates.round(6).tolist()
```

    [[0.0, 0.0, 0.0], [0.0, 1.0, 0.0]]
