/atomistic-skills:ml-bayesian-optimizationfrom Atomistic Skills
Iteratively optimizes expensive black-box objectives using Bayesian Optimization with Gaussian Process surrogates and acquisition functions. Supports single-objective (Expected Improvement) and multi-objective (ParEGO) optimization for materials properties, experimental yields, or simulation outputs.
Ships in Atomistic Skills. Installing the plugin adds it to Claude Code.
What the skill costs in Claude's context, stage by stage
Name and description: Claude knows it exists.
SKILL.md joins the conversation and stays.
Read when SKILL.md points to them.
[!NOTE] Steps written
server.toolare MCP tool calls:mace.relax_structureis therelax_structuretool of themaceserver (mcp__mace__relax_structure, ormcp__plugin_atomistic-skills_mace__relax_structurewhen installed as a plugin). Without a connected server, run the same tools from the shell. Tools named in one command share a process, so a model loaded byload_modelstays loaded:${CLAUDE_SKILL_DIR}/../../venv/run mlip python -m src.mcp_server.cli mace relax_structure key=value predict_structure key=value ${CLAUDE_SKILL_DIR}/../../venv/run mlip python -m src.mcp_server.cli matgl relax_structure key=value predict_structure key=value ${CLAUDE_SKILL_DIR}/../../venv/run cpu python -m src.mcp_server.cli atomate2 run_atomate2_vasp_calculation key=value ${CLAUDE_SKILL_DIR}/../../venv/run cpu python -m src.mcp_server.cli base visualize_structure key=value
Efficiently find the optimal input parameters (e.g., alloy composition, simulation hyperparameters, process conditions) that minimize or maximize one or more expensive black-box objectives (e.g., formation energy, bandgap, elastic modulus) using Bayesian Optimization (BO). BO builds a probabilistic surrogate model (Gaussian Process) over the objective landscape and uses an acquisition function to intelligently select the next most informative experiments, minimizing the number of expensive evaluations required.
Create a search_space.yaml in the research directory. Use the template at resources/search_space_template.yaml as a starting point:
# research_dir/search_space.yaml
parameters:
# Continuous range parameter
- name: x_Fe
type: range
bounds: [0.0, 1.0]
value_type: float
# Integer range parameter
- name: supercell_size
type: range
bounds: [2, 6]
value_type: int
objectives:
# Single-objective: minimize formation energy
- name: formation_energy_eV_atom
minimize: true
# Multi-objective: additionally maximize bandgap (uncomment to enable)
# - name: bandgap_eV
# minimize: false
Guidelines:
type: range for continuous or integer parameters with known bounds. Only range parameters are passed to the GP surrogate.choice and fixed types are recorded in output CSVs but not optimized. Run separate campaigns per discrete choice.Generate an initial space-filling design using Sobol sequences. Use a power-of-2 batch_size (4, 8, 16, …) for optimal Sobol balance:
${CLAUDE_SKILL_DIR}/../../venv/run cpu python ${CLAUDE_SKILL_DIR}/scripts/suggest_candidates.py \
--config research_dir/search_space.yaml \
--batch_size 8 \
--output research_dir/candidates_round_0.csv \
--output_dir research_dir/
With no --results provided (or fewer than 2 × N_range_params evaluated points), the script automatically uses Sobol initialization. The output CSV lists candidate parameter values only — it does not evaluate the objective.
For each row in candidates_round_0.csv, call the appropriate MCP tool to evaluate the objective and record results. The script plays no role in this step.
| Objective type | Recommended MCP tool |
|---|---|
| Energy / formation energy | mace.relax_structure or matgl.relax_structure |
| Bandgap | No MLIP tool: matgl withdrew its bandgap model and publishes no replacement — evaluate with atomate2.run_atomate2_vasp_calculation instead |
| Arbitrary property | mace.predict_structure |
| DFT reference | atomate2.run_atomate2_vasp_calculation |
Save all results to evaluated.csv — one row per candidate, parameter columns plus objective column(s):
x_Fe,formation_energy_eV_atom
0.12,-0.087
0.45,-0.143
0.73,-0.091
With evaluated results, fit the GP surrogate and suggest the next batch:
${CLAUDE_SKILL_DIR}/../../venv/run cpu python ${CLAUDE_SKILL_DIR}/scripts/suggest_candidates.py \
--config research_dir/search_space.yaml \
--results research_dir/evaluated.csv \
--batch_size 4 \
--output research_dir/candidates_round_1.csv \
--output_dir research_dir/
The script will:
normalize_y=True).batch_size candidates to the output CSV.campaign_state.json in --output_dir.Repeat Steps 3–4 until the budget is exhausted or convergence is observed.
${CLAUDE_SKILL_DIR}/../../venv/run cpu python ${CLAUDE_SKILL_DIR}/scripts/plot_bo_results.py \
--results research_dir/evaluated.csv \
--config research_dir/search_space.yaml \
--output_dir research_dir/
This generates:
convergence_curve.png — best observed value vs. evaluation number (flat line = converged)parameter_importance.png — scatter of each parameter vs. objective across all evaluationspareto_front.png — (multi-objective only) non-dominated Pareto frontgp_model_1d.png — (single range parameter only) GP mean ± 2σ and EI landscapegp_model_2d.png — (exactly two range parameters) GP mean, uncertainty, and EI as contour mapsConvergence criteria (manual inspection):
Visual Inspection: Use base.visualize_structure to inspect the best-found structure, and inspect all generated plots.
Validate the BO workflow on a known 2D benchmark with three global minima at $f^* = 0.3979$:
${CLAUDE_SKILL_DIR}/../../venv/run cpu python ${CLAUDE_SKILL_DIR}/scripts/suggest_candidates.py \
--config ${CLAUDE_SKILL_DIR}/examples/branin-function/search_space.yaml \
--batch_size 8 \
--output /tmp/bo_test/candidates_round_0.csv \
--output_dir /tmp/bo_test/
See branin-function example for the full walkthrough including all 8 rounds and the GP model visualization.
Locate the most stable Li-Ag binary composition using Materials Project formation energies as the oracle:
See li-ag-phases example for the full walkthrough.
cpu. Dependencies: scikit-learn, scipy, numpy, pandas, pyyaml. No BoTorch or ax-platform required.batch_size = 4, 8, 16, …). For BO rounds, batch_size ≤ 8 is recommended; larger is fine when evaluations are embarrassingly parallel.2 × N_range_params evaluated points to fit reliably. The Sobol initialization (Step 2) should provide at least this many.search_space.yaml must be physically meaningful. The GP has no information about the objective outside the specified domain.--noise_std 0. For stochastic objectives (MD-derived properties, noisy experiments) set --noise_std <estimated_std>.Author: Bowen Deng Contact: GitHub @bowen-bd
examples/branin-function/README.md (opens in a new tab)examples/branin-function/campaign_state.json (opens in a new tab)examples/branin-function/candidates_round_0.csv (opens in a new tab)examples/branin-function/candidates_round_1.csv (opens in a new tab)examples/branin-function/candidates_round_2.csv (opens in a new tab)examples/branin-function/candidates_round_3.csv (opens in a new tab)examples/branin-function/candidates_round_4.csv (opens in a new tab)examples/branin-function/candidates_round_5.csv (opens in a new tab)examples/branin-function/candidates_round_6.csv (opens in a new tab)examples/branin-function/candidates_round_7.csv (opens in a new tab)examples/branin-function/convergence_curve.png (opens in a new tab)examples/branin-function/evaluated.csv (opens in a new tab)examples/branin-function/gp_model_2d.png (opens in a new tab)examples/branin-function/parameter_importance.png (opens in a new tab)examples/branin-function/search_space.yaml (opens in a new tab)examples/li-ag-phases/README.md (opens in a new tab)examples/li-ag-phases/campaign_state.json (opens in a new tab)examples/li-ag-phases/candidates_round_0.csv (opens in a new tab)examples/li-ag-phases/candidates_round_1.csv (opens in a new tab)examples/li-ag-phases/candidates_round_2.csv (opens in a new tab)What SKILL.md sets; muted values are Claude Code's defaults
npx claudepluginhub learningmatter-mit/atomisticskills --plugin atomistic-skills133 skills in this plugin
/chem-bond-dissociationCalculate homolytic and heterolytic bond dissociation energies (BDEs) for all single bonds in a molecule using MLIPs with RDKit fragmentation./chem-conformer-searchGenerate molecular conformers with RDKit ETKDG, relax with MLIPs, and rank by energy with Boltzmann weighting./chem-db-mofQuery multiple MOF databases (QMOF via MPContribs; ARC-MOF DB7/Majumdar et al. via Materials Cloud) and download CIF structures with optional element or identifier filters./chem-db-qmofQuery the Quantum MOF (QMOF) database via Materials Project's MPContribs platform for DFT-computed properties (bandgap) and optimized crystal structures of Metal-Organic Frameworks./chem-db-spectraSearch and download experimental InfraRed (IR), Mass spectra, and UV-Vis spectra data (JCAMP-DX format) for molecules./chem-dft-orca-advanced-calculationWrite and run custom ORCA input files for advanced electronic structure methods or settings not available through the SCINE wrapper, including multi-reference methods, excited states, relativistic effects, advanced SCF, NMR/EPR, and more.Other plugins' skills for the same job