How to Visualize Protein-Ligand Interactions in PyMOL: Binding Pockets, H-bonds and Publication Figures

How to Visualize Protein-Ligand Interactions in PyMOL: Binding Pockets, H-bonds and Publication Figures

Protein-ligand interaction figures are among the most published images in structural biology and drug discovery. This tutorial covers the complete workflow: loading the complex, showing the binding pocket, displaying H-bonds and contacts, measuring key distances, and producing a clean publication figure that communicates the binding mode clearly.

Interaction types — what PyMOL can show

Before opening PyMOL, it helps to know which interaction types you’re looking for. The six major categories in protein-ligand binding, and how PyMOL handles each:

H-bonds
2.5–3.5 Å donor–acceptor
PyMOL distance with mode=2. The most important interaction type to show.
Hydrophobic
3.5–4.5 Å C-C contacts
Use distance or color surface by hydrophobicity. Show as proximity.
π-stacking
3.5–4.0 Å ring centers
Measure ring centroid distances manually. Annotate in figure legend.
Salt bridges
2.5–4.0 Å charge pairs
Distance between charged atoms. Can be shown alongside H-bonds.
Van der Waals
3.5–5.0 Å all atoms
Show surface contacts rather than individual distances.
Metal coord.
2.0–2.5 Å M–ligand
Distance from metal ion. Color metal distinctly (gold spheres).

Loading and preparing the complex

PyMOL command line
# Load from RCSB (structure must contain bound ligand)
fetch 4XYZ

# Or load a docking result / local file
load protein_ligand_complex.pdb

# Remove water and other heteroatoms that aren't the ligand
remove resn HOH
remove resn SO4+PEG+GOL+EDO   # common crystallographic additives to remove

# Identify the ligand residue name
select ligands, hetatm
iterate ligands, print(resn, resi, chain)

# Name your ligand selection (replace LIG with actual 3-letter code)
select LIG, resn LIG
Finding your ligand’s residue name
Every ligand in a PDB file has a 3-letter residue name (e.g., ATP, LIG, MK1, 0QE). The quickest way to find it: after loading, run iterate hetatm, print(resn) in the command line, which prints all heteroatom residue names. In the PDB, crystal additives like sulfate (SO4), glycerol (GOL), and PEG appear as hetatm alongside your actual ligand — remove them first before working on the binding site.

Showing the binding pocket

A clean binding site figure uses three layers: the gray protein context (cartoon or surface), the pocket residues shown as sticks, and the ligand displayed prominently. Build these layers in order.

PyMOL command line
# Start clean
as cartoon
hide everything, resn HOH

# Select binding site residues (all within 5 Å of ligand)
select pocket, byres (LIG around 5)

# Show pocket residues as sticks
show sticks, pocket

# Color protein context neutral gray
color gray70, polymer

# Show ligand prominently
show sticks, LIG

# Optional: surface of binding pocket only
show surface, pocket
set transparency, 0.4
color white, pocket   # white surface lets colored sticks show through

# Zoom in on the binding site
zoom LIG, 5           # zoom to 5 Å buffer around ligand
Adjust the 5 Å cutoff to your binding site
The 5 Å cutoff for pocket selection is a starting point. For a small ligand in a tight pocket, 4 Å may show fewer but more directly interacting residues. For a large ligand or shallow groove binder, 6–7 Å captures the full binding environment. Choose the radius that shows the interactions you’re discussing without cluttering the figure with distant residues.

Coloring the ligand

Ligand coloring is one of the most important visual choices in a binding site figure. The standard is CPK colors with a carbon color that contrasts the protein. Green carbons are the universal convention for ligands in structural biology publications:

PyMOL command line
# Standard: green carbons, CPK for all other atoms
util.cbag LIG

# Alternative carbon colors (when showing multiple ligands)
util.cbac LIG   # cyan carbons — good for second molecule
util.cbay LIG   # yellow carbons
util.cbam LIG   # magenta carbons

# Color protein binding site residues differently from context
color gray70, polymer           # neutral gray for whole protein
color slate, pocket             # slightly blue for pocket residues
util.cbag LIG                   # green carbons for ligand

# Make ligand slightly larger sticks to distinguish from protein
set stick_radius, 0.25, LIG     # default 0.25, protein sticks thinner
set stick_radius, 0.15, pocket  # thinner protein sticks

Displaying H-bonds

Hydrogen bonds are the most important interactions to show in a binding site figure. PyMOL’s distance command with mode=2 identifies H-bonds automatically by checking donor–acceptor geometry and distance.

PyMOL command line
# Show all H-bonds between ligand and protein
distance hbonds, LIG, pocket, mode=2

# mode=2 uses PyMOL's built-in H-bond detection
# Shows dashed lines between H-bond donor/acceptor pairs

# Color H-bond lines
color yellow, hbonds   # yellow is the most common publication color for H-bonds
color cyan,   hbonds   # cyan is also widely used and visible on gray backgrounds

# Hide the distance labels if you're annotating manually
hide labels, hbonds

# Show labels (distance in Ångströms) — include in figure
show labels, hbonds
set label_size, 12
set label_color, black
PyMOL H-bond detection is approximate
PyMOL’s mode=2 H-bond detection uses a simple geometric criterion — it does not account for hydrogen atom positions (which may not be present in the PDB file) or electronic structure. Use it as a starting point. For a publication, verify all H-bonds manually by checking donor-acceptor distances and angles, or use PLIP (Protein-Ligand Interaction Profiler, accessible at plip-tool.org) for more accurate interaction detection and comparison.

Hydrophobic and van der Waals contacts

Hydrophobic contacts don’t have the same clear geometric signature as H-bonds — they’re simply close contacts between non-polar atoms. PyMOL can show them as distance lines with a wider cutoff:

PyMOL command line
# All contacts within 4 Å (captures both H-bonds and close contacts)
distance contacts_4A, LIG, pocket, 4.0

# Show only hydrophobic contacts (C-C interactions, exclude N, O, S)
select lig_carbon, LIG and elem C
select pock_carbon, pocket and elem C
distance hydrophobic, lig_carbon, pock_carbon, 4.5

# Color hydrophobic contacts differently from H-bonds
color gray60, hydrophobic

# Alternative: show hydrophobic surface coloring instead of distance lines
spectrum hydrophobicity, white_orange, pocket

# Alternatively, just visually show which residues line the hydrophobic pocket
select hydrophobic_residues, pocket and resn PHE+LEU+ILE+VAL+MET+TRP+ALA+PRO
color tv_orange, hydrophobic_residues
Avoid cluttering with too many distance lines
A figure with H-bond lines, hydrophobic contact lines, and π-stacking lines simultaneously becomes unreadable. For most publications, show H-bonds as dashed lines and communicate hydrophobic contacts through residue coloring (orange = hydrophobic) rather than additional distance objects. Reserve explicit distance lines for the two or three most important contacts you’re discussing in the text.

Distance measurements

For specific interactions you want to quantify — catalytic distances, key H-bond lengths, metal coordination bonds — the distance command creates labeled lines showing the exact distance in ångströms.

PyMOL command line
# Measure distance between specific atoms
# Full atom identifier: /object//chain/resname`resi/atom_name
distance d1, /4XYZ//A/LIG`401/O3, /4XYZ//A/SER`185/OG

# Simpler: click two atoms in the viewer (Measurement Wizard)
# Wizard → Measurement → then click two atoms

# Or use the distance command with selection expressions
distance d_key, (resn LIG and name O3), (resi 185 and name OG and chain A)

# Styling distance objects for publication
set dash_gap,    0.4    # gap between dashes (default 0.4)
set dash_length, 0.2    # length of each dash
set dash_width,  2.0    # line thickness
set label_size,  14     # distance label font size

# Show distances without labels (for cleaner figures annotated elsewhere)
hide labels
mode= valueWhat it detects
mode=0 (default)All atom pairs within the cutoff distance — shows every contact
mode=1Contacts between different residues (excludes within-residue bonds)
mode=2H-bond geometry check (donor-acceptor pairs, correct angles)
mode=3Saltbridge detection (charged atoms only)
mode=4Covalent bonds (for showing explicit bond connections)

2D interaction diagrams

PyMOL produces excellent 3D binding site figures but cannot generate 2D interaction diagrams — the schematic “ligand map” views showing all interactions as labeled arrows and symbols that are standard in medicinal chemistry papers. These require dedicated tools:

  • PLIP
    plip-tool.org — free web server that detects and reports all non-covalent interactions from a PDB or uploaded file. Also generates a PyMOL visualization script you can load directly. Best free option for interaction analysis.
  • LigPlot+
    ebi.ac.uk/thornton-srv/software/LigPlus — generates the classic 2D schematic diagrams of protein-ligand interactions. Free for academic use. Output is a clean 2D diagram suitable for supplementary figures.
  • Maestro / Glide
    Schrödinger’s commercial suite. Industry standard for interaction visualization in drug discovery. Beautiful 2D and 3D interaction figures. Academic license available through the PyMOL educational license.
  • ProteinsPlus
    proteins.plus — web-based platform that includes PoseView for 2D ligand interaction diagrams. Free, no registration required.

The standard workflow in a structural biology or drug discovery paper is to use PyMOL for the 3D figure panel and one of the above tools for a 2D schematic in the same figure or supplementary information.

Complete publication figure workflow

binding_site_figure.pml — complete publication-ready script
Adapt resn LIG, residue numbers, and chain identifiers to your structure
# ── Load and clean ──────────────────────────────────
fetch 4XYZ
remove resn HOH
remove resn SO4+PEG+GOL

# ── Define selections ───────────────────────────────
select LIG,    resn LIG
select pocket, byres (LIG around 5)

# ── Representations ─────────────────────────────────
as cartoon
hide cartoon, pocket or LIG
show sticks, pocket
show sticks, LIG

# ── Colors ──────────────────────────────────────────
color gray70,  polymer        # neutral protein context
color slate,   pocket         # slightly blue pocket residues
util.cbag LIG                 # green carbons, CPK for ligand
set stick_radius, 0.15, pocket
set stick_radius, 0.25, LIG

# ── H-bonds ─────────────────────────────────────────
distance hbonds, LIG, pocket, mode=2
color yellow, hbonds
hide labels, hbonds           # annotate manually in figure legend

# ── Key distances (add your specific atoms here) ────
distance d1, (resn LIG and name O3), (resi 185 and name OG and chain A)
color cyan, d1
set label_size, 13

# ── Optional: binding site surface ──────────────────
show surface, pocket
set transparency, 0.5
color white, pocket

# ── Figure settings ─────────────────────────────────
bg_color white
set ray_opaque_background, 1
set cartoon_fancy_helices, 1
set ambient, 0.40
set specular, 0.25
set light_count, 4
set ray_shadow, 1
set antialias, 2

# ── Orient (paste your get_view output here) ────────
zoom LIG, 5

# ── Export ──────────────────────────────────────────
png binding_site.png, width=1200, height=900, dpi=300, ray=1

Protein-ligand visualization in one paragraph

The standard binding site figure uses three layers: gray cartoon protein context, slate-colored pocket residues as sticks, and a CPK-colored ligand with green carbons. Add H-bonds with distance hbonds, LIG, pocket, mode=2 and color them yellow. For specific key distances, use individual distance commands between named atoms. Keep hydrophobic contacts as residue coloring rather than distance lines — too many lines obscure the binding mode rather than clarifying it. For 2D schematic diagrams, use PLIP or LigPlot+ alongside your 3D PyMOL figure. Save everything as a .pml script so the figure can be regenerated after reviewer requests.

Last updated on

Similar Posts

Leave a Reply

Your email address will not be published. Required fields are marked *