jaechang-hits/sciagent-skills/aizynthfinder-retrosynthesis
Claude Code and agent skill by jaechang-hits/sciagent-skills
- community
Checking that the SKILL.md file is still in the repository.
AiZynthFinder retrosynthetic route planning (CASP) from AstraZeneca Molecular AI. Monte Carlo tree search guided by a template-based neural expansion policy recursively disconnects a target SMILES until precursors are found in a purchasable stock. Covers config.yml (v4 format), aizynthcli batch screening, the AiZynthFinder/AiZynthExpander Python API, one-step disconnections, custom stocks via smiles2stock, scorers, Retro*/breadth-first/DFPN search alternatives, and reading output.json.gz / trees.json. Use for synthesis route planning, synthesizability screening, and building-block/precursor search. For reaction barriers use neb-irc-activation-energy; for 2D reaction scheme drawing use rdkit-chemdraw-cdxml.
Install
npx vskill@latest install jaechang-hits/sciagent-skills/aizynthfinder-retrosynthesisSKILL.md
The same SKILL.md was published earlier as jaechang-hits/sciagent-skills/aizynthfinder-retrosynthesis.
AiZynthFinder Retrosynthesis
Overview
AiZynthFinder performs computer-aided synthesis planning (CASP): a search algorithm — Monte Carlo tree search by default — recursively disconnects a target molecule into precursors, guided by a neural expansion policy that ranks known reaction templates. The search terminates when all precursors are found in a stock (a set of purchasable building blocks) or the maximum depth is reached. Output is a ranked set of reaction trees plus per-target statistics (is_solved, step count, precursors in/out of stock).
Version covered: 4.4.1 (Python 3.10–3.12). The v4 config format differs substantially from v2/v3 as described in the 2020 paper — never copy a config from an old blog post without translating it.
When to Use
- Planning a synthesis route for a designed or purchased target molecule
- Screening a compound library for synthesizability before committing to make-on-demand
- Finding purchasable precursors or building blocks that lead to a scaffold
- Ranking design ideas by route length and by how many precursors fall outside a catalogue
- Enumerating the first retro step only — plausible disconnections without a full tree
- Testing whether a specific bond can be made disconnection-aware (
break_bonds) in a route - Comparing solve rate across two building-block catalogues for the same target set
- Use
torchdruginstead when training a retrosynthesis model rather than running route search - For forward reaction barriers and transition states use
neb-irc-activation-energy; for drawing the resulting scheme userdkit-chemdraw-cdxml
Prerequisites
- Python packages:
aizynthfinder(4.4.x),rdkit,pandas - Data requirements: a stock file (InChIKeys), a trained expansion policy (ONNX model + template CSV), optionally a filter policy
- Environment: Python 3.10–3.12. Default runtime is
onnxruntime; TensorFlow is not needed unless serving remote models or loading legacy.hdf5Keras models.
Check before installing — aizynthcli, download_public_data, and smiles2stock ship with the package and may already be on PATH inside a pixi/conda env. Inside a pixi project, invoke them as pixi run aizynthcli ....
[all] adds molbloom (bloom-filter stocks), pymongo, route-distances (route clustering), scipy, and timeout-decorator. Drop it for a lighter install; add [tf] only for TF-serving or .hdf5 models.
Quick Start
Workflow
Step 1: Get the Models and Stock
download_public_data fetches the public USPTO models and the ZINC stock subset (several hundred MB, from zenodo.org and figshare.com) and writes a ready-to-use config.yml.
Step 2: Write or Adjust config.yml
The list short-cut means "template-based strategy, model first, templates second, defaults elsewhere". The same short-cut works for a single filter model path and a single stock file path.
Values can be pulled from the environment: iteration_limit: ${ITERATION_LIMIT}.
Step 3: Validate the Target SMILES
An unparseable target burns the whole time limit before failing. Check first.
Step 4: Run the Tree Search
select() picks which loaded policies and stocks are active. AiZynthFinder also accepts configdict=<dict> instead of a file — the cleanest way to sweep parameters without writing YAML.
Step 5: Build Routes and Read Statistics
build_routes() extracts reaction trees from the search graph. Nothing in finder.routes exists until it is called.
Step 6: Inspect and Render Routes
finder.routes is a RouteCollection. Show two or three distinct routes, not only the top-scored one.
Step 7: Batch Screen with aizynthcli
For hundreds or thousands of targets, use the CLI rather than a Python loop — --nproc splits the input across processes.
Key Parameters
| Parameter | Default | Range / Options | Effect | |
|---|---|---|---|---|
search.time_limit | 120 | 30–1800 (s) | Wall-clock budget per target. Raise this first when nothing solves. | |
search.iteration_limit | 100 | 50–1000 | MCTS iterations per target; whichever of time/iterations hits first ends the search. | |
search.max_transforms | 6 | 3–10 | Maximum tree depth (longest route). Deeper searches cost quadratically more. | |
search.return_first | False | True/False | Stop at the first solved route — fast synthesizability yes/no, poor route quality. | |
search.exclude_target_from_stock | True | True/False | Keep True or a purchasable target returns an empty route. | |
search.algorithm_config.C | 1.4 | 0.5–3.0 | UCB exploration/exploitation balance; higher explores more disconnections. | |
search.algorithm_config.search_rewards | ["state score"] | any scorer names | Scorers driving the search; pair with search_rewards_weights for multi-objective. | |
expansion.cutoff_number | 50 | 10–100 | Templates applied per expansion. Widens branching and slows search — tune after the time limit. | |
expansion.cutoff_cumulative | 0.995 | 0.95–0.999 | Cumulative policy probability retained before truncating the template list. | |
expansion.template_column | retro_template | column name | Must match the template file; a mismatch yields silently empty expansions. | |
filter.filter_cutoff | 0.05 | 0.0–0.5 | Feasibility threshold; raising it prunes harder and can make targets unsolvable. | |
post_processing.max_routes | 25 | 5–100 | Routes extracted after the search; all_routes: True returns every solved route. |
Key Concepts
The route score is not a quality score
The state score reflects the fraction of solved precursors and the route length. It was designed to guide the tree search and is largely indiscriminate about whether a route is chemically sensible. Solved routes score near 1.0, unsolved ones typically below 0.8. Never present top_score as a confidence or feasibility measure.
Solve rate is set by the stock and the template library, not the algorithm
The public ZINC subset is far smaller than commercial catalogues; in the original comparison, adding Enamine building blocks found routes for 10 more compounds out of 100. Swapping USPTO for a Reaxys-derived policy changed which compounds solved rather than uniformly improving them. Findability tracks synthetic complexity — an unsolved target means "not found under this stock, this policy, and this budget", not "unsynthesizable".
Reference performance from the paper (100 random ChEMBL compounds, single CPU + single GPU): 55 solved, mean search time 38.7 s, mean time to first solution 7.1 s, mean 2.4 steps and 2.7 precursors.
No conditions are predicted
Reagents, solvents, temperatures, and yields are outside scope. A predicted route is a hypothesis for a chemist to evaluate.
Scorers
Loaded automatically: state score, number of reactions, number of pre-cursors, number of pre-cursors in stock. Also available in aizynthfinder.context.scoring: average template occurrence, sum of prices, route cost, max transform, broken bonds, fraction in stock, fraction in source, fraction of intermediates in <stock>, stock availability, reaction class membership, reaction class-rank score, delta-SC score, route similarity, plus CombinedScorer and DeepSetScorer. Scorers are addressed by their string name both in search.algorithm_config.search_rewards and in post_processing.route_scorer (which falls back to search_rewards when unset).
Search algorithms
Set search.algorithm to a class path to replace MCTS: Retro\* (aizynthfinder.search.retrostar.search_tree.SearchTree), breadth-first (aizynthfinder.search.breadth_first.search_tree.SearchTree), DFPN (aizynthfinder.search.dfpn.search_tree.SearchTree).
This is the start of the file. Read the full SKILL.md on GitHub.
Security
- Security scanPassed, 95 of 100Pattern checks on the skill's files.
- Model reviewPassed
Quality evaluation
- Task evaluationNot runNo evaluation yet. Run one in Skill Studio.
Source
- SKILL.md in the repositoryCheckingskills/structural-biology-drug-discovery/aizynthfinder-retrosynthesis/SKILL.md
Popularity
- 7-day trend score
- 5
Not refreshed yet.
Works with
Any agent vskill installs to: 56 targets in all. These 39 have a page on this site.
- Claude Code
- Cursor
- GitHub Copilot
- Windsurf
- Codex
- Gemini CLI
- Cline
- Amp
- Roo Code
- Goose
- Continue
- Kilo Code
- Junie
- Trae
- OpenHands
- Qwen Code
- AI Agent
- Tabnine Chat
- Sourcegraph Cody
- Amazon Q
- Firebase Genkit
- Sweep
- Devin
- Phind
- Mentat
- Claude Desktop
- Aider
- GPT Pilot
- Plandex
- bolt.new
- v0
- Replit Agent
- Anse
- TypingMind
- BetterChatGPT
- LibreChat
- Warp AI
- Pieces
- Fig AI
Embed badge
[](https://verified-skill.com/skills/jaechang-hits/sciagent-skills/aizynthfinder-retrosynthesis)