Skip to main content
← OpenMECP Documentation

calculate_dihedral

Function calculate_dihedral 

Source
pub fn calculate_dihedral(
    geometry: &Geometry,
    a1: usize,
    a2: usize,
    a3: usize,
    a4: usize,
) -> f64
Expand description

Calculate the dihedral angle between four atoms in radians.

The dihedral angle is computed using the atan2 method for proper sign. The angle is in the range (-π, π].

§Arguments

  • geometry - The molecular geometry containing atomic positions.
  • a1 - Index of the first atom (0-based).
  • a2 - Index of the second atom.
  • a3 - Index of the third atom.
  • a4 - Index of the fourth atom.

§Returns

The dihedral angle in radians. Returns 0.0 for degenerate cases.