Skip to main content
← OpenMECP Documentation

geometry_to_coords

Function geometry_to_coords 

Source
fn geometry_to_coords(geom: &Geometry) -> Vec<f64>
Expand description

Converts a geometry to a flat coordinate vector.

This utility function extracts all atomic coordinates from a geometry and returns them as a single flat vector in the order [x₁, y₁, z₁, x₂, y₂, z₂, …]. This format is convenient for mathematical operations and interpolation.

§Arguments

  • geom - The geometry to convert

§Returns

Returns a Vec<f64> containing all coordinates in flat format. The vector length will be 3 × num_atoms.

§Examples

use omecp::geometry::Geometry;
// Note: geometry_to_coords is private, this example shows the concept

let elements = vec!["H".to_string(), "O".to_string()];
let coords = vec![1.0, 2.0, 3.0, 4.0, 5.0, 6.0];
let geom = Geometry::new(elements, coords.clone());

// The function would return: vec![1.0, 2.0, 3.0, 4.0, 5.0, 6.0]