Skip to main content
← OpenMECP Documentation

interpolate_quadratic

Function interpolate_quadratic 

Source
pub fn interpolate_quadratic(
    geom1: &Geometry,
    geom_mid: &Geometry,
    geom2: &Geometry,
    num_points: usize,
) -> Vec<Geometry>
Expand description

Performs Quadratic Synchronous Transit (QST) interpolation using three geometries.

This function implements quadratic interpolation between three geometries: a starting point, an intermediate point, and an ending point. The resulting path follows a quadratic curve in coordinate space, which can provide a more realistic reaction path than linear interpolation.

§Arguments

  • geom1 - The starting geometry (t = 0)
  • geom_mid - The intermediate geometry (t = 0.5)
  • geom2 - The ending geometry (t = 1)
  • num_points - Number of intermediate points to generate

§Returns

Returns a Vec<Geometry> containing num_points + 2 geometries following a quadratic interpolation path.

§Panics

Panics if the input geometries have different numbers of atoms or different element types.

§Mathematical Formula

The quadratic interpolation formula used is:

p(t) = (1-t)² × p₁ + 2(1-t)t × p_mid + t² × p₂

where t ∈ [0, 1] is the interpolation parameter.

§Examples

use omecp::lst::interpolate_quadratic;
use omecp::geometry::Geometry;

let elements = vec!["O".to_string(), "H".to_string(), "H".to_string()];
let coords1 = vec![0.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0, 1.0, 0.0];
let coords_mid = vec![0.0, 0.0, 0.2, 1.1, 0.0, 0.2, 0.0, 1.1, 0.2];
let coords2 = vec![0.0, 0.0, 0.5, 1.2, 0.0, 0.5, 0.0, 1.2, 0.5];

let geom1 = Geometry::new(elements.clone(), coords1);
let geom_mid = Geometry::new(elements.clone(), coords_mid);
let geom2 = Geometry::new(elements, coords2);

let path = interpolate_quadratic(&geom1, &geom_mid, &geom2, 4);
assert_eq!(path.len(), 6); // 4 intermediate + 2 endpoints

§Notes

  • The intermediate geometry should represent a reasonable guess for the transition state or a point along the reaction coordinate
  • For best results, the intermediate geometry should be optimized or at least chemically reasonable
  • If no intermediate geometry is available, use create_midpoint_geometry to generate a simple midpoint structure