vibesketch.chem.depiction

Versioned 2D depiction restraints, with analytic gradients for FIRE.

Numeric drawing conventions: J. Brecher, Pure Appl. Chem. 80, 277–410 (2008), doi:10.1351/pac200880020277. The packaged table names each rule’s coverage and section. These are drawing units, never physical geometry. Force constants, clearance radii and convergence limits are our engineering choices, not measurements or numbers attributed to IUPAC.

Complex rings take a generated layout’s geometry rather than imposing mutually incompatible regular polygons: the seed’s, or a better one among the layouts the caller offers (DepictionField.build()). RDKit supplies those layouts through its public depictor API; no template data is copied into this package.

Classes

DepictionField(seed, bonds, lengths, ...)

One molecule's fixed restraints; metrics use the same targets before/after.

class vibesketch.chem.depiction.DepictionField(seed, bonds, lengths, triples, angles, pairs, clearance, ring_pairs, ring_distances)[source]

Bases: object

One molecule’s fixed restraints; metrics use the same targets before/after.

Parameters:
  • seed (NDArray[float64])

  • bonds (NDArray[int64])

  • lengths (NDArray[float64])

  • triples (NDArray[int64])

  • angles (NDArray[float64])

  • pairs (NDArray[int64])

  • clearance (NDArray[float64])

  • ring_pairs (NDArray[int64])

  • ring_distances (NDArray[float64])

seed: NDArray[float64]
bonds: NDArray[int64]
lengths: NDArray[float64]
triples: NDArray[int64]
angles: NDArray[float64]
pairs: NDArray[int64]
clearance: NDArray[float64]
ring_pairs: NDArray[int64]
ring_distances: NDArray[float64]
classmethod build(mol, seed, shapes=())[source]

The restraints of mol; orientation and unruled angles come from seed.

shapes are layouts of mol (atom order kept) that each fused, bridged, spiro or large ring system may take its geometry from (GR-3.3.2 to GR-3.3.4): bond lengths, ring distances and the angles at its atoms. Per system the first layout is kept unless a later one is clearly better (_shape()). Without shapes each system keeps the seed’s geometry. Callers comparing layouts pass every field the same shapes, so all of them share the same targets.

Parameters:
  • mol (Any)

  • seed (NDArray[float64])

  • shapes (Sequence[NDArray[float64]])

Return type:

DepictionField

objective(points)[source]
Parameters:

points (NDArray[float64])

Return type:

tuple[float, NDArray[float64]]

metrics(points)[source]

Bond spread, RMS angle error (radians), clashes and clash penalty.

Parameters:

points (NDArray[float64])

Return type:

tuple[float, float, int, float]

acceptable(candidate, baseline)[source]

No material regression against the legacy layout, including labels.

Parameters:
  • candidate (NDArray[float64])

  • baseline (NDArray[float64])

Return type:

bool

refine()[source]

A converged FIRE layout, or refusal; the caller keeps its fallback.

Return type:

NDArray[float64] | None