vibesketch.document.renders

Same-orientation renders of a recipe campaign’s stages, from its archived artifacts (#42).

For one species of a compiled campaign this gathers the starting geometry (the sketch’s prepared conformer, from the campaign’s pinned sources) and the geometry every stage’s validator accepted (from vibe-queue’s verified artifacts), with each optimisation’s trajectory where its result carries one. Nothing is taken on trust: every artifact is checked against the manifest digest vibe-queue’s journal records for the producing attempt, and every file against its manifest entry, before it is read. A stage that was not accepted is listed and never rendered.

One frame for all. The start geometry is put in its principal-axes frame (centroid at the origin, axes by decreasing spread, signs fixed by the coordinates’ skew, a proper rotation), and every accepted geometry and every trajectory frame is superposed on it by the rotation that minimises the RMSD (W. Kabsch, Acta Cryst. A32, 922-923 (1976); A34, 827-828 (1978)), never a reflection, so chirality is kept. A rigid drift of the optimiser therefore does not turn the molecule between figures, and the RMSD to the start says how far each stage moved it.

Each geometry is written as a QVF archive of its own (<species>-<stage>.qvf, the aligned structure and, for an optimisation, the aligned trajectory), beside renders.json, which records for every figure the artifact it came from: node, attempt, manifest digest and result digest. The images are vibe-view’s: vibe-view capture draws each archive with one fixed isometric camera and vibe-view animate --kind trajectory each trajectory, so vibe-sketch prepares the geometry and imports no rendering stack (the shared scope decision). Without vibe-view the archives and the record are still written, and the warning gives the command to run.

Functions

aligned_frame(points)

points in their principal-axes frame, and the centroid they were moved from.

render_stages(document, recipe_id, ...[, ...])

Renders of one species' start and accepted stages, in one orientation.

superpose(reference, mobile)

mobile turned and moved onto reference, and the RMSD left, in Å.

Classes

StageRenders(directory, record[, files, ...])

What was written: the record, the files, and what needs attention.

Exceptions

RendersRefused(reasons)

The renders cannot be made as asked; the reasons say why.

exception vibesketch.document.renders.RendersRefused(reasons)[source]

Bases: ValueError

The renders cannot be made as asked; the reasons say why.

Parameters:

reasons (list[str])

Return type:

None

class vibesketch.document.renders.StageRenders(directory, record, files=<factory>, warnings=<factory>)[source]

Bases: object

What was written: the record, the files, and what needs attention.

Parameters:
directory: Path
record: dict[str, Any]
files: list[str]
warnings: list[str]
vibesketch.document.renders.aligned_frame(points)[source]

points in their principal-axes frame, and the centroid they were moved from.

The axes run by decreasing spread; each axis points where the coordinates are skewed (the larger tail), ties broken by the first atom that is off the plane; the third axis completes a right-handed frame.

Parameters:

points (NDArray[float64])

Return type:

tuple[NDArray[float64], NDArray[float64]]

vibesketch.document.renders.render_stages(document, recipe_id, campaign_id, species_id, directory, *, size=(900, 600), publication=False, images=True)[source]

Renders of one species’ start and accepted stages, in one orientation.

Writes into directory (new or empty) the aligned archives, the record and, when images and vibe-view is installed, a PNG per geometry (size in pixels, vibe-view’s publication preset with publication) and a GIF per trajectory. Raises RendersRefused when the campaign, species or directory does not fit, or an artifact is not the one vibe-queue verified. A campaign’s files that are missing, unreadable or point outside it are refused too, and a failure leaves the directory as it was given (#69).

Parameters:
Return type:

StageRenders

vibesketch.document.renders.superpose(reference, mobile)[source]

mobile turned and moved onto reference, and the RMSD left, in Å.

The proper rotation that minimises the RMSD (Kabsch 1976, with the determinant correction of Kabsch 1978): a reflection is never used.

Parameters:
  • reference (NDArray[float64])

  • mobile (NDArray[float64])

Return type:

tuple[NDArray[float64], float]