How do I calculate my RMSD(root mean square deviation) score for my PDB protein structures, atom by atom.
I wish to calculate it line by line. But I do not know how to go about it? I was thinking of using a for loop but as you can see, I've got too many for loops.
Pls advice..
PS: I'm reading my file from a text file and extracting my coordinates from it.
//------------------------------Translation-------------------------------------
for(int a=0; a<coordinates1.length; a++) {
for(int b=0; b<3; b++){
for(int c=0; c<3; c++){
X = coordinates1[1][0]/coordinates2[1][0];
Y = coordinates1[1][1]/coordinates2[1][1];
Z = coordinates1[1][2]/coordinates2[1][2];
double [][] Translation1={ {X,0.0,0.0}, {0.0,Y,0.0}, {0.0,0.0,Z} };
coordinates2T[a][b] = coordinates2[a][c]*Translation1[c][b];
//-------------------------Rotation & RMSD Cal----------------------------------
//Uses Leohard Euler's angle of rotation theorem
//5 degrees in rad.
double [][] Rotz={ {Math.cos(0.087266463), Math.sin(-0.087266463), 0.0},
{Math.sin(0.087266463), Math.cos(0.087266463), 0.0},
{0.0, 0.0 , 1.0} };
double [][] RotX={ {1.0,0.0,0.0},
{0.0,Math.cos(0.087266463), Math.sin(-0.087266463)},
{0.0,Math.sin(0.087266463), Math.cos(0.087266463)} };
double [][] RotZ={ {Math.cos(0.087266463), Math.sin(0.087266463), 0.0},
{Math.sin(-0.087266463), Math.cos(0.087266463), 0.0},
{0.0, 0.0 , 1.0} };
coordinatesRotz[a][b]= coordinates2T[a][c]*Rotz[c][b];
coordinatesRotX[a][b]= coordinatesRotz[a][c]*RotX[c][b];
coordinatesRotZ[a][b]= coordinatesRotX[a][c]*RotZ[c][b];
for(a=0; a<coordinates1.length; a++){
R1 =Math.sqrt((Math.pow((coordinates1[a][0]-coordinatesRotZ[a][0]),2)
+Math.pow((coordinates1[a][1]-coordinatesRotZ[a][1]),2)
+Math.pow((coordinates1[a][2]-coordinatesRotZ[a][2]),2)));
}
if( R1!= 0.0)
System.out.println("R1="+fmt.format(R1));
}
}
}
}// end of main
}