| Date | Commit | Notes |
|---|---|---|
| 2026-04-06 | 3390b61 | change log added |
| 2026-09-09 | — | Replaced RFDiffusion3's broken scaffoldguided.target_pdb scaffold feedback with real RFD3 partial-diffusion guidance (partial.input/partial_t); replaced AlphaFold2/ColabFold fold-validation with Boltz-2 (protein+ligand co-folding, adds a real ligand-binding-confidence signal AF2 never had) |
| 2026-09-09 | — | Fixed analysis_sequence() silently never comparing MPNN candidates against each other (it only ever read a .fa file's first line — an un-designed template record — since real LigandMPNN writes every candidate for a design into one file, not one file per candidate) |
| 2026-09-09 | — | Added a metric-agnostic short-circuit to the fastrelax/interface retry loops — escalates to a new backbone as soon as a resequencing retry stops improving, instead of always exhausting a flat 5x retry cap on backbones that real data showed never recover |
An IMPRESS pipeline for iterative computational design of protein binders against a small molecule ligand. Starting from a ligand-containing target structure, the pipeline runs backbone diffusion → sequence design → energy minimization → structural validation → fold prediction in a loop, using an ensemble-based adaptive routing function to direct the search toward productive regions of structure-sequence space.
rfd3 ──► analysis_backbone ──► [adaptive]
│ pass
▼
mpnn (×N batches)
analysis_sequence ──► [adaptive]
│ pass / RETRY_SEQ (up to 3×)
▼
packmin
analysis_packmin ──► [adaptive]
│ (cycles 0..num_refine_cycles-2)
▼
fastrelax
analysis_fastrelax ──► [adaptive]
│ pass
▼
filter_shape
analysis_interface ──► [adaptive]
│ pass
▼
boltz
analysis_fold ──► [adaptive] ──► rfd3 (loop, optionally guided)
Each [adaptive] call invokes adaptive_decision (defined in run_small_molecule_binding.py), which reads the analysis metrics and the growing ensemble history to decide the next step. The pipeline loops until the task budget is exhausted (max_tasks ensemble entries).
Generates a new protein backbone scaffold conditioned on the ligand binding site using RFDiffusion3 (via Apptainer). RFD3 has no scaffoldguided.*-style CLI override for scaffold guidance — that was a leftover from an older RFDiffusion version. Guidance is expressed entirely through RFD3's InputSpecification JSON via partial diffusion: when a previous fold decoy is set as the guide (see adaptive rules below), the task normalizes that Boltz-2 model's ligand identity to match the pipeline's ligand .params file (Boltz assigns its own placeholder residue name; RFD3's ligand/select_exposed/select_buried selectors need the pipeline's literal name), then writes a guided copy of the base JSON spec with partial.input pointed at the normalized model and partial.partial_t (Å of diffusion noise, rfd3_partial_t kwarg) set. If normalization fails (no ligand found), falls back to the unguided base spec rather than erroring.
- Input:
<pipeline_name>_in/ALR_binder_design.json(diffusion config); when guided,<N>_rfd3/in/guided_scaffold.pdb+guided_binder_design.json(generated by this task, not user-supplied) - Output:
<N>_rfd3/out/<model>.cif.gz+<model>.json(per-model metrics) - HPC: 1 GPU per rank
Runs LigandMPNN to design amino acid sequences for the current backbone. On cycle 0, mpnn_ensemble_size independent sequence batches are generated from the backbone; on subsequent cycles within the same refinement loop, 1 batch is generated from the best packed structure so far. Side-chain packing is performed alongside sequence design.
LigandMPNN writes one file per input structure (seqs/binder.fa), containing a template record (an echo of the input sequence, no confidence fields) followed by batch_size real designed candidates (id=1..id=N, each with overall_confidence/ligand_confidence). analysis_sequence parses every candidate record across every .fa file and selects the single highest-overall_confidence candidate, writing its sequence to a clean single-record seqs/best_candidate.fa and pointing best_packed_pdb at that candidate's actual packed structure (packed/binder_packed_<id>_1.pdb).
- Input: backbone PDB (cycle 0) or best packed PDB (cycle > 0); optional
fixed_residues.txt - Output:
<N>_mpnn/out/seqs/binder.fa(all candidates),<N>_mpnn/out/seqs/best_candidate.fa(winning candidate only),<N>_mpnn/out/packed/*.pdb(packed structures, one per candidate) - Scores extracted:
overall_confidence(0–1),ligand_confidence(0–1) of the winning candidate
PyRosetta script that repacks side chains and performs energy minimization on the best-confidence sequence. Used between MPNN cycles to propagate structural improvements.
- Input: best packed PDB from previous MPNN step; ligand
.paramsfile - Output:
<N>_packmin/out/<stem>_minimized.pdb,<stem>_minimized_packmin_score.json - Scores extracted:
total_score(REU, Rosetta Energy Units)
Full backbone + side-chain relaxation of the best packed structure using Rosetta FastRelax (1 round). Gates progression to interface analysis.
- Input: best packed PDB; ligand
.paramsfile - Output:
<N>_fastrelax/out/<stem>_relaxed_0001.pdb,<stem>_relaxed.fasc - Scores extracted:
total_score(REU),interaction_energy(REU, protein–ligand interaction),fa_rep(REU, Lennard-Jones repulsion),rmsd(Å, deviation from input) - Retry behavior: a failure only retries via
STEP_MPNNif at least one failing metric improved over the previous attempt on the same backbone (see Adaptive Decision Rules) — a flat/non-improving backbone escalates to a freshrfd3call immediately rather than burning through resequencing attempts that real data showed never help
PyRosetta script computing shape complementarity (SC) and interface energetics between the designed protein and ligand. Gates progression to fold prediction. Uses the same non-improvement short-circuit as fastrelax.
- Input: directory of relaxed PDB files from the previous FastRelax step; ligand params path (
<pipeline_name>_in/<ligand_name>, stem resolved by the underlying PyRosetta script) - Output:
<N>_filter_shape/out/shape_complementarity_values.txt(SC per model),interface_values.txt(full interface metrics CSV) - Scores extracted:
max_sc— maximum SC value across all models in the batch (0–1 scale)
Boltz-2 (pip-installed, no container — see scripts/boltz.sh) co-folds the best-confidence designed sequence together with the ligand (specified by SMILES — see <ligand>.smiles below) to assess structural self-consistency and predict the bound complex directly. This is a real capability upgrade over the AlphaFold2 step it replaces: AF2 ran in single-sequence mode with zero ligand awareness (a bare "does this sequence fold" sanity check), while Boltz-2 predicts the actual complex and reports a ligand-binding-confidence metric (ligand_iptm) AF2 could never provide.
- Input:
<N>_boltz/in/boltz_input.yaml(built fromstate['last_seq_fasta']+<ligand>.smiles) - Output:
<N>_boltz/out/boltz_results_boltz_input/predictions/boltz_input/boltz_input_model_0.pdb+confidence_boltz_input_model_0.json— note Boltz nests its own output one level deeper than its--out_dirargument (boltz_results_<input_stem>/), confirmed against Boltz's own source, not just its docs - Scores extracted:
complex_plddt(0–1, rescaled ×100 forbest_complex_plddtto match the old AF2 pLDDT's 0–100 scale),ligand_iptm(0–1, protein–ligand interface confidence) - HPC: 1 GPU per rank
All thresholds are configurable at pipeline construction time (see Configurable Parameters); values below are the class defaults. The production run (run_small_molecule_binding.py's PROD config) overrides several of these — see Usage.
| Analysis step | Score | Threshold (class default) | Meaning |
|---|---|---|---|
backbone |
ligand_clashes |
must be == 0 |
No ligand atom clashes in backbone |
backbone |
max_ca_deviation |
< 2.0 Å |
Backbone stays close to diffusion target |
backbone |
ss_fraction |
> 0.2 |
At least 20% secondary structure (helix + sheet) |
fastrelax |
interact |
< 0.0 REU |
Favourable protein–ligand interaction energy |
fastrelax |
total_score |
< 0.0 REU |
Net favourable total Rosetta energy |
fastrelax |
fa_rep |
< 150.0 REU |
Low steric clash energy after relaxation |
interface |
max_sc |
>= 0.5 |
Shape complementarity at ligand interface |
fold |
best_complex_plddt |
>= 70.0 |
Boltz-2 confidence in predicted complex (0–100 scale) |
fold |
ligand_iptm |
>= None (off) |
Boltz-2 protein–ligand interface confidence, when fold_min_ligand_iptm is set |
Sequence analysis (analysis_sequence) always sets pass=True; routing is handled entirely by the ensemble comparison (see below). packmin gates only on total_score > 0 (badly packed → restart backbone), not a fixed threshold.
The adaptive_decision function in run_small_molecule_binding.py runs after every analysis step and sets pipeline.next_step. It uses an ensemble-based selective average to determine whether the current result is in a productive neighbourhood of the search space.
Performance contract.
adaptive_decisionruns off the event loop (the runner declares it as an engine task on itslocalthread-pool backend, withflow.function_task(backend="local")), and the similarity readers it depends on (_read_fasta_seq,_parse_pdb_ca_coords) are memoised. Both are load-bearing: the selective average compares the current result against every prior entry of its type, so an uncached reader costs O(ensemble) blocking filesystem reads per decision, and because the manager is one process shared by all pipelines that stalls the entire job rather than one pipeline. Getting this wrong capped an 8-node campaign at 37% of its 4-node baseline throughput with GPUs at 0.7% utilisation (see the 2026-09-30 row inCLAUDE.mdandplans/2026-09-30-adaptive-callback-serialization.md). If you add a similarity metric, cache its reader and keep the body off the event loop.
Every analysis task appends a tuple (type, score, input_path, output_path) to pipeline.state['ensemble']. All entries are kept regardless of pass/fail. The three entry types are:
| Type | Score | Input | Output |
|---|---|---|---|
generate backbone |
ss_fraction (0–1) |
scaffold PDB or None |
backbone .cif.gz |
predict sequence |
overall_confidence (0–1) |
backbone path | best-candidate FASTA path |
fold decoy |
best_complex_plddt (0–100) |
FASTA path | Boltz co-folded PDB path |
For a given entry type, the function computes:
overall_avg— mean score across all prior entries of that typeselective_avg— mean score of prior entries whose structural/sequence similarity to the current output is above (or below) the average pairwise similarity
The current result is considered to be in a productive neighbourhood when selective_avg > overall_avg, i.e. the entries most similar to the current result score better than average.
- Backbone similarity: Kabsch-aligned CA-RMSD (lower = more similar). Falls back to simple pass/fail when RMSD data is unavailable (RFDiffusion outputs
.cif.gz, not.pdb). - Sequence similarity: per-position identity fraction (higher = more similar).
- Fold similarity: Kabsch-aligned CA-RMSD between Boltz co-folded PDB outputs.
A fastrelax or interface failure only retries via STEP_MPNN if at least one currently-failing metric improved (closed its gap to threshold by more than 5% of the previous gap) compared to the previous attempt on the same backbone. The comparison state (fastrelax_prev_metrics / interface_prev_metrics) resets whenever a new backbone starts. If nothing improved, the pipeline escalates straight to STEP_RFD3 — effectively a retry cap of 1 (the very first failure always gets one retry, since there's nothing to compare against yet). The original flat 5x counter (fastrelax_fail_count / interface_fail_count) remains as an outer safety net in case metrics oscillate rather than genuinely plateauing.
This exists because some fastrelax/interface failures are driven by the backbone itself (packing, energetics, surface shape) rather than by sequence choice — no amount of resequencing fixes them, only a new backbone can. Confirmed against real HPC data: three different failure-mode combinations, each flat across every resequencing attempt observed, zero eventual recoveries.
| After step | Condition | Next step |
|---|---|---|
backbone |
quality check failed | STEP_RFD3 — generate new backbone |
backbone |
first attempt (no prior) | STEP_MPNN — proceed to sequence design |
backbone |
selective_avg > overall_avg |
STEP_MPNN — productive region, continue |
backbone |
selective_avg ≤ overall_avg |
STEP_RFD3 — unproductive region, retry backbone |
backbone |
RMSD unavailable (real mode) | STEP_MPNN — fall back to simple pass |
sequence |
first attempt (no prior) | STEP_MPNN — proceed to packmin |
sequence |
selective_avg > overall_avg |
STEP_MPNN (reset retry count) |
sequence |
selective_avg ≤ overall_avg, retry < 3 |
STEP_RETRY_SEQ — re-run MPNN same cycle |
sequence |
selective_avg ≤ overall_avg, retry = 3 |
STEP_RFD3 — abandon backbone, start over |
packmin |
total_score ≤ 0 (or unavailable) |
STEP_MPNN — continue refinement cycle |
packmin |
total_score > 0 |
STEP_RFD3 — badly packed, restart backbone |
fastrelax |
pass | STEP_INTERFACE — run shape complementarity |
fastrelax |
fail, improving | STEP_MPNN — retry sequence design |
fastrelax |
fail, not improving (or 5x safety cap) | STEP_RFD3 — short-circuit to new backbone |
interface |
pass | STEP_AF2 (dispatches to boltz) — run fold prediction |
interface |
fail, improving | STEP_MPNN — retry sequence design |
interface |
fail, not improving (or 5x safety cap) | STEP_RFD3 — short-circuit to new backbone |
fold |
selective_avg > overall_avg |
STEP_RFD3 with rfd3_input_pdb set to current fold decoy (guided diffusion) |
fold |
otherwise | STEP_RFD3 with rfd3_input_pdb = None (scratch) |
Note: fold analysis never sets STEP_DONE. The pipeline terminates exclusively via the task budget check. STEP_AF2's constant name is kept for compatibility even though it now dispatches to boltz(), not AlphaFold2.
Place all input files in <base_path>/<pipeline_name>_in/ (default: p1_in/).
| File | Required | Description |
|---|---|---|
ALR_binder_design.json |
Yes | RFDiffusion3 design config (target structure, hotspot residues, diffusion settings) |
fixed_residues.txt |
Yes | Space-separated residue indices to hold fixed during MPNN sequence design |
<ligand>.params |
Yes | Rosetta ligand parameter file (e.g. ALR.params); filename must match ligand_params kwarg |
<ligand>.smiles |
Yes | Ligand SMILES string, read by the boltz task to build its co-folding input. There is no SMILES in a Rosetta .params file — derive it once with scripts/derive_ligand_smiles.py <ligand>.params <reference>.pdb (RDKit bond-order perception from the params file's exact atom/bond connectivity plus the reference structure's 3D coordinates) |
input_pdbs/ |
Yes | Target/scaffold PDB referenced by the diffusion config (ALR_binder_design.json's partial.input) |
common_filenames.txt |
Yes (filter_energy) | List of accepted filenames for ligand energy filtering |
Important: whatever literal residue name a ligand's .params file declares in its NAME record is not necessarily the filename stem — e.g. ALR.params's NAME is A:R, not ALR (the colon is a deliberate workaround for RFD3 misresolving the bare "ALR" literal). Always resolve the real name from the .params file; never hardcode or "clean up" it.
All parameters are passed as kwargs to PipelineSetup:
| Parameter | Default | Description |
|---|---|---|
base_path |
os.getcwd() |
Root directory for all task subdirectories and input files |
mpnn_dir |
env var MPNN_DIR (required) |
Path to LigandMPNN repository checkout |
foundry_sif_path |
env var FOUNDRY_SIF_PATH (required) |
Apptainer sandbox/.sif containing RFDiffusion3 |
boltz_cache_path |
env var BOLTZ_CACHE (required) |
Boltz-2 model-weights cache directory (pip-installed CLI, no container — see scripts/boltz.sh) |
ligand_params |
ALR.params |
Ligand parameter filename (relative to <pipeline_name>_in/) |
mpnn_dir, foundry_sif_path, and boltz_cache_path all raise ValueError at construction time if neither the kwarg nor the corresponding environment variable is set — there is no silent path default. On Delta HPC, delta_gpu_run.sh sets all three env vars before launching (see Usage).
| Parameter | Default | Description |
|---|---|---|
mock |
False |
Run with lightweight mock tasks (no HPC tools required) |
num_refine_cycles |
3 |
Number of MPNN → PackMin cycles per backbone attempt |
mpnn_ensemble_size |
1 |
Number of independent sequence batches on cycle 0 |
diffusion_batch_size |
2 |
Number of backbone models to generate per RFDiffusion3 call |
rfd3_partial_t |
10.0 Å |
RFD3 partial-diffusion noise level for guided backbone feedback (lower = stays closer to the guide structure) |
max_tasks |
300 |
Total ensemble entries before stopping (counts every backbone, sequence, and fold entry, pass and fail) |
| Parameter | Default | Description |
|---|---|---|
backbone_max_ca_deviation |
2.0 Å |
Maximum allowed CA deviation from diffusion target |
backbone_min_ss_fraction |
0.2 |
Minimum helix + sheet fraction |
fastrelax_max_interact |
0.0 REU |
Maximum protein–ligand interaction energy after relaxation |
fastrelax_max_total_score |
0.0 REU |
Maximum total Rosetta score after relaxation |
fastrelax_max_fa_rep |
150.0 REU |
Maximum Lennard-Jones repulsion after relaxation |
interface_min_sc |
0.5 |
Minimum shape complementarity score |
fold_min_plddt |
70.0 |
Minimum Boltz-2 complex_plddt, rescaled ×100 |
fold_min_ligand_iptm |
None |
Minimum Boltz-2 ligand_iptm; None disables this gate (off by default so it doesn't silently make existing configs stricter) |
Each task creates a numbered directory <N>_<taskname>/ under base_path. The counter N increments with every HPC task (rfd3, mpnn, packmin, fastrelax, filter_shape, boltz); analysis tasks share the counter with the preceding HPC task.
<base_path>/
<pipeline_name>_in/ # user inputs
1_rfd3/out/ # backbone diffusion outputs
2_mpnn/out/seqs/ # binder.fa (all candidates) + best_candidate.fa
2_mpnn/out/packed/ # packed PDB structures, one per candidate
3_packmin/out/ # minimized PDB + score JSON
...
N_fastrelax/out/ # relaxed PDB + .fasc score file
N+1_filter_shape/out/
N+2_boltz/out/boltz_results_boltz_input/predictions/boltz_input/ # co-folded PDB + confidence JSON
Mock mode (mock=True, mock.py) mirrors this same layout with hardcoded fixture outputs, matching the real multi-candidate MPNN shape and the real nested Boltz output path, so the two modes stay directly comparable.
- One-time environment setup:
bash delta_env_setup.sh(creates the venv, installs all dependencies including Boltz-2 and PyRosetta, warms the Boltz weights cache). See that script's header comment for required env vars (WORK_DIR, etc.). - Derive each ligand's SMILES once:
python scripts/derive_ligand_smiles.py <ligand>.params <reference>.pdb, then copy the resulting.smilesfile into every<pipeline_name>_in/directory that uses that ligand. - Adjust
PRODinrun_small_molecule_binding.pyif the default thresholds don't fit your target (class defaults above are permissive;PRODis tuned tighter — e.g.fastrelax_max_fa_rep=100.0,interface_min_sc=0.55,fold_min_plddt=75.0). - Submit:
sbatch delta_gpu_run.sh(setsMPNN_DIR/FOUNDRY_SIF_PATH/BOLTZ_CACHEfromWORK_DIR-relative defaults, or export them yourself beforehand to override — see that script's header comment). For a dry run without HPC tools, userun_test_small_molecule_binding.py(mock tasks) instead.
After a run, validate the output against expected invariants (ligand identity preserved through the guided-RFD3 path, Boltz output shape, no regression to rejected design states, etc.):
python scripts/validate_run.py <base_path> <pipeline_name>cd examples/small_molecule_binding
python run_test_small_molecule_binding.pyMock tasks write placeholder files and hardcode passing metrics (matching the real multi-candidate MPNN and nested-Boltz-output shapes), so the full orchestration and adaptive routing logic can be exercised without any external tools. The mock run terminates after 100 ensemble entries (max_tasks=100). A handful of standalone regression checks (MPNN candidate selection, Boltz filename derivation, the fastrelax/interface short-circuit) run before the mock pipeline itself.
The following values are embedded in the code and not exposed as constructor kwargs:
| Location | Value | Description |
|---|---|---|
mpnn task |
--seed 111 |
Fixed random seed for LigandMPNN |
mpnn task |
--temperature 0.1 |
Sampling temperature for sequence design |
mpnn task |
--number_of_packs_per_design 1 |
Side-chain packs per sequence |
boltz task |
--diffusion_samples 1 (via BOLTZ_DIFFUSION_SAMPLES env var, default 1) |
Number of Boltz-2 structural samples per prediction |
boltz task |
--output_format pdb |
Structure output format |
fastrelax task |
-n 1 |
One FastRelax round |
_parse_pdb_ca_coords |
lru_cache(maxsize=512) |
Max cached PDB files for RMSD re-use |
adaptive_decision |
sequence retry count >= 3 |
Retries before abandoning backbone on sequence plateau |
adaptive_decision |
fastrelax/interface rel_tolerance=0.05 |
Relative-improvement threshold for the non-improvement short-circuit (see above) |
adaptive_decision |
fastrelax/interface safety cap >= 5 |
Outer retry cap regardless of the short-circuit, in case metrics oscillate |
run_small_molecule_binding.py uses DragonExecutionBackend for HPC production runs (IMPRESS_BACKEND=dragon, the default). Set IMPRESS_BACKEND=local before running to use ConcurrentExecutionBackend(ProcessPoolExecutor(), name="compute") (from rhapsody.backends) instead for single-node/non-Dragon development.
The caller owns the WorkflowEngine: the runner creates the backend, creates the engine, passes it to ImpressManager, and shuts it down in a finally. GPU placement is the backend's responsibility -- the example does no explicit pinning.