## select_atoms()


Select a subset of atoms.


Usage

``` python
select_atoms(
    geo,
    keys,
    *,
    charge=None,
    spin=None,
)
```


## Parameters


`geo: Geometry`  
Geometry.

`keys: Sequence[int]`  
Indices of the atoms to keep, in the order to keep them.

`charge: int | None = None`  
Charge of the selection. Defaults to the charge of `geo`.

`spin: int | None = None`  
Spin of the selection. Defaults to the spin of `geo` if that is consistent with the electron count, and otherwise to the lowest consistent spin (e.g. 1 for a methyl radical selected from methane).


## Returns


`Geometry`  
The selected atoms.


## Examples

``` python
    >>> import numpy as np
    >>> import autogeom
    >>> geo = autogeom.Geometry(
    ...     symbols=["C", "H", "H", "H", "H"],
    ...     coordinates=np.zeros((5, 3)),
    ...     charge=0,
    ...     spin=0,
    ... )
    >>> methyl = autogeom.select_atoms(geo, [0, 1, 2, 3])
    >>> methyl.symbols, methyl.spin
```

    (['C', 'H', 'H', 'H'], 1)
