# How can I calculate the distances between residues of a protein? [closed]

Suppose, we have a protein (16PK).

We are considering a 5-residue segment/window.

If we assume ASN10 to be the ith residue, how can I calculate the following distances?

1. from [i+2] to [i-2]
2. from [i+1] to [i-2]
3. from [i+2] to [i-1]

Next major question is, what would be the distances like if my segment/window is 7 or 9 residues long?

The distances are conventionally measured between the positions of the alpha carbon atoms. If you want to measure the distance between atom A and atom B and you have the cartesian coordinates, the formula to use is:

$$d_{ab} = \sqrt{(x_a - x_b)^2 + (y_a - y_b)^2 +(z_a - z_b)^2)}$$

Or you take a molecular viewer like Jmol and just double click on the two atoms like I did for the image above (source: https://chemistry.stackexchange.com/a/153941/72973).

What would be the coordinate of, say, ASN10

The coordinates are in the PDB or mmCIF file available at the protein database with ID 16PK. Here is an excerpt for residue 12 of

ATOM     42  N   ASN A  10      -6.289  22.085  22.571  1.00 10.68           N
ATOM     43  CA  ASN A  10      -6.723  21.626  23.891  1.00 10.11           C
ATOM     44  C   ASN A  10      -6.971  20.117  23.946  1.00 12.21           C
ATOM     45  O   ASN A  10      -7.019  19.530  25.037  1.00 13.56           O
ATOM     46  CB  ASN A  10      -8.004  22.345  24.328  1.00 10.44           C
ATOM     47  CG  ASN A  10      -7.753  23.720  24.925  1.00 11.90           C
ATOM     48  OD1 ASN A  10      -8.693  24.487  25.112  1.00 17.00           O
ATOM     49  ND2 ASN A  10      -6.516  24.028  25.261  1.00  7.01           N


The relevant coordinates are on the second line ("CA" in the third column) and have the values -6.723, 21.626, and 23.891.