[][src]Crate dihedral


crates.io crates.io crates.io

This crate provides functions for working with dihedral angles. Currently, there are two functions:

  • dihedral calculates the dihedral angle in the range -π to π in accordance with biochemistry textbooks (see also: https://en.wikipedia.org/wiki/Dihedral_angle#In_stereochemistry)
  • dihedral_unsigned ignores the direction of rotation and outputs the angle within the range 0 to π. This function is faster than the above signed version.

If you want to use f32 instead of f64 for calculation, you can add dihedral = {version = "*", features = ["f32"]} to your Cargo.toml.


  • https://math.stackexchange.com/a/47084
  • https://en.wikipedia.org/wiki/Dihedral_angle#In_stereochemistry



Calculates the dihedral angle, in the range -π to π, of the four ordered coordinates.


Calculates the unsigned dihedral angle, in the range 0 to π, of the four ordered coordinates