Skip to content

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:

  1. the molecule contains the elements required by the group (for example C-H requires C and H, O-H requires O and H, M-O requires a metal and O), and
  2. 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 ​

bash
$ 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 ​

  • frequencies and intensities must be non-empty, finite and the same length.
  • elements must be non-empty.
  • --mode-displacements is 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_checked with exit code 1 in the CLI, ValueError in Python and {error} in WASM.
  • WASM mode-displacement JSON parse errors identify the offending mode displacements payload (the previous wrapper quoted elements by 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 ​

SurfaceEntry point
CLIsci-form assign-peaks "<frequencies>" "<intensities>" "<elements>" [--mode-displacements JSON]
Rustir::peak_assignment::assign_peaks, assign_peaks_checked
Pythonassign_peaks(frequencies, intensities, elements, mode_displacements=None)
WASMassign_peaks(frequencies_json, intensities_json, elements_json, mode_displacements_json)

Released under the MIT License.