vibesketch.render.nanostructures¶
Nanostructure depictions for figures, chemfig and the canvas (#138).
A generated nanostructure (#137) has thousands of atoms, which a figure does not draw one by one with labels. It is drawn the way papers draw it, from its atoms and parameters:
lattice: the side projection of the lattice, the front wall solid and the rear wall lighter or left out (rear); a sheet or ribbon seen from above, a fullerene from the front;schematic: a tube’s outline with the front wall’s hexagons as a light texture, for schemes; the ends of inner walls show at the left end;end-on: a tube’s cross-section, one ring per wall;unrolled: the graphene sheet a wall is rolled from, with the chiral vector Ch and the translation vector T (Saito, Dresselhaus and Dresselhaus 1998).
A long tube is drawn with its middle cut out and a break mark (brk); the
optional label gives (n,m), the diameter and the number of walls. Lines are
the style preset’s width (thinner for the lattice); grey is used for the rear
wall and texture only, never colour (IUPAC 2008, GR-0.5).
On the canvas a depiction is one KET image (Ketcher 3.18), whose SVG carries a
metadata element naming the species, its key, the style and the anchors:
points where a molecule attaches, such as a tube’s ends. Ketcher moves and
resizes the image and keeps its data, so figures find the species again and
draw it afresh, in the figure’s preset, in the image’s box. The SVG in the
canvas is never itself embedded in a figure: a KET file may come from anyone.
Module Attributes
How close, in bond lengths, an attachment atom must be to an anchor to join it. |
Functions
|
The anchors of a depiction image in KET coordinates, with their bond directions. |
|
A KET image node of the depiction, its top-left corner at |
|
How far a picture's caption reaches below its box, in the units of |
|
The depiction a KET image node stands for and its anchors, or |
|
A KET image's box: left, top, width, height in KET units (y up); refused if not finite. |
|
The depiction of a nanostructure species; raises |
|
SVG elements of |
|
TikZ commands of |
Classes
|
How one nanostructure species is drawn. |
|
A depiction in its own coordinates (angstrom, y up), with named anchors. |
Exceptions
A depiction that cannot be drawn as asked; the message says why. |
- vibesketch.render.nanostructures.ANCHOR_REACH = 0.6¶
How close, in bond lengths, an attachment atom must be to an anchor to join it.
- class vibesketch.render.nanostructures.Depiction(species, key, style='schematic', label=False, rear='light', brk='auto')[source]¶
Bases:
objectHow one nanostructure species is drawn.
- Parameters:
- rear: Literal['light', 'omit'] = 'light'¶
lighter, or left out.
- Type:
The rear wall in the lattice style
- exception vibesketch.render.nanostructures.DepictionRefused[source]¶
Bases:
ValueErrorA depiction that cannot be drawn as asked; the message says why.
- class vibesketch.render.nanostructures.Picture(items=<factory>, anchors=<factory>)[source]¶
Bases:
objectA depiction in its own coordinates (angstrom, y up), with named anchors.
An anchor is a point and the direction a bond leaves it,
(x, y, dx, dy).- Parameters:
- vibesketch.render.nanostructures.canvas_image(species, depiction, at, width=8.0)[source]¶
A KET image node of the depiction, its top-left corner at
at,widthbonds wide.The image’s SVG carries the depiction and its anchors in a
metadataelement; the anchors are given as fractions of the box, so they follow the image when it is moved or resized.
- vibesketch.render.nanostructures.depiction_of(node)[source]¶
The depiction a KET image node stands for and its anchors, or
Nonefor another image.Only the
metadataelement is read, as JSON within bounds; the rest of the SVG is ignored.
- vibesketch.render.nanostructures.picture(species, depiction)[source]¶
The depiction of a nanostructure species; raises
DepictionRefused.
- vibesketch.render.nanostructures.caption_room(pic, size)[source]¶
How far a picture’s caption reaches below its box, in the units of
size.