vibesketch.chem.perceive

Molecules from 3D coordinates: bonds, bond orders, charges and radicals.

Programs of the vibe family hand structures over as atoms and Cartesian coordinates: a QVF structure section, an XYZ file. The sketcher needs a molecule to draw, so the bonds are perceived, in this order:

  1. A single atom keeps the stated charge, and its unpaired electrons from its valence: N is a quartet, Cl a doublet, Cl⁻ a singlet.

  2. A template. When the file names the species by SMILES, the bonds come from the coordinates and the bond orders and charges from the SMILES (RDKit’s AssignBondOrdersFromTemplate). The atoms stay in the file’s order, so the coordinates are kept.

  3. Perception with the stated charge: RDKit’s DetermineBonds, the xyz2mol algorithm of Kim and Kim, Bull. Korean Chem. Soc. 36, 1769 (2015), with Hückel connectivity off.

  4. Connectivity alone, for a neutral structure the bond orders of which cannot be assigned, such as a radical or a metal hydride: single bonds, the unpaired electrons where valences are left open, and two neighbours’ unpaired electrons paired into a further bond (N=O). The caller says so, because the drawing may need checking.

Functions

perceive(symbols, positions, *[, charge, ...])

The molecule the coordinates show, or None when no step gives one.

Classes

Perceived(mol, how)

A sanitized RDKit molecule, hydrogens explicit, in the coordinates' atom order.

class vibesketch.chem.perceive.Perceived(mol, how)

Bases: object

A sanitized RDKit molecule, hydrogens explicit, in the coordinates’ atom order.

Parameters:
  • mol (Any)

  • how (Literal['atom', 'template', 'perceived', 'connectivity'])

mol: Any
how: Literal['atom', 'template', 'perceived', 'connectivity']

Which of the module’s steps gave the bonds.

vibesketch.chem.perceive.perceive(symbols, positions, *, charge=0, template=None)

The molecule the coordinates show, or None when no step gives one.

template is an RDKit molecule for the species, from the SMILES a file states; it is used only when it fits the atoms.

Parameters:
Return type:

Perceived | None