Commit 9b241008 by Chloe Dequeker

HEX rotation matrix

parent 6d203d08
...@@ -72,9 +72,9 @@ struct pdb_values* rotate_HEX(struct pdb_values* pdb, struct pdb_values* pdbR, s ...@@ -72,9 +72,9 @@ struct pdb_values* rotate_HEX(struct pdb_values* pdb, struct pdb_values* pdbR, s
for(i=0;i<pdb->nbRes;i++){ for(i=0;i<pdb->nbRes;i++){
for(j=0;j<pdb->residues[i].nbAtom;j++){ for(j=0;j<pdb->residues[i].nbAtom;j++){
xi = pdb->residues[i].x[j] - pdb->centerX; xi = pdb->residues[i].x[j]; // - pdb->centerX;
yi = pdb->residues[i].y[j] - pdb->centerY; yi = pdb->residues[i].y[j]; // - pdb->centerY;
zi = pdb->residues[i].z[j] - pdb->centerZ; zi = pdb->residues[i].z[j]; // - pdb->centerZ;
/* alpha rotation of the residue */ /* alpha rotation of the residue */
...@@ -93,12 +93,16 @@ struct pdb_values* rotate_HEX(struct pdb_values* pdb, struct pdb_values* pdbR, s ...@@ -93,12 +93,16 @@ struct pdb_values* rotate_HEX(struct pdb_values* pdb, struct pdb_values* pdbR, s
z3i = (xZ*zZ*(1.0-c_g)-yZ*s_g)*x2i + (yZ*zZ*(1.0-c_g)+xZ*s_g)*y2i + (zZ*zZ+(1.0-zZ*zZ)*c_g) *z2i; z3i = (xZ*zZ*(1.0-c_g)-yZ*s_g)*x2i + (yZ*zZ*(1.0-c_g)+xZ*s_g)*y2i + (zZ*zZ+(1.0-zZ*zZ)*c_g) *z2i;
x3i = (c_a*c_b*c_g-s_a*s_g) * xi + (-c_a*c_b*s_g-s_a*c_g) * yi + (c_a*s_b) * zi;
y3i = (c_a*s_g+s_a*c_b*c_g) * xi + (-s_a*c_b*s_g+c_a*c_g) * yi + (s_a*s_b) * zi;
z3i = (-s_b*c_g) * xi + (s_b*s_g) * yi + (c_b) * zi;
/* Now the residue has been rotated, and we need to translate it /* Now the residue has been rotated, and we need to translate it
* to its final destination * to its final destination
*/ */
newPDB->residues[i].x[j] = x3i + newX; newPDB->residues[i].x[j] = x3i + trans_X;
newPDB->residues[i].y[j] = y3i + newY; newPDB->residues[i].y[j] = y3i + trans_Y;
newPDB->residues[i].z[j] = z3i + newZ; newPDB->residues[i].z[j] = z3i + trans_Z;
/* We also translate the coordinates of the first and fifth CA, even /* We also translate the coordinates of the first and fifth CA, even
* though they are not used afterwards. This is for the sake of * though they are not used afterwards. This is for the sake of
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment