Skip to main content
← OpenMECP Documentation

calculate_dihedral_gradient

Function calculate_dihedral_gradient 

Source
pub fn calculate_dihedral_gradient(
    geometry: &Geometry,
    a1: usize,
    a2: usize,
    a3: usize,
    a4: usize,
) -> ([f64; 3], [f64; 3], [f64; 3], [f64; 3])
Expand description

Calculate the analytical gradient of a dihedral angle with respect to atomic coordinates.

This function computes the partial derivatives of the dihedral angle φ with respect to the coordinates of all four atoms involved. The gradients represent the force vectors that would most effectively change the dihedral angle.

Uses the formula from Grigoryan lab reference.

§Arguments

  • geometry - The molecular geometry
  • a1 - Index of first atom
  • a2 - Index of second atom
  • a3 - Index of third atom
  • a4 - Index of fourth atom

§Returns

A tuple of four 3D gradient vectors, one for each atom’s coordinates. Each gradient is in units of radians per unit distance.