RMSD calculation in AWK
The RMSD (root-mean-square deviation) is a common way to compare structures of biomolecules or solid bodies. The basic idea is a least square optimization to superimpose the models. The AWK script performs the optimal alignment and prints out the RMSD of two PDB files. The program can be used as follows:
./pdbalign.awk file1.pdb file2.pdb
The implementation of the RMSD is based on Coutsias et al, who presented a method based on quaternions to align rotations. The entire algorithm is based on first centering the structures to the center of geometry (COG), then performing a rotational alignment based on quaternions. To compute the eigenvectors the Householder transform is used to get a tridiagonal matrix and the QL decomposition is used to calculate the eigenvalues.
3. ReferencesCoutsias E.A., Seok C., Dill K.A., Using quaternions to calculate RMSD. J Comput Chem.(2004) 25(15):1849-1857.
Press W.H., Numerical Recipes in C: The Art of Scientific Computing. Cambridge University Press(1992).