
Diffdock
- 35 installs
- 16 repo stars
- Updated November 20, 2025
- jackspace/claudeskillz
Use DiffDock to predict 3D protein-ligand binding poses from PDB and SMILES inputs with confidence scores, including batch virtual screening.
About
DiffDock is a diffusion-based deep learning tool that predicts protein-ligand binding poses for structure-based drug design. A developer uses it to dock ligands to proteins and score pose confidence, not to predict binding affinity.
- Predicts binding poses from PDB structures or ESMFold sequences
- Supports batch virtual screening with confidence scores
Diffdock by the numbers
- 35 all-time installs (skills.sh)
- Ranked #1,059 of 2,065 Data Science & ML skills by installs in the Skillselion catalog
- Data as of Jul 30, 2026 (Skillselion catalog sync)
npx skills add https://github.com/jackspace/claudeskillz --skill diffdockAdd your badge
Show developers this skill is listed on Skillselion. Paste this into your README.
| Installs | 35 |
|---|---|
| repo stars | ★ 16 |
| Last updated | November 20, 2025 |
| Repository | jackspace/claudeskillz ↗ |
What it does
Use DiffDock to predict 3D protein-ligand binding poses from PDB and SMILES inputs with confidence scores, including batch virtual screening.
Files
DiffDock: Molecular Docking with Diffusion Models
Overview
DiffDock is a diffusion-based deep learning tool for molecular docking that predicts 3D binding poses of small molecule ligands to protein targets. It represents the state-of-the-art in computational docking, crucial for structure-based drug discovery and chemical biology.
Core Capabilities:
- Predict ligand binding poses with high accuracy using deep learning
- Support protein structures (PDB files) or sequences (via ESMFold)
- Process single complexes or batch virtual screening campaigns
- Generate confidence scores to assess prediction reliability
- Handle diverse ligand inputs (SMILES, SDF, MOL2)
Key Distinction: DiffDock predicts binding poses (3D structure) and confidence (prediction certainty), NOT binding affinity (ΔG, Kd). Always combine with scoring functions (GNINA, MM/GBSA) for affinity assessment.
When to Use This Skill
This skill should be used when:
- "Dock this ligand to a protein" or "predict binding pose"
- "Run molecular docking" or "perform protein-ligand docking"
- "Virtual screening" or "screen compound library"
- "Where does this molecule bind?" or "predict binding site"
- Structure-based drug design or lead optimization tasks
- Tasks involving PDB files + SMILES strings or ligand structures
- Batch docking of multiple protein-ligand pairs
Installation and Environment Setup
Check Environment Status
Before proceeding with DiffDock tasks, verify the environment setup:
# Use the provided setup checker
python scripts/setup_check.pyThis script validates Python version, PyTorch with CUDA, PyTorch Geometric, RDKit, ESM, and other dependencies.
Installation Options
Option 1: Conda (Recommended)
git clone https://github.com/gcorso/DiffDock.git
cd DiffDock
conda env create --file environment.yml
conda activate diffdockOption 2: Docker
docker pull rbgcsail/diffdock
docker run -it --gpus all --entrypoint /bin/bash rbgcsail/diffdock
micromamba activate diffdockImportant Notes:
- GPU strongly recommended (10-100x speedup vs CPU)
- First run pre-computes SO(2)/SO(3) lookup tables (~2-5 minutes)
- Model checkpoints (~500MB) download automatically if not present
Core Workflows
Workflow 1: Single Protein-Ligand Docking
Use Case: Dock one ligand to one protein target
Input Requirements:
- Protein: PDB file OR amino acid sequence
- Ligand: SMILES string OR structure file (SDF/MOL2)
Command:
python -m inference \
--config default_inference_args.yaml \
--protein_path protein.pdb \
--ligand "CC(=O)Oc1ccccc1C(=O)O" \
--out_dir results/single_docking/Alternative (protein sequence):
python -m inference \
--config default_inference_args.yaml \
--protein_sequence "MSKGEELFTGVVPILVELDGDVNGHKF..." \
--ligand ligand.sdf \
--out_dir results/sequence_docking/Output Structure:
results/single_docking/
├── rank_1.sdf # Top-ranked pose
├── rank_2.sdf # Second-ranked pose
├── ...
├── rank_10.sdf # 10th pose (default: 10 samples)
└── confidence_scores.txtWorkflow 2: Batch Processing Multiple Complexes
Use Case: Dock multiple ligands to proteins, virtual screening campaigns
Step 1: Prepare Batch CSV
Use the provided script to create or validate batch input:
# Create template
python scripts/prepare_batch_csv.py --create --output batch_input.csv
# Validate existing CSV
python scripts/prepare_batch_csv.py my_input.csv --validateCSV Format:
complex_name,protein_path,ligand_description,protein_sequence
complex1,protein1.pdb,CC(=O)Oc1ccccc1C(=O)O,
complex2,,COc1ccc(C#N)cc1,MSKGEELFT...
complex3,protein3.pdb,ligand3.sdf,Required Columns:
complex_name: Unique identifierprotein_path: PDB file path (leave empty if using sequence)ligand_description: SMILES string or ligand file pathprotein_sequence: Amino acid sequence (leave empty if using PDB)
Step 2: Run Batch Docking
python -m inference \
--config default_inference_args.yaml \
--protein_ligand_csv batch_input.csv \
--out_dir results/batch/ \
--batch_size 10For Large Virtual Screening (>100 compounds):
Pre-compute protein embeddings for faster processing:
# Pre-compute embeddings
python datasets/esm_embedding_preparation.py \
--protein_ligand_csv screening_input.csv \
--out_file protein_embeddings.pt
# Run with pre-computed embeddings
python -m inference \
--config default_inference_args.yaml \
--protein_ligand_csv screening_input.csv \
--esm_embeddings_path protein_embeddings.pt \
--out_dir results/screening/Workflow 3: Analyzing Results
After docking completes, analyze confidence scores and rank predictions:
# Analyze all results
python scripts/analyze_results.py results/batch/
# Show top 5 per complex
python scripts/analyze_results.py results/batch/ --top 5
# Filter by confidence threshold
python scripts/analyze_results.py results/batch/ --threshold 0.0
# Export to CSV
python scripts/analyze_results.py results/batch/ --export summary.csv
# Show top 20 predictions across all complexes
python scripts/analyze_results.py results/batch/ --best 20The analysis script:
- Parses confidence scores from all predictions
- Classifies as High (>0), Moderate (-1.5 to 0), or Low (<-1.5)
- Ranks predictions within and across complexes
- Generates statistical summaries
- Exports results to CSV for downstream analysis
Confidence Score Interpretation
Understanding Scores:
| Score Range | Confidence Level | Interpretation |
|---|---|---|
| > 0 | High | Strong prediction, likely accurate |
| -1.5 to 0 | Moderate | Reasonable prediction, validate carefully |
| < -1.5 | Low | Uncertain prediction, requires validation |
Critical Notes: 1. Confidence ≠ Affinity: High confidence means model certainty about structure, NOT strong binding 2. Context Matters: Adjust expectations for:
- Large ligands (>500 Da): Lower confidence expected
- Multiple protein chains: May decrease confidence
- Novel protein families: May underperform
3. Multiple Samples: Review top 3-5 predictions, look for consensus
For detailed guidance: Read references/confidence_and_limitations.md using the Read tool
Parameter Customization
Using Custom Configuration
Create custom configuration for specific use cases:
# Copy template
cp assets/custom_inference_config.yaml my_config.yaml
# Edit parameters (see template for presets)
# Then run with custom config
python -m inference \
--config my_config.yaml \
--protein_ligand_csv input.csv \
--out_dir results/Key Parameters to Adjust
Sampling Density:
samples_per_complex: 10→ Increase to 20-40 for difficult cases- More samples = better coverage but longer runtime
Inference Steps:
inference_steps: 20→ Increase to 25-30 for higher accuracy- More steps = potentially better quality but slower
Temperature Parameters (control diversity):
temp_sampling_tor: 7.04→ Increase for flexible ligands (8-10)temp_sampling_tor: 7.04→ Decrease for rigid ligands (5-6)- Higher temperature = more diverse poses
Presets Available in Template: 1. High Accuracy: More samples + steps, lower temperature 2. Fast Screening: Fewer samples, faster 3. Flexible Ligands: Increased torsion temperature 4. Rigid Ligands: Decreased torsion temperature
For complete parameter reference: Read references/parameters_reference.md using the Read tool
Advanced Techniques
Ensemble Docking (Protein Flexibility)
For proteins with known flexibility, dock to multiple conformations:
# Create ensemble CSV
import pandas as pd
conformations = ["conf1.pdb", "conf2.pdb", "conf3.pdb"]
ligand = "CC(=O)Oc1ccccc1C(=O)O"
data = {
"complex_name": [f"ensemble_{i}" for i in range(len(conformations))],
"protein_path": conformations,
"ligand_description": [ligand] * len(conformations),
"protein_sequence": [""] * len(conformations)
}
pd.DataFrame(data).to_csv("ensemble_input.csv", index=False)Run docking with increased sampling:
python -m inference \
--config default_inference_args.yaml \
--protein_ligand_csv ensemble_input.csv \
--samples_per_complex 20 \
--out_dir results/ensemble/Integration with Scoring Functions
DiffDock generates poses; combine with other tools for affinity:
GNINA (Fast neural network scoring):
for pose in results/*.sdf; do
gnina -r protein.pdb -l "$pose" --score_only
doneMM/GBSA (More accurate, slower): Use AmberTools MMPBSA.py or gmx_MMPBSA after energy minimization
Free Energy Calculations (Most accurate): Use OpenMM + OpenFE or GROMACS for FEP/TI calculations
Recommended Workflow: 1. DiffDock → Generate poses with confidence scores 2. Visual inspection → Check structural plausibility 3. GNINA or MM/GBSA → Rescore and rank by affinity 4. Experimental validation → Biochemical assays
Limitations and Scope
DiffDock IS Designed For:
- Small molecule ligands (typically 100-1000 Da)
- Drug-like organic compounds
- Small peptides (<20 residues)
- Single or multi-chain proteins
DiffDock IS NOT Designed For:
- Large biomolecules (protein-protein docking) → Use DiffDock-PP or AlphaFold-Multimer
- Large peptides (>20 residues) → Use alternative methods
- Covalent docking → Use specialized covalent docking tools
- Binding affinity prediction → Combine with scoring functions
- Membrane proteins → Not specifically trained, use with caution
For complete limitations: Read references/confidence_and_limitations.md using the Read tool
Troubleshooting
Common Issues
Issue: Low confidence scores across all predictions
- Cause: Large/unusual ligands, unclear binding site, protein flexibility
- Solution: Increase
samples_per_complex(20-40), try ensemble docking, validate protein structure
Issue: Out of memory errors
- Cause: GPU memory insufficient for batch size
- Solution: Reduce
--batch_size 2or process fewer complexes at once
Issue: Slow performance
- Cause: Running on CPU instead of GPU
- Solution: Verify CUDA with
python -c "import torch; print(torch.cuda.is_available())", use GPU
Issue: Unrealistic binding poses
- Cause: Poor protein preparation, ligand too large, wrong binding site
- Solution: Check protein for missing residues, remove far waters, consider specifying binding site
Issue: "Module not found" errors
- Cause: Missing dependencies or wrong environment
- Solution: Run
python scripts/setup_check.pyto diagnose
Performance Optimization
For Best Results: 1. Use GPU (essential for practical use) 2. Pre-compute ESM embeddings for repeated protein use 3. Batch process multiple complexes together 4. Start with default parameters, then tune if needed 5. Validate protein structures (resolve missing residues) 6. Use canonical SMILES for ligands
Graphical User Interface
For interactive use, launch the web interface:
python app/main.py
# Navigate to http://localhost:7860Or use the online demo without installation:
- https://huggingface.co/spaces/reginabarzilaygroup/DiffDock-Web
Resources
Helper Scripts (scripts/)
`prepare_batch_csv.py`: Create and validate batch input CSV files
- Create templates with example entries
- Validate file paths and SMILES strings
- Check for required columns and format issues
`analyze_results.py`: Analyze confidence scores and rank predictions
- Parse results from single or batch runs
- Generate statistical summaries
- Export to CSV for downstream analysis
- Identify top predictions across complexes
`setup_check.py`: Verify DiffDock environment setup
- Check Python version and dependencies
- Verify PyTorch and CUDA availability
- Test RDKit and PyTorch Geometric installation
- Provide installation instructions if needed
Reference Documentation (references/)
`parameters_reference.md`: Complete parameter documentation
- All command-line options and configuration parameters
- Default values and acceptable ranges
- Temperature parameters for controlling diversity
- Model checkpoint locations and version flags
Read this file when users need:
- Detailed parameter explanations
- Fine-tuning guidance for specific systems
- Alternative sampling strategies
`confidence_and_limitations.md`: Confidence score interpretation and tool limitations
- Detailed confidence score interpretation
- When to trust predictions
- Scope and limitations of DiffDock
- Integration with complementary tools
- Troubleshooting prediction quality
Read this file when users need:
- Help interpreting confidence scores
- Understanding when NOT to use DiffDock
- Guidance on combining with other tools
- Validation strategies
`workflows_examples.md`: Comprehensive workflow examples
- Detailed installation instructions
- Step-by-step examples for all workflows
- Advanced integration patterns
- Troubleshooting common issues
- Best practices and optimization tips
Read this file when users need:
- Complete workflow examples with code
- Integration with GNINA, OpenMM, or other tools
- Virtual screening workflows
- Ensemble docking procedures
Assets (assets/)
`batch_template.csv`: Template for batch processing
- Pre-formatted CSV with required columns
- Example entries showing different input types
- Ready to customize with actual data
`custom_inference_config.yaml`: Configuration template
- Annotated YAML with all parameters
- Four preset configurations for common use cases
- Detailed comments explaining each parameter
- Ready to customize and use
Best Practices
1. Always verify environment with setup_check.py before starting large jobs 2. Validate batch CSVs with prepare_batch_csv.py to catch errors early 3. Start with defaults then tune parameters based on system-specific needs 4. Generate multiple samples (10-40) for robust predictions 5. Visual inspection of top poses before downstream analysis 6. Combine with scoring functions for affinity assessment 7. Use confidence scores for initial ranking, not final decisions 8. Pre-compute embeddings for virtual screening campaigns 9. Document parameters used for reproducibility 10. Validate results experimentally when possible
Citations
When using DiffDock, cite the appropriate papers:
DiffDock-L (current default model):
Stärk et al. (2024) "DiffDock-L: Improving Molecular Docking with Diffusion Models"
arXiv:2402.18396Original DiffDock:
Corso et al. (2023) "DiffDock: Diffusion Steps, Twists, and Turns for Molecular Docking"
ICLR 2023, arXiv:2210.01776Additional Resources
- GitHub Repository: https://github.com/gcorso/DiffDock
- Online Demo: https://huggingface.co/spaces/reginabarzilaygroup/DiffDock-Web
- DiffDock-L Paper: https://arxiv.org/abs/2402.18396
- Original Paper: https://arxiv.org/abs/2210.01776
{
"description": "\"Diffusion-based molecular docking. Predict protein-ligand binding poses from PDB/SMILES, confidence scores, virtual screening, for structure-based drug design. Not for affinity prediction.\"",
"references": {
"files": [
"references/confidence_and_limitations.md",
"references/parameters_reference.md",
"references/workflows_examples.md"
]
},
"content": "### Check Environment Status\r\n\r\nBefore proceeding with DiffDock tasks, verify the environment setup:\r\n\r\n```bash\r\n\r\n### Workflow 1: Single Protein-Ligand Docking\r\n\r\n**Use Case:** Dock one ligand to one protein target\r\n\r\n**Input Requirements:**\r\n- Protein: PDB file OR amino acid sequence\r\n- Ligand: SMILES string OR structure file (SDF/MOL2)\r\n\r\n**Command:**\r\n```bash\r\npython -m inference \\\r\n --config default_inference_args.yaml \\\r\n --protein_path protein.pdb \\\r\n --ligand \"CC(=O)Oc1ccccc1C(=O)O\" \\\r\n --out_dir results/single_docking/\r\n```\r\n\r\n**Alternative (protein sequence):**\r\n```bash\r\npython -m inference \\\r\n --config default_inference_args.yaml \\\r\n --protein_sequence \"MSKGEELFTGVVPILVELDGDVNGHKF...\" \\\r\n --ligand ligand.sdf \\\r\n --out_dir results/sequence_docking/\r\n```\r\n\r\n**Output Structure:**\r\n```\r\nresults/single_docking/\r\n├── rank_1.sdf # Top-ranked pose\r\n├── rank_2.sdf # Second-ranked pose\r\n├── ...\r\n├── rank_10.sdf # 10th pose (default: 10 samples)\r\n└── confidence_scores.txt\r\n```\r\n\r\n### Workflow 2: Batch Processing Multiple Complexes\r\n\r\n**Use Case:** Dock multiple ligands to proteins, virtual screening campaigns\r\n\r\n**Step 1: Prepare Batch CSV**\r\n\r\nUse the provided script to create or validate batch input:\r\n\r\n```bash\r\npython scripts/prepare_batch_csv.py --create --output batch_input.csv\r\n\r\npython scripts/prepare_batch_csv.py my_input.csv --validate\r\n```\r\n\r\n**CSV Format:**\r\n```csv\r\ncomplex_name,protein_path,ligand_description,protein_sequence\r\ncomplex1,protein1.pdb,CC(=O)Oc1ccccc1C(=O)O,\r\ncomplex2,,COc1ccc(C#N)cc1,MSKGEELFT...\r\ncomplex3,protein3.pdb,ligand3.sdf,\r\n```\r\n\r\n**Required Columns:**\r\n- `complex_name`: Unique identifier\r\n- `protein_path`: PDB file path (leave empty if using sequence)\r\n- `ligand_description`: SMILES string or ligand file path\r\n- `protein_sequence`: Amino acid sequence (leave empty if using PDB)\r\n\r\n**Step 2: Run Batch Docking**\r\n\r\n```bash\r\npython -m inference \\\r\n --config default_inference_args.yaml \\\r\n --protein_ligand_csv batch_input.csv \\\r\n --out_dir results/batch/ \\\r\n --batch_size 10\r\n```\r\n\r\n**For Large Virtual Screening (>100 compounds):**\r\n\r\nPre-compute protein embeddings for faster processing:\r\n```bash\r\npython datasets/esm_embedding_preparation.py \\\r\n --protein_ligand_csv screening_input.csv \\\r\n --out_file protein_embeddings.pt\r\n\r\npython -m inference \\\r\n --config default_inference_args.yaml \\\r\n --protein_ligand_csv screening_input.csv \\\r\n --esm_embeddings_path protein_embeddings.pt \\\r\n --out_dir results/screening/\r\n```\r\n\r\n### Workflow 3: Analyzing Results\r\n\r\nAfter docking completes, analyze confidence scores and rank predictions:\r\n\r\n```bash\r\npython scripts/analyze_results.py results/batch/\r\n\r\npython scripts/analyze_results.py results/batch/ --top 5\r\n\r\npython scripts/analyze_results.py results/batch/ --threshold 0.0\r\n\r\npython scripts/analyze_results.py results/batch/ --export summary.csv\r\n\r\n\r\n### Using Custom Configuration\r\n\r\nCreate custom configuration for specific use cases:\r\n\r\n```bash\r\ncp assets/custom_inference_config.yaml my_config.yaml\r\n\r\n\r\n### Ensemble Docking (Protein Flexibility)\r\n\r\nFor proteins with known flexibility, dock to multiple conformations:\r\n\r\n```python\r\n\r\nFor interactive use, launch the web interface:\r\n\r\n```bash\r\npython app/main.py",
"name": "diffdock",
"id": "scientific-pkg-diffdock",
"sections": {
"Limitations and Scope": "**DiffDock IS Designed For:**\r\n- Small molecule ligands (typically 100-1000 Da)\r\n- Drug-like organic compounds\r\n- Small peptides (<20 residues)\r\n- Single or multi-chain proteins\r\n\r\n**DiffDock IS NOT Designed For:**\r\n- Large biomolecules (protein-protein docking) → Use DiffDock-PP or AlphaFold-Multimer\r\n- Large peptides (>20 residues) → Use alternative methods\r\n- Covalent docking → Use specialized covalent docking tools\r\n- Binding affinity prediction → Combine with scoring functions\r\n- Membrane proteins → Not specifically trained, use with caution\r\n\r\n**For complete limitations:** Read `references/confidence_and_limitations.md` using the Read tool",
"Installation and Environment Setup": "python scripts/setup_check.py\r\n```\r\n\r\nThis script validates Python version, PyTorch with CUDA, PyTorch Geometric, RDKit, ESM, and other dependencies.\r\n\r\n### Installation Options\r\n\r\n**Option 1: Conda (Recommended)**\r\n```bash\r\ngit clone https://github.com/gcorso/DiffDock.git\r\ncd DiffDock\r\nconda env create --file environment.yml\r\nconda activate diffdock\r\n```\r\n\r\n**Option 2: Docker**\r\n```bash\r\ndocker pull rbgcsail/diffdock\r\ndocker run -it --gpus all --entrypoint /bin/bash rbgcsail/diffdock\r\nmicromamba activate diffdock\r\n```\r\n\r\n**Important Notes:**\r\n- GPU strongly recommended (10-100x speedup vs CPU)\r\n- First run pre-computes SO(2)/SO(3) lookup tables (~2-5 minutes)\r\n- Model checkpoints (~500MB) download automatically if not present",
"Graphical User Interface": "```\r\n\r\nOr use the online demo without installation:\r\n- https://huggingface.co/spaces/reginabarzilaygroup/DiffDock-Web",
"Citations": "When using DiffDock, cite the appropriate papers:\r\n\r\n**DiffDock-L (current default model):**\r\n```\r\nStärk et al. (2024) \"DiffDock-L: Improving Molecular Docking with Diffusion Models\"\r\narXiv:2402.18396\r\n```\r\n\r\n**Original DiffDock:**\r\n```\r\nCorso et al. (2023) \"DiffDock: Diffusion Steps, Twists, and Turns for Molecular Docking\"\r\nICLR 2023, arXiv:2210.01776\r\n```",
"Overview": "DiffDock is a diffusion-based deep learning tool for molecular docking that predicts 3D binding poses of small molecule ligands to protein targets. It represents the state-of-the-art in computational docking, crucial for structure-based drug discovery and chemical biology.\r\n\r\n**Core Capabilities:**\r\n- Predict ligand binding poses with high accuracy using deep learning\r\n- Support protein structures (PDB files) or sequences (via ESMFold)\r\n- Process single complexes or batch virtual screening campaigns\r\n- Generate confidence scores to assess prediction reliability\r\n- Handle diverse ligand inputs (SMILES, SDF, MOL2)\r\n\r\n**Key Distinction:** DiffDock predicts **binding poses** (3D structure) and **confidence** (prediction certainty), NOT binding affinity (ΔG, Kd). Always combine with scoring functions (GNINA, MM/GBSA) for affinity assessment.",
"Advanced Techniques": "import pandas as pd\r\n\r\nconformations = [\"conf1.pdb\", \"conf2.pdb\", \"conf3.pdb\"]\r\nligand = \"CC(=O)Oc1ccccc1C(=O)O\"\r\n\r\ndata = {\r\n \"complex_name\": [f\"ensemble_{i}\" for i in range(len(conformations))],\r\n \"protein_path\": conformations,\r\n \"ligand_description\": [ligand] * len(conformations),\r\n \"protein_sequence\": [\"\"] * len(conformations)\r\n}\r\n\r\npd.DataFrame(data).to_csv(\"ensemble_input.csv\", index=False)\r\n```\r\n\r\nRun docking with increased sampling:\r\n```bash\r\npython -m inference \\\r\n --config default_inference_args.yaml \\\r\n --protein_ligand_csv ensemble_input.csv \\\r\n --samples_per_complex 20 \\\r\n --out_dir results/ensemble/\r\n```\r\n\r\n### Integration with Scoring Functions\r\n\r\nDiffDock generates poses; combine with other tools for affinity:\r\n\r\n**GNINA (Fast neural network scoring):**\r\n```bash\r\nfor pose in results/*.sdf; do\r\n gnina -r protein.pdb -l \"$pose\" --score_only\r\ndone\r\n```\r\n\r\n**MM/GBSA (More accurate, slower):**\r\nUse AmberTools MMPBSA.py or gmx_MMPBSA after energy minimization\r\n\r\n**Free Energy Calculations (Most accurate):**\r\nUse OpenMM + OpenFE or GROMACS for FEP/TI calculations\r\n\r\n**Recommended Workflow:**\r\n1. DiffDock → Generate poses with confidence scores\r\n2. Visual inspection → Check structural plausibility\r\n3. GNINA or MM/GBSA → Rescore and rank by affinity\r\n4. Experimental validation → Biochemical assays",
"Confidence Score Interpretation": "**Understanding Scores:**\r\n\r\n| Score Range | Confidence Level | Interpretation |\r\n|------------|------------------|----------------|\r\n| **> 0** | High | Strong prediction, likely accurate |\r\n| **-1.5 to 0** | Moderate | Reasonable prediction, validate carefully |\r\n| **< -1.5** | Low | Uncertain prediction, requires validation |\r\n\r\n**Critical Notes:**\r\n1. **Confidence ≠ Affinity**: High confidence means model certainty about structure, NOT strong binding\r\n2. **Context Matters**: Adjust expectations for:\r\n - Large ligands (>500 Da): Lower confidence expected\r\n - Multiple protein chains: May decrease confidence\r\n - Novel protein families: May underperform\r\n3. **Multiple Samples**: Review top 3-5 predictions, look for consensus\r\n\r\n**For detailed guidance:** Read `references/confidence_and_limitations.md` using the Read tool",
"Best Practices": "1. **Always verify environment** with `setup_check.py` before starting large jobs\r\n2. **Validate batch CSVs** with `prepare_batch_csv.py` to catch errors early\r\n3. **Start with defaults** then tune parameters based on system-specific needs\r\n4. **Generate multiple samples** (10-40) for robust predictions\r\n5. **Visual inspection** of top poses before downstream analysis\r\n6. **Combine with scoring** functions for affinity assessment\r\n7. **Use confidence scores** for initial ranking, not final decisions\r\n8. **Pre-compute embeddings** for virtual screening campaigns\r\n9. **Document parameters** used for reproducibility\r\n10. **Validate results** experimentally when possible",
"When to Use This Skill": "This skill should be used when:\r\n\r\n- \"Dock this ligand to a protein\" or \"predict binding pose\"\r\n- \"Run molecular docking\" or \"perform protein-ligand docking\"\r\n- \"Virtual screening\" or \"screen compound library\"\r\n- \"Where does this molecule bind?\" or \"predict binding site\"\r\n- Structure-based drug design or lead optimization tasks\r\n- Tasks involving PDB files + SMILES strings or ligand structures\r\n- Batch docking of multiple protein-ligand pairs",
"Resources": "### Helper Scripts (`scripts/`)\r\n\r\n**`prepare_batch_csv.py`**: Create and validate batch input CSV files\r\n- Create templates with example entries\r\n- Validate file paths and SMILES strings\r\n- Check for required columns and format issues\r\n\r\n**`analyze_results.py`**: Analyze confidence scores and rank predictions\r\n- Parse results from single or batch runs\r\n- Generate statistical summaries\r\n- Export to CSV for downstream analysis\r\n- Identify top predictions across complexes\r\n\r\n**`setup_check.py`**: Verify DiffDock environment setup\r\n- Check Python version and dependencies\r\n- Verify PyTorch and CUDA availability\r\n- Test RDKit and PyTorch Geometric installation\r\n- Provide installation instructions if needed\r\n\r\n### Reference Documentation (`references/`)\r\n\r\n**`parameters_reference.md`**: Complete parameter documentation\r\n- All command-line options and configuration parameters\r\n- Default values and acceptable ranges\r\n- Temperature parameters for controlling diversity\r\n- Model checkpoint locations and version flags\r\n\r\nRead this file when users need:\r\n- Detailed parameter explanations\r\n- Fine-tuning guidance for specific systems\r\n- Alternative sampling strategies\r\n\r\n**`confidence_and_limitations.md`**: Confidence score interpretation and tool limitations\r\n- Detailed confidence score interpretation\r\n- When to trust predictions\r\n- Scope and limitations of DiffDock\r\n- Integration with complementary tools\r\n- Troubleshooting prediction quality\r\n\r\nRead this file when users need:\r\n- Help interpreting confidence scores\r\n- Understanding when NOT to use DiffDock\r\n- Guidance on combining with other tools\r\n- Validation strategies\r\n\r\n**`workflows_examples.md`**: Comprehensive workflow examples\r\n- Detailed installation instructions\r\n- Step-by-step examples for all workflows\r\n- Advanced integration patterns\r\n- Troubleshooting common issues\r\n- Best practices and optimization tips\r\n\r\nRead this file when users need:\r\n- Complete workflow examples with code\r\n- Integration with GNINA, OpenMM, or other tools\r\n- Virtual screening workflows\r\n- Ensemble docking procedures\r\n\r\n### Assets (`assets/`)\r\n\r\n**`batch_template.csv`**: Template for batch processing\r\n- Pre-formatted CSV with required columns\r\n- Example entries showing different input types\r\n- Ready to customize with actual data\r\n\r\n**`custom_inference_config.yaml`**: Configuration template\r\n- Annotated YAML with all parameters\r\n- Four preset configurations for common use cases\r\n- Detailed comments explaining each parameter\r\n- Ready to customize and use",
"Core Workflows": "python scripts/analyze_results.py results/batch/ --best 20\r\n```\r\n\r\nThe analysis script:\r\n- Parses confidence scores from all predictions\r\n- Classifies as High (>0), Moderate (-1.5 to 0), or Low (<-1.5)\r\n- Ranks predictions within and across complexes\r\n- Generates statistical summaries\r\n- Exports results to CSV for downstream analysis",
"Troubleshooting": "### Common Issues\r\n\r\n**Issue: Low confidence scores across all predictions**\r\n- Cause: Large/unusual ligands, unclear binding site, protein flexibility\r\n- Solution: Increase `samples_per_complex` (20-40), try ensemble docking, validate protein structure\r\n\r\n**Issue: Out of memory errors**\r\n- Cause: GPU memory insufficient for batch size\r\n- Solution: Reduce `--batch_size 2` or process fewer complexes at once\r\n\r\n**Issue: Slow performance**\r\n- Cause: Running on CPU instead of GPU\r\n- Solution: Verify CUDA with `python -c \"import torch; print(torch.cuda.is_available())\"`, use GPU\r\n\r\n**Issue: Unrealistic binding poses**\r\n- Cause: Poor protein preparation, ligand too large, wrong binding site\r\n- Solution: Check protein for missing residues, remove far waters, consider specifying binding site\r\n\r\n**Issue: \"Module not found\" errors**\r\n- Cause: Missing dependencies or wrong environment\r\n- Solution: Run `python scripts/setup_check.py` to diagnose\r\n\r\n### Performance Optimization\r\n\r\n**For Best Results:**\r\n1. Use GPU (essential for practical use)\r\n2. Pre-compute ESM embeddings for repeated protein use\r\n3. Batch process multiple complexes together\r\n4. Start with default parameters, then tune if needed\r\n5. Validate protein structures (resolve missing residues)\r\n6. Use canonical SMILES for ligands",
"Parameter Customization": "python -m inference \\\r\n --config my_config.yaml \\\r\n --protein_ligand_csv input.csv \\\r\n --out_dir results/\r\n```\r\n\r\n### Key Parameters to Adjust\r\n\r\n**Sampling Density:**\r\n- `samples_per_complex: 10` → Increase to 20-40 for difficult cases\r\n- More samples = better coverage but longer runtime\r\n\r\n**Inference Steps:**\r\n- `inference_steps: 20` → Increase to 25-30 for higher accuracy\r\n- More steps = potentially better quality but slower\r\n\r\n**Temperature Parameters (control diversity):**\r\n- `temp_sampling_tor: 7.04` → Increase for flexible ligands (8-10)\r\n- `temp_sampling_tor: 7.04` → Decrease for rigid ligands (5-6)\r\n- Higher temperature = more diverse poses\r\n\r\n**Presets Available in Template:**\r\n1. High Accuracy: More samples + steps, lower temperature\r\n2. Fast Screening: Fewer samples, faster\r\n3. Flexible Ligands: Increased torsion temperature\r\n4. Rigid Ligands: Decreased torsion temperature\r\n\r\n**For complete parameter reference:** Read `references/parameters_reference.md` using the Read tool",
"Additional Resources": "- **GitHub Repository**: https://github.com/gcorso/DiffDock\r\n- **Online Demo**: https://huggingface.co/spaces/reginabarzilaygroup/DiffDock-Web\r\n- **DiffDock-L Paper**: https://arxiv.org/abs/2402.18396\r\n- **Original Paper**: https://arxiv.org/abs/2210.01776"
}
}---
name: diffdock
description: "Diffusion-based molecular docking. Predict protein-ligand binding poses from PDB/SMILES, confidence scores, virtual screening, for structure-based drug design. Not for affinity prediction."
---
# DiffDock: Molecular Docking with Diffusion Models
## Overview
DiffDock is a diffusion-based deep learning tool for molecular docking that predicts 3D binding poses of small molecule ligands to protein targets. It represents the state-of-the-art in computational docking, crucial for structure-based drug discovery and chemical biology.
**Core Capabilities:**
- Predict ligand binding poses with high accuracy using deep learning
- Support protein structures (PDB files) or sequences (via ESMFold)
- Process single complexes or batch virtual screening campaigns
- Generate confidence scores to assess prediction reliability
- Handle diverse ligand inputs (SMILES, SDF, MOL2)
**Key Distinction:** DiffDock predicts **binding poses** (3D structure) and **confidence** (prediction certainty), NOT binding affinity (ΔG, Kd). Always combine with scoring functions (GNINA, MM/GBSA) for affinity assessment.
## When to Use This Skill
This skill should be used when:
- "Dock this ligand to a protein" or "predict binding pose"
- "Run molecular docking" or "perform protein-ligand docking"
- "Virtual screening" or "screen compound library"
- "Where does this molecule bind?" or "predict binding site"
- Structure-based drug design or lead optimization tasks
- Tasks involving PDB files + SMILES strings or ligand structures
- Batch docking of multiple protein-ligand pairs
## Installation and Environment Setup
### Check Environment Status
Before proceeding with DiffDock tasks, verify the environment setup:
```bash
# Use the provided setup checker
python scripts/setup_check.py
```
This script validates Python version, PyTorch with CUDA, PyTorch Geometric, RDKit, ESM, and other dependencies.
### Installation Options
**Option 1: Conda (Recommended)**
```bash
git clone https://github.com/gcorso/DiffDock.git
cd DiffDock
conda env create --file environment.yml
conda activate diffdock
```
**Option 2: Docker**
```bash
docker pull rbgcsail/diffdock
docker run -it --gpus all --entrypoint /bin/bash rbgcsail/diffdock
micromamba activate diffdock
```
**Important Notes:**
- GPU strongly recommended (10-100x speedup vs CPU)
- First run pre-computes SO(2)/SO(3) lookup tables (~2-5 minutes)
- Model checkpoints (~500MB) download automatically if not present
## Core Workflows
### Workflow 1: Single Protein-Ligand Docking
**Use Case:** Dock one ligand to one protein target
**Input Requirements:**
- Protein: PDB file OR amino acid sequence
- Ligand: SMILES string OR structure file (SDF/MOL2)
**Command:**
```bash
python -m inference \
--config default_inference_args.yaml \
--protein_path protein.pdb \
--ligand "CC(=O)Oc1ccccc1C(=O)O" \
--out_dir results/single_docking/
```
**Alternative (protein sequence):**
```bash
python -m inference \
--config default_inference_args.yaml \
--protein_sequence "MSKGEELFTGVVPILVELDGDVNGHKF..." \
--ligand ligand.sdf \
--out_dir results/sequence_docking/
```
**Output Structure:**
```
results/single_docking/
├── rank_1.sdf # Top-ranked pose
├── rank_2.sdf # Second-ranked pose
├── ...
├── rank_10.sdf # 10th pose (default: 10 samples)
└── confidence_scores.txt
```
### Workflow 2: Batch Processing Multiple Complexes
**Use Case:** Dock multiple ligands to proteins, virtual screening campaigns
**Step 1: Prepare Batch CSV**
Use the provided script to create or validate batch input:
```bash
# Create template
python scripts/prepare_batch_csv.py --create --output batch_input.csv
# Validate existing CSV
python scripts/prepare_batch_csv.py my_input.csv --validate
```
**CSV Format:**
```csv
complex_name,protein_path,ligand_description,protein_sequence
complex1,protein1.pdb,CC(=O)Oc1ccccc1C(=O)O,
complex2,,COc1ccc(C#N)cc1,MSKGEELFT...
complex3,protein3.pdb,ligand3.sdf,
```
**Required Columns:**
- `complex_name`: Unique identifier
- `protein_path`: PDB file path (leave empty if using sequence)
- `ligand_description`: SMILES string or ligand file path
- `protein_sequence`: Amino acid sequence (leave empty if using PDB)
**Step 2: Run Batch Docking**
```bash
python -m inference \
--config default_inference_args.yaml \
--protein_ligand_csv batch_input.csv \
--out_dir results/batch/ \
--batch_size 10
```
**For Large Virtual Screening (>100 compounds):**
Pre-compute protein embeddings for faster processing:
```bash
# Pre-compute embeddings
python datasets/esm_embedding_preparation.py \
--protein_ligand_csv screening_input.csv \
--out_file protein_embeddings.pt
# Run with pre-computed embeddings
python -m inference \
--config default_inference_args.yaml \
--protein_ligand_csv screening_input.csv \
--esm_embeddings_path protein_embeddings.pt \
--out_dir results/screening/
```
### Workflow 3: Analyzing Results
After docking completes, analyze confidence scores and rank predictions:
```bash
# Analyze all results
python scripts/analyze_results.py results/batch/
# Show top 5 per complex
python scripts/analyze_results.py results/batch/ --top 5
# Filter by confidence threshold
python scripts/analyze_results.py results/batch/ --threshold 0.0
# Export to CSV
python scripts/analyze_results.py results/batch/ --export summary.csv
# Show top 20 predictions across all complexes
python scripts/analyze_results.py results/batch/ --best 20
```
The analysis script:
- Parses confidence scores from all predictions
- Classifies as High (>0), Moderate (-1.5 to 0), or Low (<-1.5)
- Ranks predictions within and across complexes
- Generates statistical summaries
- Exports results to CSV for downstream analysis
## Confidence Score Interpretation
**Understanding Scores:**
| Score Range | Confidence Level | Interpretation |
|------------|------------------|----------------|
| **> 0** | High | Strong prediction, likely accurate |
| **-1.5 to 0** | Moderate | Reasonable prediction, validate carefully |
| **< -1.5** | Low | Uncertain prediction, requires validation |
**Critical Notes:**
1. **Confidence ≠ Affinity**: High confidence means model certainty about structure, NOT strong binding
2. **Context Matters**: Adjust expectations for:
- Large ligands (>500 Da): Lower confidence expected
- Multiple protein chains: May decrease confidence
- Novel protein families: May underperform
3. **Multiple Samples**: Review top 3-5 predictions, look for consensus
**For detailed guidance:** Read `references/confidence_and_limitations.md` using the Read tool
## Parameter Customization
### Using Custom Configuration
Create custom configuration for specific use cases:
```bash
# Copy template
cp assets/custom_inference_config.yaml my_config.yaml
# Edit parameters (see template for presets)
# Then run with custom config
python -m inference \
--config my_config.yaml \
--protein_ligand_csv input.csv \
--out_dir results/
```
### Key Parameters to Adjust
**Sampling Density:**
- `samples_per_complex: 10` → Increase to 20-40 for difficult cases
- More samples = better coverage but longer runtime
**Inference Steps:**
- `inference_steps: 20` → Increase to 25-30 for higher accuracy
- More steps = potentially better quality but slower
**Temperature Parameters (control diversity):**
- `temp_sampling_tor: 7.04` → Increase for flexible ligands (8-10)
- `temp_sampling_tor: 7.04` → Decrease for rigid ligands (5-6)
- Higher temperature = more diverse poses
**Presets Available in Template:**
1. High Accuracy: More samples + steps, lower temperature
2. Fast Screening: Fewer samples, faster
3. Flexible Ligands: Increased torsion temperature
4. Rigid Ligands: Decreased torsion temperature
**For complete parameter reference:** Read `references/parameters_reference.md` using the Read tool
## Advanced Techniques
### Ensemble Docking (Protein Flexibility)
For proteins with known flexibility, dock to multiple conformations:
```python
# Create ensemble CSV
import pandas as pd
conformations = ["conf1.pdb", "conf2.pdb", "conf3.pdb"]
ligand = "CC(=O)Oc1ccccc1C(=O)O"
data = {
"complex_name": [f"ensemble_{i}" for i in range(len(conformations))],
"protein_path": conformations,
"ligand_description": [ligand] * len(conformations),
"protein_sequence": [""] * len(conformations)
}
pd.DataFrame(data).to_csv("ensemble_input.csv", index=False)
```
Run docking with increased sampling:
```bash
python -m inference \
--config default_inference_args.yaml \
--protein_ligand_csv ensemble_input.csv \
--samples_per_complex 20 \
--out_dir results/ensemble/
```
### Integration with Scoring Functions
DiffDock generates poses; combine with other tools for affinity:
**GNINA (Fast neural network scoring):**
```bash
for pose in results/*.sdf; do
gnina -r protein.pdb -l "$pose" --score_only
done
```
**MM/GBSA (More accurate, slower):**
Use AmberTools MMPBSA.py or gmx_MMPBSA after energy minimization
**Free Energy Calculations (Most accurate):**
Use OpenMM + OpenFE or GROMACS for FEP/TI calculations
**Recommended Workflow:**
1. DiffDock → Generate poses with confidence scores
2. Visual inspection → Check structural plausibility
3. GNINA or MM/GBSA → Rescore and rank by affinity
4. Experimental validation → Biochemical assays
## Limitations and Scope
**DiffDock IS Designed For:**
- Small molecule ligands (typically 100-1000 Da)
- Drug-like organic compounds
- Small peptides (<20 residues)
- Single or multi-chain proteins
**DiffDock IS NOT Designed For:**
- Large biomolecules (protein-protein docking) → Use DiffDock-PP or AlphaFold-Multimer
- Large peptides (>20 residues) → Use alternative methods
- Covalent docking → Use specialized covalent docking tools
- Binding affinity prediction → Combine with scoring functions
- Membrane proteins → Not specifically trained, use with caution
**For complete limitations:** Read `references/confidence_and_limitations.md` using the Read tool
## Troubleshooting
### Common Issues
**Issue: Low confidence scores across all predictions**
- Cause: Large/unusual ligands, unclear binding site, protein flexibility
- Solution: Increase `samples_per_complex` (20-40), try ensemble docking, validate protein structure
**Issue: Out of memory errors**
- Cause: GPU memory insufficient for batch size
- Solution: Reduce `--batch_size 2` or process fewer complexes at once
**Issue: Slow performance**
- Cause: Running on CPU instead of GPU
- Solution: Verify CUDA with `python -c "import torch; print(torch.cuda.is_available())"`, use GPU
**Issue: Unrealistic binding poses**
- Cause: Poor protein preparation, ligand too large, wrong binding site
- Solution: Check protein for missing residues, remove far waters, consider specifying binding site
**Issue: "Module not found" errors**
- Cause: Missing dependencies or wrong environment
- Solution: Run `python scripts/setup_check.py` to diagnose
### Performance Optimization
**For Best Results:**
1. Use GPU (essential for practical use)
2. Pre-compute ESM embeddings for repeated protein use
3. Batch process multiple complexes together
4. Start with default parameters, then tune if needed
5. Validate protein structures (resolve missing residues)
6. Use canonical SMILES for ligands
## Graphical User Interface
For interactive use, launch the web interface:
```bash
python app/main.py
# Navigate to http://localhost:7860
```
Or use the online demo without installation:
- https://huggingface.co/spaces/reginabarzilaygroup/DiffDock-Web
## Resources
### Helper Scripts (`scripts/`)
**`prepare_batch_csv.py`**: Create and validate batch input CSV files
- Create templates with example entries
- Validate file paths and SMILES strings
- Check for required columns and format issues
**`analyze_results.py`**: Analyze confidence scores and rank predictions
- Parse results from single or batch runs
- Generate statistical summaries
- Export to CSV for downstream analysis
- Identify top predictions across complexes
**`setup_check.py`**: Verify DiffDock environment setup
- Check Python version and dependencies
- Verify PyTorch and CUDA availability
- Test RDKit and PyTorch Geometric installation
- Provide installation instructions if needed
### Reference Documentation (`references/`)
**`parameters_reference.md`**: Complete parameter documentation
- All command-line options and configuration parameters
- Default values and acceptable ranges
- Temperature parameters for controlling diversity
- Model checkpoint locations and version flags
Read this file when users need:
- Detailed parameter explanations
- Fine-tuning guidance for specific systems
- Alternative sampling strategies
**`confidence_and_limitations.md`**: Confidence score interpretation and tool limitations
- Detailed confidence score interpretation
- When to trust predictions
- Scope and limitations of DiffDock
- Integration with complementary tools
- Troubleshooting prediction quality
Read this file when users need:
- Help interpreting confidence scores
- Understanding when NOT to use DiffDock
- Guidance on combining with other tools
- Validation strategies
**`workflows_examples.md`**: Comprehensive workflow examples
- Detailed installation instructions
- Step-by-step examples for all workflows
- Advanced integration patterns
- Troubleshooting common issues
- Best practices and optimization tips
Read this file when users need:
- Complete workflow examples with code
- Integration with GNINA, OpenMM, or other tools
- Virtual screening workflows
- Ensemble docking procedures
### Assets (`assets/`)
**`batch_template.csv`**: Template for batch processing
- Pre-formatted CSV with required columns
- Example entries showing different input types
- Ready to customize with actual data
**`custom_inference_config.yaml`**: Configuration template
- Annotated YAML with all parameters
- Four preset configurations for common use cases
- Detailed comments explaining each parameter
- Ready to customize and use
## Best Practices
1. **Always verify environment** with `setup_check.py` before starting large jobs
2. **Validate batch CSVs** with `prepare_batch_csv.py` to catch errors early
3. **Start with defaults** then tune parameters based on system-specific needs
4. **Generate multiple samples** (10-40) for robust predictions
5. **Visual inspection** of top poses before downstream analysis
6. **Combine with scoring** functions for affinity assessment
7. **Use confidence scores** for initial ranking, not final decisions
8. **Pre-compute embeddings** for virtual screening campaigns
9. **Document parameters** used for reproducibility
10. **Validate results** experimentally when possible
## Citations
When using DiffDock, cite the appropriate papers:
**DiffDock-L (current default model):**
```
Stärk et al. (2024) "DiffDock-L: Improving Molecular Docking with Diffusion Models"
arXiv:2402.18396
```
**Original DiffDock:**
```
Corso et al. (2023) "DiffDock: Diffusion Steps, Twists, and Turns for Molecular Docking"
ICLR 2023, arXiv:2210.01776
```
## Additional Resources
- **GitHub Repository**: https://github.com/gcorso/DiffDock
- **Online Demo**: https://huggingface.co/spaces/reginabarzilaygroup/DiffDock-Web
- **DiffDock-L Paper**: https://arxiv.org/abs/2402.18396
- **Original Paper**: https://arxiv.org/abs/2210.01776