How to Align and Superimpose Two Protein Structures in PyMOL (align, super and cealign): A Step-by-Step Guide - StemSkills Lab
Skip to content

How to Align and Superimpose Two Protein Structures in PyMOL (align, super and cealign): A Step-by-Step Guide

How to Align and Superimpose Two Protein Structures in PyMOL (align, super and cealign): A Step-by-Step Guide

To superimpose two proteins in PyMOL, load both structures, then run one command: align for near-identical sequences, super for moderately different sequences, or cealign for different folds and very low sequence identity. Each moves the first (mobile) object onto the second (target) and prints the RMSD and the number of atoms it fitted.

You predicted a structure with AlphaFold or built a homology model, and now you need to know how close it is to the experimental structure. PyMOL gives you three superposition commands, and picking the wrong one is the difference between a clean overlay and a confusing error or an inflated RMSD. This guide from the StemSkills Lab team shows you exactly which command to run, how to read the numbers PyMOL reports, and how to fix the two errors that trip up almost every beginner.

What is the difference between align, super and cealign in PyMOL?

All three commands rotate and translate one structure onto another so you can compare them, but they differ in how they decide which atoms correspond. align starts from a sequence alignment, super and cealign work from the 3D structure and ignore sequence. That single distinction decides which one you should use.

PyMOL’s own documentation describes align as performing “a sequence alignment followed by a structural superposition,” then running refinement cycles that reject the atom pairs fitting worst. Because it begins with sequence, align is most accurate when the two proteins are the same or nearly the same protein. super uses a sequence-independent, structure-based algorithm, so it still works when the sequences have drifted apart. cealign implements the Combinatorial Extension (CE) algorithm of Shindyalov and Bourne, which was designed to align proteins that share a fold but almost no sequence identity.

CommandWorks fromBest whenRejects outliers?Argument order
alignSequence, then structureSame protein or >~30% sequence identityYes (5 cycles, 2.0 Å cutoff by default)mobile, target
superStructure (sequence-independent)Moderate identity, sequences have divergedYesmobile, target
cealignStructure (CE algorithm)Low identity, different or distant foldsNo refinement cycles by defaulttarget, mobile

Notice the last column. align and super take the moving object first, but cealign takes the target first. Swapping this order is one of the most common beginner mistakes, and we return to it in the troubleshooting section.

How do you superimpose two proteins in PyMOL step by step?

Here is a complete, reproducible worked example using two crystal structures of hen egg-white lysozyme, which share an essentially identical sequence, so align is the right choice. Type each line into the PyMOL command bar (the black box at the top of the viewer).

  1. Fetch both structures straight from the RCSB Protein Data Bank:
    • fetch 6lyz, async=0
    • fetch 1lyz, async=0
  2. Superimpose the first onto the second: align 6lyz, 1lyz
  3. Read the RMSD that PyMOL prints to the log (covered in the next section).
  4. Tidy the view so the overlap is obvious: hide everything then show cartoon.

The async=0 flag tells PyMOL to finish downloading before running the next line, which matters when you paste several commands at once. After align, the mobile object 6lyz has been physically moved on top of 1lyz; the coordinates of 1lyz never change.

When you want to compare an AlphaFold model against a crystal structure, download the model from the AlphaFold Protein Structure Database and load the file, for example load AF-P00698-F1-model_v4.pdb, af_lysozyme. Because a predicted model can differ from the crystal in flexible loops, reach for super or cealign rather than align:

  • super af_lysozyme, 6lyz (mobile first), or
  • cealign 6lyz, af_lysozyme (target first).

Want the guided, hands-on version?

Our live Molecular Modeling & MD Simulations cohort bootcamp takes you from zero to running real docking and MD workflows, with a portfolio project for your grad-school applications.

Join the waitlist (free) →

How do you read the RMSD and atom count PyMOL reports?

After any of the three commands, PyMOL writes an Executive line to the log, in the form Executive: RMSD = <value> (<n> to <n> atoms). The value is the root-mean-square deviation in ångströms between the paired atoms, and the atom count tells you how many pairs were actually used in the final fit. Both numbers matter: a small RMSD over a handful of atoms is not the same as a small RMSD over the whole chain.

The align command also returns a seven-value list you can capture in a script: the RMSD after refinement, the number of aligned atoms after refinement, the number of refinement cycles, the RMSD before refinement, the number of aligned atoms before refinement, the raw alignment score, and the number of aligned residues. Comparing the “before” and “after” RMSD shows you how much work the outlier rejection did. cealign instead returns a dictionary containing RMSD and alignment_length, so in a script you would read result['RMSD'].

As a rough guide, two structures of the same protein usually superpose below 1 Å, and proteins sharing a fold typically fall within a few ångströms. If your RMSD is far higher than expected, do not assume the model is wrong. First check that the atom count is sensible and that you compared the chains you intended. That check is exactly what the troubleshooting section covers.

Which command should you use when the sequences differ?

Match the command to how similar the two sequences are. Above roughly 30% sequence identity, a sequence alignment is reliable, so align gives the cleanest result. Below that level you enter what structural biologists call the “twilight zone,” where sequence alignment becomes unreliable, and a structure-based method wins. Use super for the middle ground and cealign when identity is very low or when you are comparing different folds entirely.

A practical workflow: try align first. If it reports “0 atoms aligned” or a suspiciously high RMSD, switch to super. If super still struggles, use cealign, which copes best with distant relationships because the CE algorithm builds the alignment from local structural fragments rather than from sequence at all.

How do you colour and save the superposed structures?

Once the two objects overlap, colour them distinctly so the differences read at a glance, then export. A typical finishing sequence:

  • color cyan, 6lyz and color salmon, 1lyz to give each structure its own colour.
  • show cartoon and hide lines for a clean ribbon view.
  • orient to centre and zoom on both objects.
  • ray 1200, 900 then png superposition.png, dpi=300 to save a publication-quality image.
  • save superposed.pse to keep the full session, or save moved_6lyz.pdb, 6lyz to export the moved coordinates for downstream docking or MD.

Saving the moved object as a fresh PDB is important when the superposition is a preparation step, for example placing a predicted model into the same frame of reference as a known complex before you set up a computational biology skills roadmap project such as docking or a simulation.

How do you fix common PyMOL alignment errors?

“ExecutiveAlign: 0 atoms aligned” or “RMSD = 0.000 over 0 atoms.” This almost always means PyMOL found no atom pairs to fit. The usual causes and fixes:

  • Wrong object names. Run get_names to list the exact loaded object names and use those. A typo produces zero atoms.
  • Sequences too different for align. If a sequence alignment finds nothing to match, switch to super or cealign, which do not rely on sequence.
  • Selections that do not overlap. If you aligned specific selections such as chain A against chain B, confirm both selections contain atoms with count_atoms.
  • Wrong argument order for cealign. Remember cealign is cealign target, mobile, the reverse of align and super. Passing them in align order can give confusing results.

RMSD looks far too high. A large RMSD usually means the fit included pairs it should not have, or you compared the wrong parts of the two proteins:

  • Compare like with like. Restrict the fit to matching chains, for example align 6lyz and chain A, 1lyz and chain A.
  • Multi-state objects. An NMR ensemble or a trajectory has many states. Fit a single state with the mobile_state and target_state arguments so PyMOL does not average across models.
  • Let the refinement work. With align, the default 5 cycles and 2.0 Å cutoff reject outliers; if you set cycles=0 you keep every pair, which inflates the RMSD. Restore the default cycles, or move to cealign, whose CE approach is less sensitive to flexible regions.
  • Backbone versus all atoms. Long flexible side chains and disordered loops raise the number. Superpose on the C-alpha backbone when you only care about the fold.

Does align move both structures or just one? Only the first (mobile) object moves. The target keeps its original coordinates, which is why you should pass the structure you want to keep fixed as the second argument.

Can I superimpose more than two structures at once? Not with a single align call. Superpose each structure onto one common reference in turn, or script a loop that aligns every object to the reference.

FAQ

Is align or super better for an AlphaFold model versus a crystal structure? Use super or cealign. AlphaFold models often differ from the crystal in flexible loops and termini, and the sequence-independent methods handle those differences more gracefully than the sequence-first align.

What RMSD counts as a good superposition? There is no universal cutoff, but two structures of the same protein commonly fall below 1 Å, and proteins with the same fold usually land within a few ångströms. Always read the RMSD together with the atom count, because a low RMSD over very few atoms is not meaningful.

Why does cealign use a different argument order? It is simply how the command was written: cealign target, mobile. Keep a note of it, because mixing it up with the align and super order (mobile first) is the most frequent cause of a puzzling result.

Do I need the same number of residues in both proteins? No. All three commands align only the residues that correspond, so proteins of different lengths superpose fine. The reported atom count tells you how many were actually matched.

How do I superpose only the binding site instead of the whole protein? Pass selections to the command, for example super modelA and resi 40-95, ref and resi 40-95. Restricting the fit to the region you care about often gives a more meaningful RMSD than fitting the entire chain.

Superposition is the first move in almost every structural comparison, from validating a predicted model to setting up a docking run. For the full learning path from structure basics through docking and molecular dynamics, see the StemSkills Lab computational biology skills roadmap.

Want the guided, hands-on version?

Our live Molecular Modeling & MD Simulations cohort bootcamp takes you from zero to running real docking and MD workflows, with a portfolio project for your grad-school applications.

Join the waitlist (free) →

Written by the StemSkills Lab team, with more than 10 years of combined experience in sequence and structural bioinformatics, drug discovery and design, and multiscale molecular modeling. Command references follow the official PyMOL documentation; the CE method behind cealign is described in Shindyalov & Bourne, “Protein structure alignment by incremental combinatorial extension (CE) of the optimal path,” Protein Engineering (1998) 11(9):739-747.

Think you know Molecular Dynamics (GROMACS)?
Take the free StemSkills assessment and earn a verifiable certificate you can download and add to your LinkedIn profile.
Start the free assessment

Keep going

AutoDock Vina Errors and How to Fix Them: The 10 That Stop Beginners Decode the 10 AutoDock Vina errors that stop beginners, from PDBQT parsing failures to grid box mistakes, with… How to Predict a Protein-Protein Complex with AlphaFold-Multimer in ColabFold (Step by Step) Learn how to model a protein-protein complex free in ColabFold, set the chain break correctly, and judge ipTM,… Discovery Studio Visualizer Tutorial: How to Analyse Docking Results and Make 2D Interaction Diagrams Load your docked pose, list every contact with its distance, and export the 2D interaction diagram your thesis…
See live workshops