pub fn interpolate(
geom1: &Geometry,
geom2: &Geometry,
num_points: usize,
method: InterpolationMethod,
) -> Vec<Geometry>Expand description
Performs LST interpolation between two geometries using the specified method.
This is the main entry point for LST interpolation. It dispatches to the appropriate interpolation function based on the selected method and returns a vector of intermediate geometries.
§Arguments
geom1- The starting geometry (reactant structure)geom2- The ending geometry (product structure)num_points- Number of intermediate points to generate (excluding endpoints)method- The interpolation method to use
§Returns
Returns a Vec<Geometry> containing the interpolated geometries. The vector
will have num_points + 2 elements (including both endpoints).
§Panics
Panics if the input geometries have different numbers of atoms or different element types.
§Examples
use omecp::lst::{interpolate, InterpolationMethod};
use omecp::geometry::Geometry;
let elements = vec!["H".to_string(), "H".to_string()];
let coords1 = vec![0.0, 0.0, 0.0, 1.0, 0.0, 0.0];
let coords2 = vec![0.0, 0.0, 0.0, 2.0, 0.0, 0.0];
let geom1 = Geometry::new(elements.clone(), coords1);
let geom2 = Geometry::new(elements, coords2);
// Generate 5 intermediate points using linear interpolation
let path = interpolate(&geom1, &geom2, 5, InterpolationMethod::Linear);
assert_eq!(path.len(), 7); // 5 intermediate + 2 endpoints§Implementation Notes
- For
InterpolationMethod::Linear: Uses Kabsch algorithm for optimal alignment - For
InterpolationMethod::Quadratic: Automatically generates midpoint if needed - For
InterpolationMethod::EnergyWeighted: Currently falls back to linear interpolation