Skip to main content

Module elements

Module elements 

Source
Expand description

Per-element isotopologue distribution cache.

For each of the five pattern-bearing elements (C, H, N, O, S), pre-compute the exact isotopologue distribution for atom counts 0..=MAX. Phosphorus is absent on purpose: ³¹P is the only stable phosphorus isotope, so it cannot shift a pattern — see super::model. At lookup time, we convolve the five cached distributions for a given (n_C, n_H, n_N, n_O, n_S) to get the molecule’s isotope pattern.

This replaces the older per-mass averagine template table:

  • flexible: hold C/H/N/O fixed, vary S → sulfur-aware scoring is one knob
  • accurate: no 50 Da mass bins
  • cheap: ~82 kB cache, ~4 convolutions per lookup (~1 µs)

The five element distributions are exact (NOT Poisson approximations) — built by incrementally convolving the single-atom distribution.

Structs§

ElementCache
Cache of per-element distributions for atom counts 0..=max_n.

Constants§

K_PATTERN
First slot in the isotope-pattern vector that we care about. All distributions are kept at length K_PATTERN (= 10 isotope peaks).

Functions§

cache
Global singleton — built once on first access.