Molecule annotations
Molecule annotations attach CML metadata to a molecule using the
@key("value") suffix. Multiple annotations can be chained.
The structure reference
Section titled “The structure reference”A @smiles("...") annotation standing alone is an ingest edge:
the annotation carries a structure in, and the model is the molecule
the runtime’s own SMILES reader produces — renderable, citable, and
identity-deriving like any other structure (grammar v0.6.0).
@smiles("c1cc[nH]c1")asciichem gem to see this rendered.
Pyrrole, ingested locally: the SMILES is parsed at read time, the connection table lands on the model (aromatic atoms, bonds, the bracket hydrogen), and every formatter and the identity engine see an ordinary molecule.
- The attached form (
molecule @smiles("...")) is different and unchanged: there the annotation is the identifier annotation documented below — the string rides the model as identifier data, the drawn atoms stay the structure. - The reference syntax itself is an ingest boundary: the canonical
text of
@smiles("CCO")is the expandedC-C-O— the same posture as molfile and SMILES file ingest. - v1 carries
smilesonly. A standalone@molfile("...")rejects at parse time; later sources join as data.
H_2O @name("Water")asciichem gem to see this rendered.
Maps to CML <name>Water</name>.
Identifiers
Section titled “Identifiers”Known identifier types (inchi, smiles, cas, iupac, cid,
chebi) map to CML <identifier convention="...">:
C @inchi("InChI=1/C")
C @smiles("C")
C @cas("74-82-8")asciichem gem to see this rendered.
H_2O @title("water molecule")asciichem gem to see this rendered.
Sets the CML title attribute on <molecule>.
Formula
Section titled “Formula”H_2O @formula("H 2 O 1")asciichem gem to see this rendered.
Maps to CML <formula concise="H 2 O 1"/>.
Labels
Section titled “Labels”H_2O @label("solvent")asciichem gem to see this rendered.
Maps to CML <label value="solvent"/>.
Properties
Section titled “Properties”Any annotation key that isn’t a known type (name, title, formula,
label, or identifier convention) becomes a CML property. Property
titles are lowercase (logp, not logP):
H_2O @mw("18.015")
H_2O @density("0.997")
H_2O @logp("-0.5")asciichem gem to see this rendered.
Maps to CML <property title="mw"><scalar>18.015</scalar></property>.
@cite("source") is a property annotation (title cite) that names
the resolver source a substance should be cited from. It chains like
any annotation and round-trips like any annotation:
CC(=O)OC1=CC=CC=C1C(=O)O @cas("50-78-2") @cite("pubchem")asciichem gem to see this rendered.
The annotation itself carries no citation — the citation builder resolves the molecule’s identifiers against the named source and emits a dataset-type bibitem. See Citing substances.
Metadata
Section titled “Metadata”Key-value metadata pairs using @meta("key","value"):
H_2O @meta("creator","asciichem")
H_2O @meta("source","NIST")@meta("year","2024")asciichem gem to see this rendered.
Multiple annotations
Section titled “Multiple annotations”Chain annotations without spaces between them:
H_2O @name("Water")@inchi("InChI=1/H2O/h1H2")@cas("7732-18-5")asciichem gem to see this rendered.
Round-trip
Section titled “Round-trip”All annotations survive AsciiChem → CML → AsciiChem round-trip
without loss. Names, identifiers, title, formulas, labels, and
properties use native CML elements. Metadata and AsciiChem-specific
fields ride via the aci: extension namespace.