# API Reference


## Geometry


The model at the center of the package, and selecting or combining its atoms


[Geometry](Geometry.md#autogeom.Geometry)  
Molecular geometry.

[select_atoms()](select_atoms.md#autogeom.select_atoms)  
Select a subset of atoms.

[remove_atoms()](remove_atoms.md#autogeom.remove_atoms)  
Remove a subset of atoms.

[join()](join.md#autogeom.join)  
Join geometries into one.


## Geometry Methods


Methods for the Geometry class


[Geometry.__eq__()](Geometry.__eq__.md#autogeom.Geometry.__eq__)  
Compare geometries field by field, including exact coordinates.

[Geometry.__repr__()](Geometry.__repr__.md#autogeom.Geometry.__repr__)  
Render the geometry as an xyz block.

[Geometry.atom_count](Geometry.atom_count.md#autogeom.Geometry.atom_count)  
Number of atoms.

[Geometry.masses](Geometry.masses.md#autogeom.Geometry.masses)  
Atomic masses.

[Geometry.atomic_numbers](Geometry.atomic_numbers.md#autogeom.Geometry.atomic_numbers)  
Atomic numbers.

[Geometry.covalent_radii](Geometry.covalent_radii.md#autogeom.Geometry.covalent_radii)  
Pyykko covalent radii, in Angstroms.

[Geometry.valences](Geometry.valences.md#autogeom.Geometry.valences)  
Numbers of valence electrons.

[Geometry.xyz_block()](Geometry.xyz_block.md#autogeom.Geometry.xyz_block)  
Format the geometry as an xyz block (see `xyz_block`).

[Geometry.xyz_file()](Geometry.xyz_file.md#autogeom.Geometry.xyz_file)  
Write the geometry to an xyz file (see `xyz_file`).

[Geometry.from_xyz_block()](Geometry.from_xyz_block.md#autogeom.Geometry.from_xyz_block)  
Parse a geometry from an xyz block (see `from_xyz_block`).

[Geometry.from_xyz_file()](Geometry.from_xyz_file.md#autogeom.Geometry.from_xyz_file)  
Read a geometry from an xyz file (see `from_xyz_file`).

[Geometry.relabel_atoms()](Geometry.relabel_atoms.md#autogeom.Geometry.relabel_atoms)  
Reorder the atoms.


## XYZ files


Reading and writing single- and multi-frame xyz


[xyz_block()](xyz_block.md#autogeom.xyz_block)  
Format a geometry as an xyz block.

[from_xyz_block()](from_xyz_block.md#autogeom.from_xyz_block)  
Parse a geometry from a single-frame xyz block.

[xyz_file()](xyz_file.md#autogeom.xyz_file)  
Write a geometry to an xyz file.

[from_xyz_file()](from_xyz_file.md#autogeom.from_xyz_file)  
Read a geometry from an xyz file (see `from_xyz_block`).

[xyz_trajectory_block()](xyz_trajectory_block.md#autogeom.xyz_trajectory_block)  
Format geometries as a multi-frame xyz block, one frame per geometry.

[from_xyz_trajectory_block()](from_xyz_trajectory_block.md#autogeom.from_xyz_trajectory_block)  
Parse geometries from a multi-frame xyz block, e.g. a list of conformers.

[xyz_trajectory_file()](xyz_trajectory_file.md#autogeom.xyz_trajectory_file)  
Write geometries to a multi-frame xyz file (see `xyz_trajectory_block`).

[from_xyz_trajectory_file()](from_xyz_trajectory_file.md#autogeom.from_xyz_trajectory_file)  
Read geometries from a multi-frame xyz file (see `from_xyz_trajectory_block`).

[xyz_trajectory_comments()](xyz_trajectory_comments.md#autogeom.xyz_trajectory_comments)  
Get the comment line of each frame of a multi-frame xyz block.


## Properties and measurements


Quantities computed from the coordinates


[center_of_mass()](center_of_mass.md#autogeom.center_of_mass)  
Calculate the center of mass.

[inertia_tensor()](inertia_tensor.md#autogeom.inertia_tensor)  
Calculate the inertia tensor about the center of mass.

[principal_axes()](principal_axes.md#autogeom.principal_axes)  
Calculate the principal moments and axes of inertia.

[distance_matrix()](distance_matrix.md#autogeom.distance_matrix)  
Calculate the interatomic distance matrix.

[adjacency_matrix()](adjacency_matrix.md#autogeom.adjacency_matrix)  
Determine connectivity from covalent radii.

[distance_keys()](distance_keys.md#autogeom.distance_keys)  
Build a sorted distance descriptor.

[distance()](distance.md#autogeom.distance)  
Measure the distance between two atoms.

[angle()](angle.md#autogeom.angle)  
Measure the angle between three atoms.

[dihedral()](dihedral.md#autogeom.dihedral)  
Measure the dihedral angle between four atoms.

[bonds()](bonds.md#autogeom.bonds)  
List bond distances.

[angles()](angles.md#autogeom.angles)  
List bond angles.

[dihedrals()](dihedrals.md#autogeom.dihedrals)  
List dihedral angles.


## Transformations


Moving atoms, and the rotations that align geometries


[translate()](translate.md#autogeom.translate)  
Translate a geometry.

[rotate()](rotate.md#autogeom.rotate)  
Rotate a geometry about a point.

[reflect()](reflect.md#autogeom.reflect)  
Reflect a geometry across a plane.

[center()](center.md#autogeom.center)  
Translate a geometry so that its center of mass is at the origin.

[twist()](twist.md#autogeom.twist)  
Rotate a group about a bond, e.g. a methyl or amine group.

[twist_angle()](twist_angle.md#autogeom.twist_angle)  
Find the twist about a bond that turns one direction onto another.

[alignment_rotation()](alignment_rotation.md#autogeom.alignment_rotation)  
Find the rotation that best aligns a reference geometry onto a geometry.

[axis_alignment_rotation()](axis_alignment_rotation.md#autogeom.axis_alignment_rotation)  
Find the smallest rotation pointing the vector between two atoms along an axis.

[inertial_frame_rotation()](inertial_frame_rotation.md#autogeom.inertial_frame_rotation)  
Find the rotation into the principal axis frame.


## Conversions


InChI, SMILES, formulas, and RDKit molecules


[inchi()](inchi.md#autogeom.inchi)  
Generate the standard InChI string of a geometry with RDKit.

[from_inchi()](from_inchi.md#autogeom.from_inchi)  
Embed a geometry for an InChI string with RDKit.

[smiles()](smiles.md#autogeom.smiles)  
Generate the canonical SMILES string of a geometry with RDKit.

[from_smiles()](from_smiles.md#autogeom.from_smiles)  
Embed a geometry for a SMILES string with RDKit.

[formula()](formula.md#autogeom.formula)  
Generate the molecular formula of a geometry in Hill order.

[rdkit_mol()](rdkit_mol.md#autogeom.rdkit_mol)  
Convert a geometry to an RDKit molecule.

[from_rdkit_mol()](from_rdkit_mol.md#autogeom.from_rdkit_mol)  
Convert an RDKit molecule to a geometry, embedding coordinates if missing.


## Visualization


Interactive views and rendered images


[View](View.md#autogeom.View)  
A `py3Dmol.view` with helpers for geometries and arrows.

[view()](view.md#autogeom.view)  
Display a geometry with py3Dmol.

[render_svg()](render_svg.md#autogeom.render_svg)  
Render a geometry as an SVG image with xyzrender.

[render_gif()](render_gif.md#autogeom.render_gif)  
Render a geometry rotating about an axis as a GIF with xyzrender.


## Exceptions and units


Errors raised by the package, and its unit registry


[GeometryConversionError](GeometryConversionError.md#autogeom.GeometryConversionError)  
A geometry could not be converted to or from another representation.

[XYZFormatError](XYZFormatError.md#autogeom.XYZFormatError)  
An xyz block could not be parsed.

[ElementNotFoundError](ElementNotFoundError.md#autogeom.ElementNotFoundError)  
No element matches the given atomic number or symbol.

[ureg](ureg.md#autogeom.ureg)  
Shared `pint` unit registry, e.g. for coordinates with units (`ureg.bohr`).


## RDKit molecules


`autogeom.rd`: functions on RDKit `Mol` objects, which never see a `Geometry`


[rd.from_smiles()](rd.from_smiles.md#autogeom.rd.from_smiles)  
Parse a SMILES string.

[rd.smiles()](rd.smiles.md#autogeom.rd.smiles)  
Write a canonical, non-isomeric SMILES string.

[rd.from_inchi()](rd.from_inchi.md#autogeom.rd.from_inchi)  
Parse an InChI string.

[rd.inchi()](rd.inchi.md#autogeom.rd.inchi)  
Write a standard InChI string.

[rd.from_xyz_block()](rd.from_xyz_block.md#autogeom.rd.from_xyz_block)  
Parse an xyz block, determining connectivity (but not bond orders).

[rd.xyz_block()](rd.xyz_block.md#autogeom.rd.xyz_block)  
Write an xyz block.

[rd.symbols()](rd.symbols.md#autogeom.rd.symbols)  
Get the atomic symbols.

[rd.coordinates()](rd.coordinates.md#autogeom.rd.coordinates)  
Get the atomic coordinates.

[rd.charge()](rd.charge.md#autogeom.rd.charge)  
Get the total formal charge.

[rd.spin()](rd.spin.md#autogeom.rd.spin)  
Get the number of unpaired electrons.

[rd.has_coordinates()](rd.has_coordinates.md#autogeom.rd.has_coordinates)  
Check whether the molecule has a conformer.

[rd.set_coordinates()](rd.set_coordinates.md#autogeom.rd.set_coordinates)  
Set the atomic coordinates, replacing any existing conformers.

[rd.add_coordinates()](rd.add_coordinates.md#autogeom.rd.add_coordinates)  
Embed 3D coordinates if the molecule has none.

[rd.add_atom_numbers()](rd.add_atom_numbers.md#autogeom.rd.add_atom_numbers)  
Label atoms for drawing as `f"{symbol}{number}"`.

[rd.canonical_ranks()](rd.canonical_ranks.md#autogeom.rd.canonical_ranks)  
Rank atoms canonically.

[rd.assign_stereochemistry()](rd.assign_stereochemistry.md#autogeom.rd.assign_stereochemistry)  
Assign stereochemistry from the 3D coordinates.

[rd.chiral_centers()](rd.chiral_centers.md#autogeom.rd.chiral_centers)  
Find chiral centers and their R/S labels.

[rd.max_bond_count()](rd.max_bond_count.md#autogeom.rd.max_bond_count)  
Get the maximum number of bonds to an atom.

[rd.from_connectivity()](rd.from_connectivity.md#autogeom.rd.from_connectivity)  
Build a molecule from connectivity, perceiving its Lewis structure.

[rd.EMBED_SEED](rd.EMBED_SEED.md#autogeom.rd.EMBED_SEED)  
Default random seed for coordinate embedding, for reproducible geometries.


## Elements


`autogeom.element`: periodic table data, looked up by atomic number or symbol


[element.Element](element.Element.md#autogeom.element.Element)  
Chemical element.

[element.from_key()](element.from_key.md#autogeom.element.from_key)  
Look up an element.

[element.number()](element.number.md#autogeom.element.number)  
Get the atomic number.

[element.mass_number()](element.mass_number.md#autogeom.element.mass_number)  
Get the mass number.

[element.symbol()](element.symbol.md#autogeom.element.symbol)  
Get the canonical symbol, e.g. `"Cl"` for `"cl"` or `17`.

[element.mass()](element.mass.md#autogeom.element.mass)  
Get the atomic mass.

[element.covalent_radius()](element.covalent_radius.md#autogeom.element.covalent_radius)  
Get the Pyykko covalent radius.

[element.group()](element.group.md#autogeom.element.group)  
Get the group number.

[element.period()](element.period.md#autogeom.element.period)  
Get the period number.

[element.electronegativity()](element.electronegativity.md#autogeom.element.electronegativity)  
Get the Pauling electronegativity.

[element.is_metal()](element.is_metal.md#autogeom.element.is_metal)  
Check whether an element is a metal.

[element.shell_capacity()](element.shell_capacity.md#autogeom.element.shell_capacity)  
Get the valence shell capacity of the element's period.

[element.valence()](element.valence.md#autogeom.element.valence)  
Get the number of valence electrons.

[element.bonding_capacity()](element.bonding_capacity.md#autogeom.element.bonding_capacity)  
Get the bonding capacity, `min(valence, shell_capacity - valence)`.


## Types


`autogeom.types`: array types and Pydantic fields


[types.FloatArray](types.FloatArray.md#autogeom.types.FloatArray)  

[types.FloatArrayField](types.FloatArrayField.md#autogeom.types.FloatArrayField)  
Float array field, serialized as nested lists.

[types.CoordinatesField](types.CoordinatesField.md#autogeom.types.CoordinatesField)  
`(N, 3)` coordinates field in Angstroms; `pint` quantities are converted.
