[−][src]Function dihedral::dihedral
pub fn dihedral([a, b, c, d]: &[[f64; 3]; 4]) -> f64
Calculates the dihedral angle, in the range -π to π, of the four ordered coordinates.
This is in accordance with the definition of dihedral angle in biochemistry textbooks.
Examples
use dihedral::dihedral; let P0 = [24.969, 13.428, 30.692]; // N let P1 = [24.044, 12.661, 29.808]; // CA let P2 = [22.785, 13.482, 29.543]; // C let P3 = [21.951, 13.670, 30.431]; // O let P4 = [23.672, 11.328, 30.466]; // CB let P5 = [22.881, 10.326, 29.620]; // CG let P6 = [23.691, 9.935, 28.389]; // CD1 let P7 = [22.557, 9.096, 30.459]; // CD2 assert!((dihedral(&[P0, P1, P2, P3]).to_degrees() - (-71.21515)).abs() < 1E-2); assert!((dihedral(&[P0, P1, P4, P5]).to_degrees() - (-171.94319)).abs() < 1E-2); assert!((dihedral(&[P1, P4, P5, P6]).to_degrees() - (60.82226)).abs() < 1E-2); assert!((dihedral(&[P1, P4, P5, P7]).to_degrees() - (-177.63641)).abs() < 1E-2);