TM-align Tutorial: Compare Protein Structures by TM-score
Skip to content

TM-align Tutorial: Compare Protein Structures by TM-score

TM-align Tutorial: Compare Protein Structures by TM-score

TM-align is a free structural alignment program from the Zhang group that superimposes two protein structures, even with different sequences, and reports a TM-score between 0 and 1. Scores below 0.2 correspond to randomly chosen unrelated proteins and scores above 0.5 generally mean the same fold in SCOP/CATH. You compile one C++ file and run TMalign model.pdb native.pdb.

This tutorial shows how to install TM-align, run it on a predicted model and an experimental structure, read every line of its output, choose the right one of its two TM-scores, and decide when to use the separate TM-score program or US-align instead. It is written by the StemSkills Lab team, who have more than ten years of experience in structural bioinformatics, homology modelling and drug design.

What is TM-score and why is it better than RMSD?

RMSD averages the distance between matched atoms after superposition. Because the distances are squared, a few badly placed residues (a floppy terminus, one wrong loop) can dominate the number. A model with a correct core and one misplaced tail can get a worse RMSD than a model that is slightly wrong everywhere. RMSD also grows with protein length, so 3 Å on 60 residues and 3 Å on 600 residues do not mean the same thing.

TM-score, introduced in Zhang and Skolnick, Proteins 57:702-710 (2004), fixes both problems. Each aligned residue pair contributes 1/(1 + (di/d0)2), so a pair that is far apart contributes close to zero instead of inflating the score. The distance scale d0 depends on length, d0 = 1.24 ∛(L − 15) − 1.8, which makes the score comparable across proteins of different sizes. The sum is divided by the length of the reference structure, giving a value in (0, 1], where 1 is a perfect match.

The interpretation scale comes from the official TM-align page: “scores below 0.2 correspond to randomly chosen unrelated proteins”, while scores higher than 0.5 “assume generally the same fold in SCOP/CATH”. Those two numbers are the defensible thresholds to quote in a thesis. Do not invent finer bands.

What is the difference between TM-align, the TM-score program and US-align?

The Zhang group distributes three related tools, and students mix them up constantly.

ToolHow residues are matchedUse it forCitation
TM-alignFinds its own sequence-independent structural alignmentTwo proteins with different sequences, or a model vs a homologous templateZhang and Skolnick, NAR 33:2302-2309 (2005)
TM-score programUses the residue numbering already in the filesA model and the native structure of the same sequenceZhang and Skolnick, Proteins 57:702-710 (2004)
US-alignStructural alignment, extended to complexes and nucleic acidsMulti-chain complexes, RNA/DNA, oligomersZhang et al., Nature Methods 19:1109-1115 (2022)
PyMOL align / super / cealignSequence-based or structure-based superpositionQuick visual overlays and figuresPyMOL documentation

In the words of the TM-score page, the program “is usually NOT applied to compare two proteins of different sequences”. For those, use TM-align. Because TM-align optimises its own alignment, it usually reports a higher TM-score than the TM-score program for the same pair, so do not mix numbers from the two tools in one table.

How do you install TM-align?

TM-align is a single C++ source file. Download TMalign.cpp from the official page and compile it with the command from the readme:

g++ -static -O3 -ffast-math -lm -o TMalign TMalign.cpp

On macOS, remove -static, because the readme notes macOS does not support static executables:

g++ -O3 -ffast-math -lm -o TMalign TMalign.cpp

On Windows, the simplest route is WSL (Ubuntu) with sudo apt install g++, then the Linux command. Check the build with ./TMalign -v, which prints the version, and ./TMalign -h for the full option list.

How do you compare a predicted model with an experimental structure?

Suppose you built a model with AlphaFold, SWISS-MODEL or I-TASSER and an experimental structure of the same protein exists in the PDB.

  1. Prepare one chain per file. Download the experimental entry from RCSB, keep only the chain you want, and save it as native.pdb. Do the same for your model as model.pdb. One chain per file avoids the most common input surprise (see troubleshooting).
  2. Run the alignment:
    ./TMalign model.pdb native.pdb
  3. Save the superposition if you want a figure:
    ./TMalign model.pdb native.pdb -o TM_sup

    The -o option writes the superposition to files starting with TM_sup, which you can open in PyMOL.

  4. Save the rotation matrix if you need to apply the same transformation to other files:
    ./TMalign model.pdb native.pdb -m matrix.txt

If both files have identical residue numbering (for example, an AlphaFold model and the crystal structure of exactly the same construct), also run the TM-score program, which compares by residue index without realigning. Report which program produced each number.

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 TM-align output?

The default output has a fixed set of lines. These labels are taken from the program’s own output code (values shown as placeholders):

  • Name of Chain_1: model.pdb (to be superimposed onto Chain_2) and Name of Chain_2: native.pdb. The first file is moved onto the second.
  • Length of Chain_1: N residues and Length of Chain_2: N residues. Check these first. If a length is far from what you expect, the program read the wrong chain or a truncated file.
  • Aligned length= N, RMSD= x.xx, Seq_ID=n_identical/n_aligned= x.xxx. The number of residue pairs in the structural alignment, the RMSD over those pairs only, and the sequence identity within the alignment.
  • TM-score= x.xxxxx (if normalized by length of Chain_1, i.e., LN=..., d0=...)
  • TM-score= x.xxxxx (if normalized by length of Chain_2, i.e., LN=..., d0=...)
  • An alignment block of three lines: sequence of Chain_1, a marker line, sequence of Chain_2. In the marker line, : denotes residue pairs closer than 5.0 Å and . denotes other aligned residues.

Which of the two TM-scores should you report?

The program prints the answer itself: “You should use TM-score normalized by length of the reference structure”. When you evaluate a model against an experimental structure, the experimental structure is the reference. With the command order above (model.pdb native.pdb), that is the Chain_2 line.

The two scores differ when the lengths differ. A 120-residue model of a 300-residue protein can score well when normalised by its own length (most of the model matches) and poorly when normalised by the full protein (most of the protein is missing). Both are true, and the one you report must match your question. If neither structure is the reference, the -a T option normalises by the average length of the two.

Why is the RMSD in the output so different from PyMOL?

TM-align’s RMSD is calculated only over its own aligned residues, and the alignment is chosen to maximise TM-score, not to minimise RMSD. PyMOL’s align starts from a sequence alignment and rejects outliers during refinement. They answer different questions, so quote one method consistently and name it. Our PyMOL superposition guide explains its three commands.

How do you use TM-score in a homology modelling or AlphaFold project?

Three common uses in a student project:

  • Benchmarking your pipeline. Model a protein whose structure is already known, hide the structure, then score your model against it. This shows reviewers your method works before you apply it to an unsolved target.
  • Comparing models. Score several candidate models against one experimental structure, or against each other, to see whether they agree on the fold. Pair this with the model-quality checks in our structure validation guide, because TM-score measures similarity, not physical quality.
  • Checking a refined model. After refining a homology model, score the refined model against the starting model to confirm refinement did not change the fold.

For AlphaFold models, read the pLDDT first. A low-confidence region will lower TM-score, and that is the model telling you the truth. See how to interpret pLDDT and PAE.

Why does TM-align give a strange result, and how do you fix it?

  • Only part of a multi-chain file was read. If Length of Chain_1 is much shorter than the full complex, TM-align read just one chain. Split the file so each contains the chain you mean, or see the -ter and -split options in ./TMalign -h. For whole complexes, use US-align.
  • Modified residues missing from the alignment. TM-align aligns ATOM records. Residues written as HETATM, such as selenomethionine (MSE), are skipped unless you use the -het option.
  • Different TM-score from a server or a paper. Check the normalisation. A paper may report the score normalised by the average length (-a T) or by a user-assigned length (-u). The readme notes that options -u, -a, -d and -o do not change the final structural alignment, only how it is scored and reported.
  • -static build error on macOS. Remove -static from the compile command.
  • Same-sequence model scores lower in the TM-score program than in TM-align. Expected. The TM-score program keeps your residue correspondence, while TM-align is free to find a better one.
  • Circularly permuted proteins align badly. Try -cp, which allows alignment with circular permutation.

What should you write in your methods section?

Name the program and version (from ./TMalign -v), the input files, which structure was the reference, the normalisation you reported, and the citation. For example: “Model accuracy was assessed with TM-align (Zhang and Skolnick, 2005); TM-scores are normalised by the length of the experimental structure, and values above 0.5 were taken to indicate the same fold.” For where this fits in a full project, see the computational biology skills roadmap.

Frequently asked questions

What is a good TM-score?

Above 0.5 generally means the two structures share the same fold in SCOP/CATH. Below 0.2 corresponds to randomly chosen unrelated proteins. The official page gives no other thresholds, so avoid claiming finer categories.

Is TM-align free?

Yes. The C++ source is downloadable from zhanggroup.org and compiles with a single g++ command on Linux, macOS or WSL on Windows.

Can TM-align compare proteins with different sequences?

Yes. That is its main purpose. It builds a structural alignment without relying on sequence, which is why it works for remote homologs and for a model against a template.

Should I use TM-align or the TM-score program for an AlphaFold model?

If the model and the experimental structure have exactly the same sequence and numbering, the TM-score program is the stricter comparison. If they differ in sequence, construct boundaries or numbering, use TM-align. Report which one you used.

Why does TM-align print two TM-scores?

The first is normalised by the length of the first structure and the second by the length of the second. Report the one normalised by the reference structure.

Can TM-align handle protein complexes?

It is built for single chains. For multi-chain complexes and nucleic acids, use US-align from the same group.

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) →

Think you know Protein Structure Prediction?
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

CABS-flex 3.0 Tutorial: Protein RMSF Without GROMACS Run a free CABS-flex 3.0 job, pick the right flexibility mode, read the RMSF plot and 10 models,… Periodic Image Check in GROMACS: gmx mindist -pi Prove your protein never touched its own periodic image: run gmx mindist -pi, read the xvg against your… mdpocket Tutorial: Pocket Volume Over a GROMACS Trajectory Check if your binding pocket stayed open during MD: prepare a fitted GROMACS trajectory, run mdpocket twice and…
See live workshops