API Reference

Classes

Core classes

Builder

Build a molecule atom by atom on a tetrahedral grid.

Builder Methods

Methods for the Builder class

Builder.slot_direction()

Get the unit direction of a slot of an atom.

Builder.open_slots()

List the empty slots of an atom.

Builder.add()

Add an atom.

Builder.add_hydrogens()

Fill atoms up to their default valence (see VALENCES) with hydrogens.

Builder.geometry()

Get the geometry.

Builder.umbrella_image()

Add the mirror image of a branch, e.g. to draw an umbrella inversion.

Functions

Public functions

orient()

Rotate a geometry by hand in the browser and get the rotation.

render()

Render a geometry as an SVG, looking down the z axis (x right, y up).

tetrahedral_basis()

Get the four bond directions of a tetrahedral grid.

draw.orient_page()

Make the web page for orienting a geometry in the browser.

draw.serve_orient_page()

Serve the orientation page from a local server, in a background thread.

Constants

Module-level constants and data

VALENCES

Default number of bonds to each element, used by Builder.add_hydrogens.

STYLE

House style: flat atoms with black bonds, drawn as oriented (no auto-rotation).

TETRAHEDRAL_ANGLE

The ideal tetrahedral angle, arccos(-1/3) (about 109.47 degrees), in radians.

XH_LENGTH

Ideal bond length to hydrogen, in Angstroms.

XY_LENGTH

Ideal bond length between heavy atoms, in Angstroms.

Other

Additional exports

grid

The tetrahedral grid: ideal bond directions, angles, and lengths.