Tooluniverse organic chemistry

From mims-harvard/ToolUniverse · View interactive version

Tooluniverse organic chemistry is an AI agent skill from the GitHub repository mims-harvard/ToolUniverse. Organic chemistry reasoning guide for reaction product prediction, mechanism analysis (electrophilic/nucleophilic substitution, addition, elimination, pericyclic, radical), and spectroscopy interpretation (1H/13C NMR, IR, MS). Reasons from first principles (electron flow, kinetic vs thermodynamic) r

How to use this skill

Skill file

Organic Chemistry Reasoning Guide

This skill teaches how to think through organic chemistry problems, not what to memorize.


1. Predicting Reaction Products — A Reasoning Process

Do NOT pattern-match to a named reaction. Instead, reason from first principles:

Step 1 — Find the most reactive sites

Look at each molecule and ask: where is the electron density?

The reaction will happen where the strongest nucleophile meets the strongest electrophile.

Step 2 — What kind of bond-making/breaking is this?

Three fundamental categories:

Step 3 — Where do the electrons flow?

Draw the arrow from nucleophile to electrophile. Ask:

Step 4 — What is the driving force?

Every reaction needs a thermodynamic reason to proceed:

Step 5 — Sanity-check your product

Before reporting an answer:

Named Reaction Decision Tree

Identify the reaction type from reagents/conditions, then apply its product topology:

| Reagent/Condition Pattern | Reaction Type | Product Logic |

|---|---|---|

| RMgBr (or RLi) + ArX + Pd or Ni catalyst | Kumada coupling | R replaces X on Ar; excess RMgBr replaces ALL X |

| Ph3P=CHR + aldehyde/ketone | Wittig | C=C replaces C=O; unstabilized ylide → Z-alkene; stabilized (ester/CN) → E-alkene |

| Sulfoxide + strong electrophile (Tf2O, Ac2O) | Pummerer rearrangement | S-oxidation state drops; alpha-carbon gets new bond to nucleophile/leaving group |

| Allyl vinyl ether heated (or 1,5-dien-3-ol + base) | [3,3]-sigmatropic (oxy-Cope/Claisen) | Redraw 6-membered chair TS; new sigma bond at 1,6 positions; old 3,4 bond breaks |

| Diene + dienophile, heat | Diels-Alder | [4+2] cycloaddition; endo rule for stereochemistry; cis dienophile substituents stay cis |

| ArX + excess organometallic (no catalyst) | Nucleophilic aromatic substitution or benzyne | Each X replaced by nucleophile; count equivalents to determine degree of substitution |

Retrosynthetic Analysis

Work backward from product to starting materials by identifying how key bonds were formed:

  1. Robinson Annulation (product is a 2-cyclohexenone fused or substituted system):
  1. Intramolecular Aldol (fused ring from KOH/base on an open-chain substrate):
  1. General disconnection heuristic — identify the new bond, then choose the right reaction:

ML-Based Reaction/Retrosynthesis Prediction (Cross-Check, Not a Replacement)

RXNChemistry_predict_reaction (forward prediction: reactants → most likely

product, IBM RXN for Chemistry ML model) and RXNChemistry_predict_retrosynthesis

(target → candidate synthetic routes) can cross-check a from-first-principles

answer, especially for reactions outside the named-reaction decision tree above.

Reason through the mechanism first per the steps in this skill — these are a

sanity check on a proposed product/route, not a substitute for understanding

why it forms.

Requires RXN4CHEMISTRY_API_KEY — verified live: with no key set, neither

tool appears in tu list/loads at all (the same intentional key-gating pattern

as Addgene/USPTO elsewhere in ToolUniverse); set the key to enable, don't treat

their absence as a bug. Both operations are asynchronous (poll via

poll_interval/max_wait_time params) since the underlying model runs as a

queued job, not a synchronous API call.

Product Prediction Strategy (Stepwise)

  1. Reactive sites: Mark every nucleophilic and electrophilic center in all reactants
  2. Reaction type: Match reagent/condition pattern to the decision tree above
  3. Bond changes: Explicitly list which bonds break and which form (write them out)
  4. Regiochemistry: Markovnikov (cation stability) vs anti-Markovnikov (radical/BH3); for ArX, each leaving group is an independent reactive site
  5. Stereochemistry: Wittig E/Z from ylide type; SN2 inversion; [3,3] suprafacial-suprafacial (chair TS); Pummerer retains sulfur connectivity
  6. Name the product: Convert the final structure to IUPAC; for biaryl systems count the phenyl groups systematically (e.g., three linked phenyls = terphenyl, not triphenylbenzene)

Structure Determination from Reactions

Combustion Analysis Strategy


2. Spectroscopy Interpretation — A Problem-Solving Strategy

Do NOT look up tables of chemical shifts. Instead, follow this systematic approach:

Start with molecular formula

If given, calculate degrees of unsaturation first. This immediately tells you:

This single number eliminates huge categories of structures before you look at any spectrum.

IR: Look for the obvious peaks first

Do not try to assign every peak. Instead, ask three questions:

  1. Is there a broad absorption around 2500-3500? If yes: O-H (very broad) or N-H (sharper, sometimes two peaks for primary amine).
  2. Is there a strong sharp peak around 1650-1750? If yes: C=O. Its exact position tells you the type (ester ~1735, ketone ~1715, acid ~1710, amide ~1680).
  3. Is there a peak around 2100-2300? If yes: triple bond (C-triple-C or C-triple-N) or cumulated double bond.

If you can answer these three questions, you have identified the major functional groups. Everything else is confirmatory.

1H NMR: Three pieces of information per signal

Every signal tells you three things — use all of them:

  1. Chemical shift (where): How deshielded is this proton? Near electronegative atoms = downfield (higher ppm). Aromatic protons are 6.5-8.5 ppm; alkyl are 0.8-1.7 ppm; adjacent to C=O are 2.0-2.7 ppm.
  2. Multiplicity (splitting pattern): How many neighboring protons does this one have? n neighbors = n+1 peaks. A triplet means 2 adjacent H; a quartet means 3 adjacent H. This tells you about connectivity.
  3. Integration (area): How many protons does this signal represent? Ratios matter more than absolute values. A 3:2:1 integration ratio on a C3 compound strongly suggests CH3, CH2, CH.

13C NMR: Count the symmetry

The combination strategy

No single spectrum gives the answer. Combine them:

  1. Molecular formula gives DoU (structural constraints)
  2. IR identifies functional group classes (C=O? O-H? N-H?)
  3. 13C tells you how many unique carbon environments exist
  4. 1H tells you connectivity (through splitting) and hydrogen count (through integration)
  5. Propose a structure that is consistent with ALL data
  6. Verify: does your proposed structure predict every observed signal?

3. Stereochemistry — How to Think in 3D

Finding stereocenters

A stereocenter is a carbon with four DIFFERENT substituents. To find them:

Assigning R/S

  1. Rank the four substituents by CIP priority (higher atomic number = higher priority)
  2. For ties: move to the next atom along the chain and compare again
  3. Orient the molecule so the lowest-priority group (#4) points AWAY from you
  4. Read priorities 1-2-3: clockwise = R, counterclockwise = S
  5. Shortcut: if #4 is already pointing away in a drawing, just read the arrangement directly. If #4 points toward you, read the arrangement and FLIP the answer.

Predicting stereochemical outcomes of reactions

Ask: what is the mechanism?

Relationship between stereoisomers


4. Bundled Scripts

These ready-to-run scripts live in skills/tooluniverse-organic-chemistry/scripts/.

Use them via the Bash tool instead of computing by hand — they validate inputs and print verification lines.

`chemistry_facts.py` — Chemical and physical facts reference

A lookup tool for facts that are easy to mis-remember. Query this script instead of guessing.

Three categories: allotropes, point_group, common_reagents. Run with no extra args to list all entries in a category.

python chemistry_facts.py --type allotropes --element P
python chemistry_facts.py --type point_group --molecule "benzene"
python chemistry_facts.py --type common_reagents --reagent "LiAlH4"
python chemistry_facts.py --type allotropes          # list all elements

Coverage: Allotropes for P, C, S, O. Point groups for 15 molecules (water C2v through H2 D∞h). 24 reagents (LiAlH4 through DMDO) with full name, function, selectivity, stereochemistry, and KEY DISTINCTION notes.

When to use: Any question about allotropes, molecular symmetry/point groups, or reagent selectivity. Always query before reporting reagent facts.

`crystal_validator.py` — Crystal structure density validator

Preferred: use CrystalStructure_validate tool (via MCP/SDK) with unit cell parameters (a, b, c, alpha, beta, gamma, Z, MW, density). Fallback: run crystal_validator.py directly.

Validates crystal structure data by computing theoretical density from unit cell parameters and

comparing against a reported value. Flags inconsistencies that indicate errors in published datasets.

Supports all seven crystal systems (cubic, tetragonal, orthorhombic, hexagonal, trigonal, monoclinic, triclinic).

python crystal_validator.py --a 5.43 --b 5.43 --c 5.43 --Z 8 --MW 28.085 --density 2.329
python crystal_validator.py --datasets datasets.json   # batch mode: JSON array of datasets

Angles default to 90deg. Output: crystal system, volume, calculated density, %error, verdict (OK/WARNING/MISMATCH).

Batch mode compares multiple datasets to find the outlier. Density formula: d = (Z * MW) / (V * Na).

When to use: Crystal structure verification, density consistency checks, finding erroneous datasets.

`stereochem_tracker.py` — Stereochemistry through reaction sequences

Tracks R/S configuration at a stereocenter through a series of reactions, predicting the

stereochemical outcome at each step.

python stereochem_tracker.py --start R --reactions "SN2, oxidation, SN1"

Supported reactions: SN2 (inversion), SN1 (racemization), E2/E1 (elimination), reduction/oxidation/hydrogenation/hydroboration/epoxidation (retention), mitsunobu (inversion), double_inversion (retention), racemization/epimerization/enolization (racemization).

When to use: Multi-step synthesis chirality tracking, verifying net retention/inversion.

`smiles_verifier.py` — SMILES molecular property verifier (no RDKit)

Preferred: use SMILES_verify tool (via MCP/SDK) with smiles and optional constraint parameters (mw, heavy_atoms, valence_electrons, total_atoms, formal_charge). Fallback: run smiles_verifier.py directly.

Parses a SMILES string without external dependencies and computes molecular weight, heavy atom

count, valence electron count, total atom count, and formal charge. Then optionally checks these

against user-supplied constraints. Use this every time you design or propose a SMILES answer.

python smiles_verifier.py --smiles "CC(C)(C(=N)N)N=NC(C)(C)C(=N)N" --mw 198.15 --heavy_atoms 14 --valence_electrons 80

Constraint flags: --mw (tolerance 0.5), --heavy_atoms, --valence_electrons, --total_atoms, --formal_charge

When to use: Always verify SMILES answers before reporting. Catches MW, atom count, and electron count errors.

`degrees_of_unsaturation.py` — Degrees of unsaturation (DoU) calculator

Preferred: use DegreesOfUnsaturation_calculate tool (via MCP/SDK) with formula or individual atom count parameters. Fallback: run degrees_of_unsaturation.py directly.

Computes DoU = (2C + 2 + N − H − X) / 2 from a formula string or individual atom counts.

Handles all halogens (F, Cl, Br, I) and notes that O and S do not affect DoU.

Prints the full arithmetic, a structural interpretation, and a round-trip verification.

python degrees_of_unsaturation.py --formula C6H6
python degrees_of_unsaturation.py --C 10 --H 14 --O 2 --N 1

Output: atom counts, step-by-step formula, result, structural interpretation, non-integer DoU warning.

`molecular_formula.py` — Combustion analysis and formula analysis

Preferred: use MolecularFormula_analyze tool (via MCP/SDK) with combustion or formula parameters. Fallback: run molecular_formula.py directly.

Two modes in one script.

Mode 1: combustion analysis — --sample_g, --CO2_g, --H2O_g, optional --molar_mass

Mode 2: formula analysis — --formula C6H6 (MW, DoU, elemental composition)

python molecular_formula.py --sample_g 0.2 --CO2_g 0.4874 --H2O_g 0.1998 --molar_mass 78
python molecular_formula.py --formula C6H6

5. Computational Procedures

ALWAYS EXECUTE as Python scripts using the Bash tool — do not compute mentally. Prefer the bundled scripts (molecular_formula.py, degrees_of_unsaturation.py) over writing code from scratch.

Key formulas (write and run Python when bundled scripts don't cover the case):


6. When to Reason vs When to Look Things Up

REASON through these (do not look up):

COMPUTE with bundled scripts for these:

LOOK UP with tools for these:

Crystal structure verification strategy:

Extract unit cell params, Z, MW, density for each dataset. Run crystal_validator.py --datasets datasets.json in batch. Largest %error = the error. Common errors: wrong Z, swapped params, angle transcription errors.

Molecular Design from Constraints (SMILES design):

  1. Start from constraints (MW, heavy atoms, VE) to estimate formula
  2. Build SMILES, then always verify: python smiles_verifier.py --smiles "..." --mw X --heavy_atoms Y --valence_electrons Z
  3. If any constraint FAILs, revise and re-run until all pass

The verify-after-reasoning pattern:

  1. Reason through the problem, arrive at a proposed answer
  2. Verify known compounds with PubChem; verify numerical answers with Python computation
  3. For numerical answers: ALWAYS compute with scripts before answering
Use this skill with your AI agent: Open on Skill Issue to copy, download, or add to your library. Works with Claude, ChatGPT, Gemini, Cursor, Windsurf and more.