Skip to main content

AI / Agents

Skills
llms.txt
llms-full.txt

Developers

Andreas V. Copan

Author

Community

Contributing guide
Full license MIT

Meta

Requires: Python >= 3.13
Package Info

autogeom

License: MIT Pixi Badge Code style: ruff Typing: ty Copier

autogeom is a Python library for 3D molecular structures. It centers on a single Geometry model (atomic symbols, Cartesian coordinates, charge, and spin) and the functions that operate on it: xyz I/O, measurements, transformations, alignment, 3D visualization, and conversions to and from InChI, SMILES, and RDKit.

See the documentation for the user guide and API reference.

autogeom continues the Geometry part of automol 0.0.31 under a new name. See the changelog for what changed.

Installation

autogeom requires Python 3.13 or later. With Pixi, add it from the avcopan/automech channel on prefix.dev:

pixi workspace channel add https://repo.prefix.dev/avcopan/automech
pixi add autogeom
pixi add --pypi xyzrender  # optional: only on PyPI, needed for render_svg/render_gif

Or install it from PyPI, which includes xyzrender:

pip install autogeom  # or: uv add autogeom

For local development, see Contributing.

Usage

Everything is imported from the package root.

Geometry

import autogeom
from autogeom import Geometry

water = Geometry(
    symbols=["O", "H", "H"],
    coordinates=[[0.0, 0.0, 0.0], [0.0, 0.0, 0.96], [0.93, 0.0, -0.24]],
    charge=0,
    spin=0,
)

com = autogeom.center_of_mass(water)
angle = autogeom.angle(water, [1, 0, 2], degrees=True)

InChI, SMILES, and RDKit

autogeom.inchi(water)  # "InChI=1S/H2O/h1H2"
autogeom.smiles(water)  # "O"
autogeom.formula(water)  # "H2O"

ethanol = autogeom.from_smiles("CCO")  # embeds 3D coordinates
mol = autogeom.rdkit_mol(ethanol)  # rdkit.Chem.Mol

Visualization

from autogeom import View

# Visualization (e.g. in a Jupyter notebook)
view = View()
view.add_geometry(water, label=True)

In a notebook, a Geometry also displays itself as a 3D view.

See the documentation for more on geometries, conversions, and visualization.

Contributing

Pull requests are welcome. For major changes, please open an issue first to discuss what you would like to change. See Contributing for the design rules and workflow.

License

This project is licensed under the MIT License.

Credits

This package was created with copier and the avcopan/copier-pixi-python project template.