Skip to main content
← OpenMECP Documentation

create_midpoint_geometry

Function create_midpoint_geometry 

Source
fn create_midpoint_geometry(geom1: &Geometry, geom2: &Geometry) -> Geometry
Expand description

Creates a simple midpoint geometry for QST when only two geometries are provided.

This function generates an intermediate geometry by taking the arithmetic mean of corresponding atomic coordinates. While this provides a reasonable starting point for QST interpolation, it may not represent a chemically meaningful structure.

§Arguments

  • geom1 - The first endpoint geometry
  • geom2 - The second endpoint geometry

§Returns

Returns a new Geometry with coordinates that are the arithmetic mean of the input geometries.

§Examples

use omecp::lst::create_midpoint_geometry;
use omecp::geometry::Geometry;

let elements = vec!["H".to_string(), "H".to_string()];
let coords1 = vec![0.0, 0.0, 0.0, 2.0, 0.0, 0.0];
let coords2 = vec![0.0, 0.0, 0.0, 4.0, 0.0, 0.0];

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

let midpoint = create_midpoint_geometry(&geom1, &geom2);
let mid_coords = midpoint.get_atom_coords(1);
assert_eq!(mid_coords[0], 3.0); // (2.0 + 4.0) / 2.0

§Notes

  • The resulting geometry uses the same element types as the input geometries
  • This is a simple geometric midpoint and may not be chemically reasonable
  • For better results, consider using an optimized transition state guess
  • The midpoint geometry is primarily used as a fallback when no intermediate structure is available for QST interpolation