Skip to content

Embedded chemistry metadata

Every SVG export carries machine-readable chemistry data next to the drawing: data-mk-* attributes on atoms and bonds, and a molecule-level metadata block. The visible graphics do not change. Scripts, search indexes, and the Molkit Viewer read this data. It records identifiers such as the SMILES and, when you are online, the IUPAC name from PubChem.

Every SVG export includes the data; no checkbox turns it on or off. Viewers that do not read the data ignore it.

One related option is 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 the other identity fields always include implicit hydrogens, so they agree with the SMILES and the PubChem records.

PNG and PDF exports do not carry the 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 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 on 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 labels. 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 generic label has no defined chemistry.

Each bond carries data-mk-order, data-mk-atom1, data-mk-atom2, and the endpoint coordinates data-mk-x1 through data-mk-y2. When they apply, bonds also carry data-mk-stereo, data-mk-polarity, data-mk-polar-toward, data-mk-conjugated, and data-mk-resonance-order.

When the canvas holds 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 label, the identity fields are left out, because the drawing does not stand for one specific compound. The file records the generic labels in a generic-labels list instead. When the structure has R groups with defined substituents, their definitions are embedded too, so that the Molkit Viewer can show each choice.

For each molecule with a 3D geometry, the file records a calculated net dipole, so that 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 dipoles point the opposite way from the electronegativity rule of thumb, the entry also records which end is negative. An SVG without this entry means that Molkit has no reference value for the molecule, not that the dipole is zero.

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

When you have an internet connection and Edit > Look Up Names Online (PubChem) is selected (the default), Molkit sends the molecule’s SMILES to PubChem to look up more identifiers. When it is cleared, an export never contacts PubChem. When the lookup succeeds, Molkit adds the IUPAC name, PubChem CID, InChI, InChIKey, and a list of synonyms, and puts the resolved name in the title and the JSON-LD record. See PubChem for how the lookup works.

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

The embedded data lets other tools index the structure by formula, SMILES, or InChIKey without re-parsing the drawing. The Schema.org JSON-LD record 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 select Include editable source at export. Without it, Molkit brings the SVG back as a picture. See What the SVG contains.

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

For the full attribute schema, reading patterns, and worked examples, see the developer guide metadata reference.