Skip to main content

API Reference

Classes

Core classes

Geometry

Molecular geometry.

View

A py3Dmol.view with helpers for geometries and arrows.

Algorithm

Identity algorithm.

AlgorithmRegistry

Registry of all known identity algorithms.

Geometry Methods

Methods for the Geometry class

Geometry.validate_symbols()

Validate and canonicalize atomic symbols.

Geometry.validate_consistency()

Check that symbols, coordinates, charge, and spin are consistent.

Geometry.__eq__()

Compare geometries field by field, including exact coordinates.

Geometry.__repr__()

Render the geometry as an xyz block.

Geometry.xyz_block()

Format the geometry as an xyz block (see xyz_block).

Geometry.xyz_file()

Write the geometry to an xyz file (see xyz_file).

Geometry.from_xyz_block()

Parse a geometry from an xyz block (see from_xyz_block).

Geometry.from_xyz_file()

Read a geometry from an xyz file (see from_xyz_file).

Geometry.relabel_atoms()

Reorder the atoms.

Enumerations

Enum types

IdentityKind

Category of molecular identity.

Exceptions

Exception classes

geom.ElementNotFoundError

No element matches the given atomic number or symbol.

geom.XYZFormatError

An xyz block could not be parsed.

Functions

Public functions

geom.xyz_block()

Format a geometry as an xyz block.

geom.from_xyz_block()

Parse a geometry from a single-frame xyz block.

geom.xyz_file()

Write a geometry to an xyz file.

geom.from_xyz_file()

Read a geometry from an xyz file (see from_xyz_block).

geom.xyz_trajectory_block()

Format geometries as a multi-frame xyz block, one frame per geometry.

geom.from_xyz_trajectory_block()

Parse geometries from a multi-frame xyz block, e.g. a list of conformers.

geom.xyz_trajectory_comments()

Get the comment line of each frame of a multi-frame xyz block.

geom.xyz_trajectory_file()

Write geometries to a multi-frame xyz file (see xyz_trajectory_block).

geom.from_xyz_trajectory_file()

Read geometries from a multi-frame xyz file (see from_xyz_trajectory_block).

geom.rdkit_mol()

Convert a geometry to an RDKit molecule.

geom.from_rdkit_mol()

Convert an RDKit molecule to a geometry, embedding coordinates if missing.

geom.select_atoms()

Select a subset of atoms.

geom.remove_atoms()

Remove a subset of atoms.

geom.join()

Join geometries into one.

geom.center_of_mass()

Calculate the center of mass.

geom.distance_matrix()

Calculate the interatomic distance matrix.

geom.distance_keys()

Build a sorted distance descriptor.

geom.adjacency_matrix()

Determine connectivity from covalent radii.

geom.inertia_tensor()

Calculate the inertia tensor about the center of mass.

geom.principal_axes()

Calculate the principal moments and axes of inertia.

geom.inertial_frame_rotation()

Find the rotation into the principal axis frame.

geom.distance()

Measure the distance between two atoms.

geom.angle()

Measure the angle between three atoms.

geom.dihedral()

Measure the dihedral angle between four atoms.

geom.bonds()

List bond distances.

geom.angles()

List bond angles.

geom.dihedrals()

List dihedral angles.

geom.translate()

Translate a geometry.

geom.reflect()

Reflect a geometry across a plane.

geom.rotate()

Rotate a geometry about a point.

geom.twist()

Rotate a group about a bond, e.g. a methyl or amine group.

geom.twist_angle()

Find the twist about a bond that turns one direction onto another.

geom.center()

Translate a geometry so that its center of mass is at the origin.

geom.alignment_rotation()

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

geom.axis_alignment_rotation()

Find the smallest rotation pointing the vector between two atoms along an axis.

geom.view()

Display a geometry with py3Dmol.

geom.render_svg()

Render a geometry as an SVG image with xyzrender.

geom.render_gif()

Render a geometry rotating about an axis as a GIF with xyzrender.

Constants

Module-level constants and data

hill_formula
rdkit_inchi
rdkit_smiles
geom.CoordinatesField

(N, 3) coordinates field in Angstroms; pint quantities are converted.

geom.FloatArray

Other

Additional exports

rd

RDKit bridge, operating on RDKit Mol objects only (never Geometry).