DockingAutoDock Vina

AutoDock Vina Tutorial: Molecular Docking for Beginners

Step-by-step beginner guide to molecular docking with AutoDock Vina. Learn receptors, ligands, scoring functions, and dock aspirin to COX-2 using the SciRouter API.

Ryan Bethencourt
March 19, 2026
10 min read

What Is Molecular Docking?

Molecular docking is a computational technique that predicts how a small molecule (called the ligand) fits into the binding site of a protein (called the receptor). Think of it as a digital lock-and-key experiment: the protein is the lock, the molecule is the key, and docking software tests whether the key fits and how well it holds in place.

Docking is one of the most widely used methods in drug discovery because it lets researchers test thousands of potential drug molecules against a protein target on a computer, long before any laboratory experiments. This saves enormous amounts of time and money by narrowing down candidates to the most promising ones.

Core Concepts You Need to Know

The Receptor (Protein Target)

The receptor is the protein you want to target with a drug. In most drug discovery programs, this is a protein that plays a role in disease. For example, COX-2 is a protein involved in inflammation and pain signaling. By finding molecules that bind tightly to the COX-2 active site, researchers can develop anti-inflammatory drugs.

Receptor structures come from experimental methods like X-ray crystallography and cryo-EM, stored in the Protein Data Bank (PDB). Each structure has a four-character identifier (like 5KIR for a COX-2 structure) that you can use to access the 3D coordinates.

The Ligand (Drug Molecule)

The ligand is the small molecule you are testing for binding. Ligands are typically represented as SMILES strings, which encode molecular structure as text. For example, aspirin is encoded as CC(=O)OC1=CC=CC=C1C(=O)O. The docking software converts this 2D representation into 3D coordinates and tests multiple orientations and shapes (conformations) within the binding pocket.

The Binding Site (Pocket)

The binding site is a specific region on the protein surface where the ligand fits. It is usually a cavity or groove with amino acid residues that form favorable interactions with the ligand. Most proteins have one primary active site, but some have multiple pockets where molecules can bind.

The Scoring Function

AutoDock Vina uses a scoring function to estimate how strongly a ligand binds to the receptor. This function combines several physical interaction terms:

  • Van der Waals forces: shape complementarity between the ligand and receptor surfaces
  • Hydrogen bonds: directional interactions between donor and acceptor atoms that stabilize binding
  • Hydrophobic contacts: favorable packing of nonpolar groups away from water
  • Torsional penalty: an entropy cost for each rotatable bond in the ligand that becomes restricted upon binding

The final output is a predicted binding affinity in kcal/mol. More negative values indicate stronger predicted binding.

Walkthrough: Docking Aspirin to COX-2

This step-by-step example docks aspirin against the COX-2 enzyme, a classic drug-target pair. Aspirin inhibits COX enzymes to reduce inflammation and pain. We will use the SciRouter API, which handles all receptor and ligand preparation automatically.

Step 1: Set Up Your Environment

Install dependencies and set API key
pip install requests
export SCIROUTER_API_KEY="sk-sci-your-api-key"

Step 2: Submit the Docking Job

Dock aspirin to COX-2
import requests
import time
import os

API_KEY = os.environ["SCIROUTER_API_KEY"]
BASE = "https://api.scirouter.ai/v1"
headers = {"Authorization": f"Bearer {API_KEY}"}

# Aspirin SMILES docked against COX-2 (PDB: 5KIR)
response = requests.post(
    f"{BASE}/docking/vina",
    headers=headers,
    json={
        "ligand_smiles": "CC(=O)OC1=CC=CC=C1C(=O)O",  # Aspirin
        "receptor_pdb": "5KIR",                          # COX-2
        "exhaustiveness": 8,                              # Search thoroughness
        "num_poses": 9                                    # Number of poses to return
    }
)
job = response.json()
print(f"Job submitted: {job['job_id']}")

Step 3: Poll for Results

Wait for results and display scores
# Poll until the job completes
while True:
    result = requests.get(
        f"{BASE}/docking/vina/{job['job_id']}",
        headers=headers
    ).json()

    if result["status"] == "completed":
        print(f"\nDocking complete. {len(result['poses'])} poses found:\n")
        for i, pose in enumerate(result["poses"]):
            print(f"  Pose {i+1}: {pose['affinity']:>6.1f} kcal/mol")
        break
    elif result["status"] == "failed":
        print(f"Error: {result['error']}")
        break

    time.sleep(5)

# Save the best pose for visualization
with open("aspirin_cox2.sdf", "w") as f:
    f.write(result["poses"][0]["sdf"])
print(f"\nBest pose saved to aspirin_cox2.sdf")
Note
Vina returns poses sorted by binding affinity, with the strongest binder first. The exhaustiveness parameter (default 8) controls how thoroughly the search algorithm explores conformational space. Higher values find better poses but take longer.

Step 4: Interpret the Results

After the docking run completes, evaluate the results using these guidelines:

  • Check the top score: aspirin typically scores between -6.0 and -8.0 kcal/mol against COX-2, consistent with its moderate binding affinity
  • Look at pose consistency: if the top 3 poses share a similar orientation, the predicted binding mode is more reliable
  • Visualize the best pose: open the saved SDF file in PyMOL or ChimeraX alongside the receptor to check for sensible interactions
  • Compare to other compounds: dock additional molecules against the same target to rank candidates
Warning
Docking scores are approximate. They are useful for ranking compounds against the same target, but should not be treated as exact measurements of binding strength. Always follow up computational hits with experimental validation.

Screening Multiple Compounds

Once you can dock a single molecule, scaling to many is straightforward. Here is a pattern for screening a small library:

Screen multiple compounds
compounds = {
    "Aspirin":      "CC(=O)OC1=CC=CC=C1C(=O)O",
    "Ibuprofen":    "CC(C)CC1=CC=C(C=C1)C(C)C(=O)O",
    "Naproxen":     "COC1=CC2=CC(=CC=C2C=C1)C(C)C(=O)O",
    "Celecoxib":    "CC1=CC=C(C=C1)C2=CC(=NN2C3=CC=C(C=C3)S(N)(=O)=O)C(F)(F)F",
}

jobs = {}
for name, smiles in compounds.items():
    resp = requests.post(
        f"{BASE}/docking/vina",
        headers=headers,
        json={"ligand_smiles": smiles, "receptor_pdb": "5KIR"}
    )
    jobs[name] = resp.json()["job_id"]
    print(f"Submitted {name}: {jobs[name]}")

# Collect results
import time
for name, job_id in jobs.items():
    while True:
        r = requests.get(f"{BASE}/docking/vina/{job_id}", headers=headers).json()
        if r["status"] == "completed":
            print(f"{name:>12}: {r['poses'][0]['affinity']:.1f} kcal/mol")
            break
        elif r["status"] == "failed":
            print(f"{name:>12}: FAILED")
            break
        time.sleep(3)

Next Steps

With the fundamentals of molecular docking covered, here are directions to explore next:

  • Read our comparison of Vina, Glide, and GOLD to understand how Vina compares to commercial docking software
  • Try AI-based docking with DiffDock which uses diffusion models instead of physics-based scoring
  • Predict protein structures for targets without crystal structures using ESMFold
  • Screen compounds for drug-likeness before docking with Molecular Properties

Try AutoDock Vina from the SciRouter tools page. Sign up for a free API key and start docking molecules in minutes.

Frequently Asked Questions

What is a receptor in molecular docking?

The receptor is the target protein that you want to dock a small molecule into. It is typically a disease-relevant protein with a known or predicted 3D structure. The receptor provides the binding site (pocket) where the ligand sits. Receptors are specified as PDB files or PDB IDs.

What is a ligand in molecular docking?

The ligand is the small molecule (drug candidate) that you are testing for binding to the receptor. Ligands are typically specified as SMILES strings, which encode their 2D chemical structure. The docking software generates 3D conformations and tests how they fit into the receptor pocket.

What is a good binding affinity score in Vina?

Binding affinity in Vina is reported as negative kcal/mol values. More negative means stronger predicted binding. Scores below -7.0 kcal/mol suggest moderate binding. Scores below -9.0 kcal/mol suggest strong binding. Use scores for relative ranking of compounds against the same target rather than as absolute predictions.

Do I need to know the binding site location?

When using AutoDock Vina through the SciRouter API, the binding pocket is auto-detected from the receptor structure. If a co-crystallized ligand exists in the PDB entry, the API centers the search box on that location. For blind docking (no known site), the API uses pocket detection algorithms to identify likely binding sites.

Can I dock multiple molecules at once?

Yes. Submit separate API requests for each ligand-receptor pair. Each returns an independent job ID that you can poll in parallel. This makes it straightforward to screen tens or hundreds of compounds by iterating over a list of SMILES strings in a Python loop.

Try It Free

No Login Required

Try this yourself

500 free credits. No credit card required.