Skip to content

Embedded Chemistry Metadata

Every SVG export carries machine-readable chemistry data alongside the drawing. The visible graphics are unchanged, but the file also holds data-mk-* attributes on atoms and bonds plus a molecule-level metadata block. Scripts, search indexes, and the Molkit structure widget read this data, and it records identifiers such as SMILES and, when you are online, the IUPAC name from PubChem.

Always on

There is no checkbox to turn the data on or off: every SVG export includes it. The data is small next to the drawing and does no harm to viewers that ignore it.

One related option remains in the SVG export dialog: Omit per-atom implicit H counts (metadata) records each atom’s data-mk-implicit-h attribute as 0. Molecule-level fields are not affected: the formula, molecular weight, atom count, and other identity fields always include implicit hydrogens so they agree with the SMILES and PubChem records.

The data is written only to SVG. PNG and PDF exports do not carry it.

Per-atom and per-bond data

Each atom group carries data-mk-element, data-mk-x, data-mk-y, data-mk-index, data-mk-formal-charge, data-mk-lone-pairs, data-mk-domains-bonding, data-mk-domains-nonbonding, data-mk-implicit-h, data-mk-octet, and data-mk-valence-electrons, plus data-mk-warnings for validation warnings. When the relevant data exists, atoms also carry data-mk-abbreviation, data-mk-hybridization, data-mk-geometry, data-mk-vsepr-angles, data-mk-chiral, data-mk-isotope, data-mk-aromatic, data-mk-ring-sizes, data-mk-oxidation-state, and data-mk-radical.

data-mk-octet is left out where an octet does not apply, such as generic labels, bridging hydrogens, and metal ions.

Delocalized lone pairs. When an atom’s lone pair is delocalized into a neighboring pi bond, as on an amide or pyrrole nitrogen, the atom carries data-mk-lp-delocalized="true" next to its hybridization. This tells a reader that the reported sp2 comes from delocalization, not from counting electron domains.

Generic placeholders. An atom drawn as a generic label such as R, X, or A carries only data-mk-generic="true", data-mk-element="*", and its displayed label in data-mk-abbreviation. No hybridization, charge, lone-pair, or octet data is written for it, because a placeholder has no defined chemistry.

Each bond carries data-mk-order, data-mk-atom1, data-mk-atom2, endpoint coordinates data-mk-x1 through data-mk-y2, and, when applicable, data-mk-stereo, data-mk-polarity, data-mk-polar-toward, data-mk-conjugated, and data-mk-resonance-order.

Molecule-level data

For a canvas holding one molecule, or one ionic compound, the file also gets molecule-level fields in a metadata block and as root attributes: formula, molecular weight, exact mass, SMILES (and canonical SMILES when available), atom count, bond count, total valence electrons, degree of unsaturation, element composition, point group, functional groups, and a V2000 MOL block. A Schema.org MolecularEntity JSON-LD record is included as well. A canvas with several unrelated molecules gets the per-atom and per-bond data but not these fields.

If any atom is a generic placeholder, the identity fields are left out, since the drawing does not stand for one specific compound. The file instead records the placeholder labels in a generic-labels list. When the structure has R-groups with defined substituents, their definitions are embedded too, so the structure widget can show each choice.

Dipoles

For each molecule with a 3D geometry, the file records a calculated net dipole, so a viewer can draw the arrow on the 2D structure.

When the molecule matches an entry in Molkit’s table of measured dipole moments, the file also records the measured gas-phase value in debye with its source. For carbon monoxide and nitric oxide, whose measured dipole points the opposite way from the electronegativity rule of thumb, the entry also records which end is negative. An SVG without this entry means Molkit has no reference value for the molecule, not that the dipole is zero.

Electrostatic potential maps

A molecule with a current electrostatic potential map gets an mk:esp block next to its 3D geometry. It records the method, the source of the geometry, the surface, a citation, a caption, the per-atom charges and the figure’s display settings, and holds the map data itself or points to a separate .esp file, depending on the Electrostatic maps export option. A map left out of date by an edit is never exported. See Electrostatic Potential Maps.

Online enrichment

When you have an internet connection, Molkit sends the molecule’s SMILES to PubChem to look up extra identifiers. When the lookup succeeds, it adds the IUPAC name, PubChem CID, InChI, InChIKey, and a list of synonyms, and it updates the title and the JSON-LD record with the resolved name. See PubChem for how the lookup works.

This step is best-effort. If you are offline, PubChem does not answer within eight seconds, or there is no match, the export still completes with the locally computed fields above. Once a lookup succeeds for a named selection, Molkit stores the CID on it, so later exports of the same selection skip the network request.

What it is good for

The embedded data lets other tools index the structure by formula, SMILES, or InChIKey without re-parsing the drawing. The Schema.org JSON-LD and the title text help search engines and accessibility tools describe the file. The MOL block and SMILES keep a structural record next to the picture.

Molkit does not rebuild a structure from these attributes. To reopen an exported SVG as editable objects, Molkit uses the separate editable copy of the drawing, which an SVG carries only when you tick Include editable source at export. Without it, Molkit brings the SVG back as a picture. See SVG Export.

Cost

The MOL block, JSON-LD, 3D data, and any map stored inside the SVG add to the file size, and the PubChem lookup can add a short wait before the download starts.

For developers: the full attribute schema, reading patterns, and worked examples are in the Developer Guide metadata reference.

See also