Skip to main content
← OpenMECP Documentation

get_average_spacing

Function get_average_spacing 

Source
fn get_average_spacing(path: &[Geometry]) -> f64
Expand description

Calculates the average spacing between consecutive images in a reaction path.

This function computes the mean distance between neighboring geometries along a reaction path. It’s used in NEB to determine the reference spacing for spring force calculations and to assess path quality.

§Mathematical Definition

Average spacing is calculated as:

d_avg = (1/(n-1)) × Σᵢ₌₁ⁿ⁻¹ RMSD(Rᵢ₊₁, Rᵢ)

where:

  • n is the number of images in the path
  • RMSD(Rᵢ₊₁, Rᵢ) is the distance between consecutive images
  • The sum is over all adjacent image pairs

§Arguments

  • path - Array of geometries representing the reaction path

§Returns

Average spacing in the same units as coordinates (typically Angstroms). Returns 0.0 for paths with fewer than 2 images.

§Applications in NEB

§Spring Force Reference

The average spacing serves as the equilibrium length for NEB springs:

F_spring ∝ (d_actual - d_avg)

§Path Quality Assessment

  • Uniform spacing: d_avg ≈ individual spacings (good path)
  • Non-uniform spacing: Large variation in spacings (needs optimization)

§Convergence Monitoring

  • Stable d_avg: Path spacing has converged
  • Changing d_avg: Path still optimizing

§Ideal Path Properties

  • Even spacing: All consecutive distances ≈ d_avg
  • Smooth progression: No large jumps between adjacent images
  • Appropriate resolution: d_avg small enough to capture path features