## alignment_rotation()


Find the rotation that best aligns a reference geometry onto a geometry.


Usage

``` python
alignment_rotation(
    geo,
    ref,
)
```


The rotation is found by the Kabsch algorithm, after moving both centers of mass to the origin. Atoms are matched by index.


## Parameters


`geo: Geometry`  
Target geometry.

`ref: Geometry`  
Reference geometry, with the same atoms as `geo`.


## Returns


`Rotation`  
The rotation `rot` minimizing the RMSD between `rotate(center(ref), rot)`

and `center(geo)`.


## Raises


`ValueError`  
If the geometries have different symbols.


## Examples

``` python
    >>> from scipy.spatial.transform import Rotation
    >>> import autogeom
    >>> ref = autogeom.Geometry(
    ...     symbols=["O", "H", "H"],
    ...     coordinates=[[0, 0, 0], [1, 0, 0], [0, 1, 0]],
    ...     charge=0,
    ...     spin=0,
    ... )
    >>> rot = Rotation.from_euler("z", 30, degrees=True)
    >>> geo = autogeom.rotate(ref, rot)
    >>> round(float(autogeom.alignment_rotation(geo, ref).magnitude()), 6)
```

    0.523599
