IR peak assignment
assign-peaks maps vibrational wavenumbers to functional groups using the built-in group-frequency table and, optionally, the normal-mode displacements. It is the standalone version of the assignment used by ir-spectrum-broadened.
flowchart LR
A[Frequencies] --> B[Frequency range table]
C[Elements] --> D{Group possible?}
B --> D
E[Mode displacements] --> F{Dominant atoms match?}
D --> F
F --> G[Group matches + confidence]
Matching
For each frequency, every group whose range contains the wavenumber is a candidate. A candidate is kept only if:
- the molecule contains the elements required by the group (for example
C-Hrequires C and H,O-Hrequires O and H,M-Orequires a metal and O), and - when mode displacements are supplied, the atoms that dominate the mode are compatible with the group.
match_quality is a triangular score that is 1 at the centre of the range and falls to 0 at its edges; confidence is the best match quality for that peak. functional_groups lists every group that matched at least once.
Frequencies below 150 cm⁻¹ are skipped as lattice-like modes. A molecule with no possible group (for example water and a C-H range) produces an empty assignment rather than a false label.
Example
$ sci-form assign-peaks "[1000.0,3000.0]" "[10.0,20.0]" "[6,6,8,1,1,1,1,1,1]"
{
"assignments": [
{
"frequency": 1000.0,
"intensity": 10.0,
"assignments": [
{"group": "C-O (alcohol)", "vibration_type": "stretch", "match_quality": 0.019607843137254943}
],
"confidence": 0.019607843137254943
},
{
"frequency": 3000.0,
"intensity": 20.0,
"assignments": [
{"group": "O-H (carboxylic)", "vibration_type": "stretch", "match_quality": 0.7506234413965087}
],
"confidence": 0.7506234413965087
}
],
"functional_groups": ["C-O (alcohol)", "O-H (carboxylic)"]
}Input rules
frequenciesandintensitiesmust be non-empty, finite and the same length.elementsmust be non-empty.--mode-displacementsis optional. When supplied it must contain one mode per frequency, each mode must contain one[x, y, z]triple per element, and all values must be finite.- Empty or mismatched arrays are rejected by
assign_peaks_checkedwith exit code 1 in the CLI,ValueErrorin Python and{error}in WASM. - WASM mode-displacement JSON parse errors identify the offending
mode displacementspayload (the previous wrapper quotedelementsby mistake).
Measured example
Water peaks [1640, 3000, 3600] cm⁻¹ with elements [8,1,1] and intensities [12,20,25] produce ["H-O-H bend", "O-H (free)"]; the 1640 cm⁻¹ confidence is 0.6753246753246753, the 3000 cm⁻¹ peak has no table match, and the 3600 cm⁻¹ confidence is 0.12790697674418605.
Limits
- The table is a set of literature group-frequency windows, not a trained classifier. Coupled modes, overtones and strongly hydrogen-bonded systems can fall outside the simple ranges.
- Assignments are qualitative; a missing assignment means "no table match", not "no vibration".
- Mode displacements refine the match but do not replace a potential-energy distribution analysis.
Surfaces
| Surface | Entry point |
|---|---|
| CLI | sci-form assign-peaks "<frequencies>" "<intensities>" "<elements>" [--mode-displacements JSON] |
| Rust | ir::peak_assignment::assign_peaks, assign_peaks_checked |
| Python | assign_peaks(frequencies, intensities, elements, mode_displacements=None) |
| WASM | assign_peaks(frequencies_json, intensities_json, elements_json, mode_displacements_json) |