mod profile

module profile

Native loader for the minimum potential ABI profile.

A backend prefix such as nwchemc or cpmdc selects one conforming shared library. The library receives PotentialConfig bytes once, keeps a persistent session, and receives ForceInput bytes for every geometry. Results return as PotentialResult bytes in the units requested by the input message.

Types

type ProfileResult<T>

Result type for profile loading and evaluation.

Functions

fn decode_potential_result(encoded: &[u8], expected_force_count: usize) -> ProfileResult<ProfileEvaluation>

Decode the energy and force fields from a shared PotentialResult carrier.

fn encode_force_input(request: &ProfileRequest<'_>) -> ProfileResult<Vec<u8>>

Serialize a request as the shared ForceInput carrier.

fn library_candidates(prefix: &str, explicit_path: Option<&str>) -> Vec<String>

Ordered shared-library candidates for a backend prefix.

Structs and Unions

struct ProfileError(String)

Error raised while loading or driving a potential profile.

Implementations

impl ProfileError

Traits implemented

impl fmt::Display for ProfileError
impl std::error::Error for ProfileError
impl From<capnp::Error> for ProfileError
struct ProfileEvaluation

Energy and forces returned by one fused backend calculation.

energy: f64

Energy in the ProfileRequest::energy_unit unit.

forces: Vec<f64>

Forces in energy-unit per length-unit.

struct ProfileRequest<'a>

One atomistic evaluation sent through a profile session.

positions: &'a [f64]

Flat Cartesian coordinates, three values per atom.

atomic_numbers: &'a [i32]

Atomic numbers in the same atom order as positions.

box_matrix: Option<&'a [f64; 9]>

Optional row-major 3x3 simulation cell; molecular inputs use None.

length_unit: &'a str

Unit expression for coordinates and cell vectors.

energy_unit: &'a str

Unit expression requested for energy and forces.

struct ProfileSession

One persistent session loaded through the prefix-generic potential profile.

Implementations

impl ProfileSession

Functions

fn abi_version(&self) -> i32

Numeric ABI generation reported by the backend.

fn evaluate(&mut self, request: &ProfileRequest<'_>) -> ProfileResult<ProfileEvaluation>

Evaluate one geometry through the persistent session.

fn library_path(&self) -> &str

Path of the shared library selected by the candidate search.

unsafe fn load(prefix: &str, explicit_path: Option<&Path>, config: &[u8]) -> ProfileResult<Self>

Load a conforming backend and create one session from PotentialConfig bytes.

Safety

The selected shared library must implement the minimum potential ABI profile for prefix with the C layouts defined by the profile contract.

fn prefix(&self) -> &str

Backend prefix used to resolve the profile symbols.

fn version(&self) -> &str

Human-readable backend version string.