If I have three x,y,z coordinates for protein backbone (N-Ca-C-N-Ca-C....) as such:
N -14.152 0.961 4.712
CA -13.296 0.028 3.924
C -11.822 0.338 4.193
N -11.121 -0.642 4.703
CA -9.669 -0.447 4.998
C -8.861 -1.586 4.373
how can I calculate the "bond angles" (Ni-Cai-Ci, Cai-Ci-Ni+1, Ci-Ni+1-CAi+1)?
Basic vector geometry. The dot-product of two normalized vectors is the cosine of the angle between them.
F'rinstance:
N -14.152 0.961 4.712
CA -13.296 0.028 3.924
C -11.822 0.338 4.193
(N-Ca) = (-14.152 0.961 4.712) - (-13.296 0.028 3.924) = (-0.856, 0.933, 0.778)
normalized: (-0.576, 0.628, 0.524)
(C-Ca) = (-11.822 0.338 4.193) - (-13.296 0.028 3.924) = ( 1.474, 0.310, 0.269)
normalized: (0.963, 0.203, 0.176)
dot-product: (-0.576, 0.628, 0.524) x (0.963, 0.203, 0.176) = -0.335
angle = acos(-0.335) = 109.57 degrees