Spectroscopy
AsciiChem captures spectroscopic data — NMR, IR, MS, UV-Vis — in
a structured syntax that round-trips to native CML <spectrum> wire.
Syntax
Section titled “Syntax”spectrum[type](params){ position: intensity [multiplicity] ["assignment"]}type— spectrum kind:nmr,ir,ms,uvparams— key=value pairs (e.g.type=1H,solvent=CDCl3)- Each peak line: position, intensity, optional multiplicity and quoted assignment
Examples
Section titled “Examples”1H NMR
Section titled “1H NMR”
Source
Rendered
spectrum[nmr](type=1H,solvent=CDCl3){
Install the
asciichem gem to see this rendered.
1.2: 3H s "CH3"
Install the
asciichem gem to see this rendered.
7.2: 5H m "ArH"
Install the
asciichem gem to see this rendered.
}
Install the
asciichem gem to see this rendered.
Source
Rendered
spectrum[ir]{
Install the
asciichem gem to see this rendered.
3300: 100 "O-H stretch"
Install the
asciichem gem to see this rendered.
1700: 80 "C=O stretch"
Install the
asciichem gem to see this rendered.
}
Install the
asciichem gem to see this rendered.
Mass spectrometry
Section titled “Mass spectrometry”
Source
Rendered
spectrum[ms]{
Install the
asciichem gem to see this rendered.
18: 100% "M+"
Install the
asciichem gem to see this rendered.
17: 20% "M-1"
Install the
asciichem gem to see this rendered.
}
Install the
asciichem gem to see this rendered.
Peak fields
Section titled “Peak fields”| Field | Required | Example |
|---|---|---|
position | yes | 1.2 (ppm for NMR, cm⁻¹ for IR, m/z for MS) |
intensity | yes | 3H, 100%, 0.8 |
multiplicity | no | s, d, t, q, m (NMR only) |
assignment | no | "CH3" (in double quotes) |
CML wire (v0.10+)
Section titled “CML wire (v0.10+)”Emits as native <spectrum> with <peakList> of <peak> elements:
<molecule> <spectrum title="nmr" format="1H" condition="CDCl3"> <peakList> <peak title="CH3" xValue="1.2" yValue="3H" yMultiplicity="s"/> </peakList> </spectrum></molecule>