vibesketch.document.coordinates

Species from 3D structures other programs wrote: QVF sections, XYZ frames.

A vibe-qc result, a structure vibe-view saved or exported, or an XYZ file carries atoms and Cartesian coordinates, sometimes with a charge, a multiplicity, a SMILES, a compound number and a name, and sometimes the steps of a reaction scheme. This module turns them into a document:

  • each structure’s bonds are perceived (vibesketch.chem.perceive), with the stated charge, or the one its SMILES implies, else neutral;

  • the molecules are laid out in 2D, the scheme’s steps as reaction rows and the rest in a row below, and the document is derived from that drawing;

  • each species keeps its coordinates as a conformer named after where they came from (imported by default), with the stated multiplicity, compound number and name. Frames of one molecule, a trajectory or an optimisation, are kept as its conformers, the last first and the others named <method>:frame-<n> (#86).

What cannot be done is said in the warnings: a structure without bonds that fit, a SMILES the coordinates contradict, a spin the electrons cannot have.

Functions

from_structures(structures, *[, steps, ...])

A document drawn from structures, the steps as reaction rows.

Classes

Step(id, reactants, products[, reagents, ...])

One reaction step between structures, by chemical role (QVF § 5.14).

Structure(id, symbols, positions[, charge, ...])

One structure as another program wrote it.

Exceptions

NothingDrawn

No structure could be drawn.

exception vibesketch.document.coordinates.NothingDrawn[source]

Bases: ValueError

No structure could be drawn.

class vibesketch.document.coordinates.Step(id, reactants, products, reagents=<factory>, arrow='forward', conditions=<factory>, yield_text=None)[source]

Bases: object

One reaction step between structures, by chemical role (QVF § 5.14).

Parameters:
id: str
reactants: list[str]
products: list[str]
reagents: list[str]
arrow: str = 'forward'
conditions: list[str]
yield_text: str | None = None
class vibesketch.document.coordinates.Structure(id, symbols, positions, charge=None, multiplicity=None, label=None, name=None, smiles=None, method='imported')[source]

Bases: object

One structure as another program wrote it.

Parameters:
id: str

a QVF section id, an XYZ frame.

Type:

How the warnings name it

symbols: list[str]
positions: list[list[float]]
charge: int | None = None
multiplicity: int | None = None
label: str | None = None
name: str | None = None
smiles: str | None = None
method: str = 'imported'

where the coordinates came from.

Type:

The conformer’s method

vibesketch.document.coordinates.from_structures(structures, *, steps=None, warnings=None, source='imported', bond_orders=False)[source]

A document drawn from structures, the steps as reaction rows.

warnings are the caller’s so far, kept first. source is what a stated name records as its origin. With bond_orders, for files that state the charge, a structure whose bond orders do not fit is left out instead of drawn with single bonds. Raises NothingDrawn when no structure can be drawn.

Parameters:
Return type:

Derivation