Invntr
Source

All instruments

formula_from_mass

Candidate elemental formulas (C, H, N, O, S, P, F, Cl, Br, I within limits) for a measured monoisotopic neutral mass, or an m/z with its adduct ([M+H]+, [M-H]-, [M+Na]+, [M+2H]2+, [2M+H]+ ...), within a ppm tolerance.

Exhaustive search inside the element limits; ring-and-double-bond equivalents RDBE = C - (H+X)/2 + (N+P)/2 + 1, the nitrogen rule and H/C limits as filters; ranked by absolute ppm error.

Monoisotopic masses are the single IUPAC/AME values of bench_science::iupac, the electron mass CODATA.

Field
Mass spectrometry
Version
0.1.0
Runs as
Compiled (Rust)
Typical run
0.05 s

Compiled from source: run sh packs/install.sh once before admitting it.

Known answers it must pass

Admission replayformula_from_mass 0.1.0 · files d11d9b265f88…6603
  1. r0001Glucose C₆H₁₂O₆ at 180.06339 Da, 5 ppm (spec): listed; mass = 72 + 12 × 1.00782503223 + 6 × 15.99491461957 = 180.06338810418 Da (IUPAC monoisotopic sum, rel 10⁻¹²); RDBE = 6 - 12/2 + 1 = 1; error = (180.06339 - 180.06338810418)/180.06338810418 × 10⁶ = 0.0105286256 ppm (exact decimal arithmetic, abs 10⁻⁶ ppm)passed

    target.listed= truemisseddiffers
    target.mass_Da= 180.063388, within 1.000000 × 10⁻¹² relativereading not recorded on this page
    target.rdbe= 1, within 1.000000 × 10⁻¹²reading not recorded on this page
    target.error_ppm= 0.010529, within 1.000000 × 10⁻⁶reading not recorded on this page
    best_formula= C₆H₁₂O₆C₆H₁₂O₆lockedexact match
  2. r0002Caffeine [M+H]+ at m/z 195.08765, 5 ppm (spec): best C₈H₁₀N₄O₂; m/z = 194.08037557916 + 1.00782503223 - 0.000548579909 (CODATA m_e) = 195.087652031481 (rel 10⁻¹²); RDBE = 8 - 10/2 + 4/2 + 1 = 6; error -0.0104131706 ppm (exact decimal, abs 10⁻⁶ ppm)passed

    best_formula= C₈H₁₀N₄O₂C₈H₁₀N₄O₂lockedexact match
    best_mz195.088 ± 2 × 10⁻¹⁰195.088locked0.015 % of the tolerance used
    best_rdbe6 ± 10⁻¹²6lockedunder 0.01 % of the tolerance used
    best_error_ppm-0.0104132 ± 10⁻⁶-0.0104132lockedunder 0.01 % of the tolerance used
  3. r0003Benzene C₆H₆ at 78.04695 Da, 5 ppm (spec): the only formula; RDBE = 6 - 6/2 + 1 = 4 (three C=C + one ring); mass 78.04695019338 Da (IUPAC sum, rel 10⁻¹²)passed

    best_formula= C₆H₆C₆H₆lockedexact match
    unique= truetruelockedexact match
    best_rdbe4 ± 10⁻¹²4lockedunder 0.01 % of the tolerance used
    best_mass_Da78.047 ± 7.8 × 10⁻¹¹78.047lockedunder 0.01 % of the tolerance used
  4. r0004Tight tolerance 0.1 ppm at 180.06339 Da returns one formula, C₆H₁₂O₆ (spec; the 5 ppm runner-up C₇H₁₆OS₂ sits 4.8 ppm away, checked by an independent brute-force enumeration)passed

    candidate_count= 11lockedexact match
    unique= truetruelockedexact match
    best_formula= C₆H₁₂O₆C₆H₁₂O₆lockedexact match
  5. r0005Halogen RDBE: chlorobenzene C₆H₅Cl at 112.00798 Da, cl_max 2: RDBE = 6 - (5+1)/2 + 1 = 4; mass 72 + 5 × 1.00782503223 + 34.968852682 = 112.00797784315 Da (IUPAC sum, rel 10⁻¹²)passed

    target.listed= truemisseddiffers
    target.rdbe= 4, within 1.000000 × 10⁻¹²reading not recorded on this page
    target.mass_Da= 112.007978, within 1.000000 × 10⁻¹² relativereading not recorded on this page
    best_formula= C₆H₅ClC₆H₅Cllockedexact match
  6. r0006Nitrogen rule: radical C₅H₆N (nominal 80, one N, RDBE 5 - 6/2 + 1/2 + 1 = 3.5) at 80.05002 Da is in the 5 ppm window but rejectedpassed

    target.nitrogen_rule_ok= falsemisseddiffers
    target.listed= falsemisseddiffers
    target.nominal_mass= 80misseddiffers
    target.rdbe= 3.5, within 1.000000 × 10⁻¹²reading not recorded on this page
  7. r0007Negative mode: glucose [M-H]- at m/z 179.0561, 3 ppm: m/z = 180.06338810418 - 1.00782503223 + 0.000548579909 = 179.056111651859 (rel 10⁻¹²; electron added, not removed)passed

    best_formula= C₆H₁₂O₆C₆H₁₂O₆lockedexact match
    best_mz179.056 ± 1.8 × 10⁻¹⁰179.056lockedunder 0.01 % of the tolerance used
    charge= -1-1lockedexact match
7 of 7 cases passed · sandbox macos-seatbeltrecorded from the kernel in a fresh lab

Each line is one reading the kernel checked. The bright band is the tolerance; the needle is the value the instrument actually returned when it was admitted. A needle near the centre line used little of its tolerance.

Inputs

NameUnitDefaultMeaning
neutral_massDaMeasured monoisotopic mass of the neutral molecule. Give this or mz, not both.
mzDaMeasured m/z of the ion (Da per elementary charge, i.e. thomson). Give this or neutral_mass, not both.
adduct[M+H]+Ion form when mz is given: [M+H]+, [M-H]-, [M+Na]+, [M+K]+, [M+NH₄]+, [M+2H]2+, [2M+H]+, [M+FA-H]-, [M-H₂O+H]+, [M]+ ... m/z = (n M + atoms added - atoms lost - z m_e) / |z|.
tolerance_ppm5Half-width of the window, parts per million of the theoretical value on the measured scale.
c_max1100
h_max1200
n_max110
o_max120
s_max14
p_max13
f_max10
cl_max10
br_max10
i_max10
min_atomsLower limits per element, e.g. {"Cl": 1} when the isotope pattern shows chlorine.
rdbe_min10
rdbe_max140
h_per_c_min10.2
h_per_c_max13.1
nitrogen_ruletrueKeep only closed-shell neutral formulas: nominal mass and N count both even or both odd (same as a whole-number RDBE for these ten elements).
target_formulaOptional expected formula (e.g. C₆H₁₂O₆): its mass, error, RDBE and why it is or is not listed.
max_candidates125Rows in the candidates reading; out/candidates.csv holds them all.

Readings

NameUnitMeaning
measuredDaThe measured value: neutral mass, or m/z in Da per charge.
neutral_mass_DaDa
tolerance_ppmparts per million (no kernel unit for ppm, left undeclared)
window_mDamDaHalf-width of the neutral-mass window.
in_window_count1
candidate_count1
listed_count1
uniquetrue when exactly one formula passes
best_formulaHill formula of the lowest-|error| candidate
best_mass_DaDa
best_mzDa
best_error_ppm(measured - theoretical)/theoretical x 10⁶, parts per million
best_error_mDamDa
best_rdbe1
best_h_per_c1
best_nominal_massDa
second_error_ppmparts per million
candidatesBest first: formula, mass_Da, mz, error_ppm, error_mDa, rdbe, h_per_c, nominal_mass, nitrogen_rule_ok, atoms
targetThe expected formula, if named
rejectedFormulas inside the window rejected by each rule (one formula may fail several)
warnings
search_nodes1Loop steps taken; out/candidates.csv holds every candidate, best first, with its atom counts.

Try the call

Change a value and the command updates. Nothing runs here; paste it into your terminal or give it to your agent.

Terminal
MCP call