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 C6H12O6 at 180.06339 Da, 5 ppm (spec): listed; mass = 72 + 12 x 1.00782503223 + 6 x 15.99491461957 = 180.06338810418 Da (IUPAC monoisotopic sum, rel 1e-12); RDBE = 6 - 12/2 + 1 = 1; error = (180.06339 - 180.06338810418)/180.06338810418 x 1e6 = 0.0105286256 ppm (exact decimal arithmetic, abs 1e-6 ppm)passed

    target.listed= truemisseddiffers
    target.mass_Da{"value": 180.06338810418, "rel_tol": 1e-12}
    target.rdbe{"value": 1.0, "abs_tol": 1e-12}
    target.error_ppm{"value": 0.0105286256132, "abs_tol": 1e-06}
    best_formula= C6H12O6C6H12O6lockedexact match
  2. r0002Caffeine [M+H]+ at m/z 195.08765, 5 ppm (spec): best C8H10N4O2; m/z = 194.08037557916 + 1.00782503223 - 0.000548579909 (CODATA m_e) = 195.087652031481 (rel 1e-12); RDBE = 8 - 10/2 + 4/2 + 1 = 6; error -0.0104131706 ppm (exact decimal, abs 1e-6 ppm)passed

    best_formula= C8H10N4O2C8H10N4O2lockedexact match
    best_mz195.088 ± 2e-10195.088locked0.015 % of the tolerance used
    best_rdbe6 ± 1e-126lockedunder 0.01 % of the tolerance used
    best_error_ppm-0.0104132 ± 1e-06-0.0104132lockedunder 0.01 % of the tolerance used
  3. r0003Benzene C6H6 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 1e-12)passed

    best_formula= C6H6C6H6lockedexact match
    unique= truetruelockedexact match
    best_rdbe4 ± 1e-124lockedunder 0.01 % of the tolerance used
    best_mass_Da78.047 ± 7.8e-1178.047lockedunder 0.01 % of the tolerance used
  4. r0004Tight tolerance 0.1 ppm at 180.06339 Da returns one formula, C6H12O6 (spec; the 5 ppm runner-up C7H16OS2 sits 4.8 ppm away, checked by an independent brute-force enumeration)passed

    candidate_count= 11lockedexact match
    unique= truetruelockedexact match
    best_formula= C6H12O6C6H12O6lockedexact match
  5. r0005Halogen RDBE: chlorobenzene C6H5Cl at 112.00798 Da, cl_max 2: RDBE = 6 - (5+1)/2 + 1 = 4; mass 72 + 5 x 1.00782503223 + 34.968852682 = 112.00797784315 Da (IUPAC sum, rel 1e-12)passed

    target.listed= truemisseddiffers
    target.rdbe{"value": 4.0, "abs_tol": 1e-12}
    target.mass_Da{"value": 112.00797784315, "rel_tol": 1e-12}
    best_formula= C6H5ClC6H5Cllockedexact match
  6. r0006Nitrogen rule: radical C5H6N (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{"value": 3.5, "abs_tol": 1e-12}
  7. r0007Negative mode: glucose [M-H]- at m/z 179.0561, 3 ppm: m/z = 180.06338810418 - 1.00782503223 + 0.000548579909 = 179.056111651859 (rel 1e-12; electron added, not removed)passed

    best_formula= C6H12O6C6H12O6lockedexact match
    best_mz179.056 ± 1.8e-10179.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+NH4]+, [M+2H]2+, [2M+H]+, [M+FA-H]-, [M-H2O+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. C6H12O6): 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 1e6, 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