---
name: protomol
description: >
  Use when writing Python code that uses the protomol package.
license: MIT
compatibility: Requires Python >= 3.13.
---

# protomol

## Installation

```bash
pip install protomol
```

## API overview

### Classes

Core classes

- `Rotor`: A hindered rotor: the torsion about `axis` that turns `top` (P85, P86)
- `Umbrella`: A pyramidal centre left flexible: its inversion is a double well (P87)
- `AtropBond`: A rigid single bond (atropisomer) or an even cumulated chain (allene axis)
- `Octahedral`: An octahedral centre: (center, n1, …, n6), n1 trans to n2, n3 to n5, n4 to n6
- `PlanarBond`: A planar bond or an odd cumulated chain: (a, b, end1, end2, c, d)
- `SquarePlanar`: A square-planar centre: (center, n1, n2, n3, n4)
- `StereoChange`: One stereo site that changes in a reaction: its LS on each side and at the TS
- `Tetrahedral`: A tetrahedral centre: (center, n1, n2, n3, n4)
- `TrigonalBipyramidal`: A trigonal-bipyramidal centre: (center, a1, a2, e1, e2, e3), e.g. an SN2 TS
- `MolGraph`: A molecular graph: element symbols and bonds (pairs of atom indices)
- `ReactionGraph`: A reaction or TS graph
- `StereoMolGraph`: A molecular graph with local stereodescriptors (LS)
- `StereoReactionGraph`: A reaction or TS graph with stereo

### Dataclasses

Data-holding classes

- `GeometryMismatches`: Where a graph and a geometry disagree (`geometry_mismatches`)

### Exceptions

Exception classes

- `GraphError`: Invalid graph input (stereomol's GraphError)

### Functions

Public functions

- `canonical_direction`: `gra` or its reverse with the smaller canonical JSON, and whether reversed
- `canonical_enantiomer`: `gra` or its `enantiomer`, whichever has the smaller canonical JSON
- `canonical_form`: The canonical graph and the atom map to it: `(canonical, atom_map)`
- `canonical_json`: The JSON of the canonical graph: `to_json(canonical_form(gra)[0])`
- `enantiomer`: The mirror image: every chiral LS inverted, atom indices kept
- `is_chiral`: Whether the graph differs from its mirror image, up to atom numbering
- `ts_graphs`: The topologically distinct TS channels from reactants to products (CCV)
- `deduplicate`: The first graph of each isomorphism class, in input order
- `isomorphism`: An atom map `m` with `relabel(g1, m) == g2`, or None if there is none
- `display`: Show the graph in Jupyter
- `reacting_core`: The atoms CREST holds at a TS: those of the breaking and forming bonds (P67)
- `rings`: The rings of a graph: a minimum cycle basis (SSSR), sorted (P85)
- `rotors`: The hindered rotors of a stereo graph, sorted by their axes' atoms (P86)
- `symmetry_number`: The symmetry number: the number of stereo-preserving automorphisms (P89)
- `umbrellas`: The pyramidal centres the LS leave flexible, sorted by centre (P87)
- `embed`: A 3D geometry of the graph, in its atom order, with its charge and spin
- `from_geometry`: The stereo graph of a geometry, keeping its atom order
- `geometry_mismatches`: Where the graph and the geometry disagree, atom i on atom i
- `stereoisomers`: The distinct determined stereoisomers of a stereo graph, mirror images too
- `transition_state`: The TS of a channel: the side slots its TS doesn't fix made undetermined
- `from_json`: The graph of the type named in the JSON, validated in strict mode
- `to_json`: The graph as compact JSON: its fields in field order, `type` first
- `low_t`: The graph with the low-T scheme's stereo sites (P54), keeping its parities
- `products`: The product side, as one (possibly disconnected) graph in the same atom order
- `reactants`: The reactant side, as one (possibly disconnected) graph in the same atom order
- `reaction_graph`: The reaction graph of two index-aligned graphs (same symbols, charge and spin)
- `relabel`: The graph with atom k of the result = atom `atom_map[k]` of `gra`
- `reverse`: The reverse reaction: breaking and forming swap, and so do the change slots
- `without_stereo`: The graph without its LS and changes, as a `MolGraph` or a `ReactionGraph`
- `from_reaction_smiles`: The stereo reaction graph of an atom-mapped reaction SMILES (P62)
- `from_smiles`: The stereo graph of a SMILES, with every atom explicit (stereomol's index rule)
- `invert`: The other configuration. An undetermined LS is returned unchanged
- `isomers`: Every determined configuration of `ls`, in a fixed order
- `site`: The centre atom, or the sorted pair of end atoms (the key in the graph's maps)
- `is_determined`: Whether every LS is determined (a workflow graph needs this)
- `neighbors`: The sorted neighbours of atom `i`, over every bond (breaking and forming too)
- `remove_stereo`: A new graph without the LS or change at a site
- `stereo_at`: The LS or change at a site (a centre atom or a bond's ends), or None
- `with_stereo`: A new graph with each item at its site, replacing what was there
- `examples.species`
- `examples.abstraction_ts`
- `examples.stereoisomerization_ts`

### Type Aliases

Type alias definitions

- `AtomStereo`: Type alias
- `BondStereo`: Type alias
- `Stereo`: Type alias
- `AnyGraph`: Type alias

## Resources

- [Full documentation](https://avcopan.github.io/protomol/)
- [llms.txt](llms.txt) — Indexed API reference for LLMs
- [llms-full.txt](llms-full.txt) — Comprehensive documentation for LLMs
- [Source code](https://github.com/avcopan/protomol)
