Skip to main content

Crate chemapp_rs

Crate chemapp_rs 

Source
Expand description

Unofficial Rust bindings and high-level workflows for the proprietary ChemApp thermochemical equilibrium library.

ChemApp performs the thermodynamic calculations; this crate dynamically loads a separately obtained ChemApp DLL or shared library. No ChemApp binary, licence, or commercial thermodynamic database is distributed in the crates.io package.

Most applications should start with Calculator. Engine exposes the lower-level, native-oriented TQ... interface when exact ChemApp control is required. Live entities reflect the current native state, while CalculatorSnapshot owns a result that remains usable after later native calls change that state.

§Loading and inspecting a system

use chemapp_rs::{Calculator, ChemAppError};

fn main() -> Result<(), ChemAppError> {
    let calculator = Calculator::from_library(
        "path/to/chemapp/library",
        "path/to/system.dat",
    )?;
    println!("ChemApp version: {}", calculator.engine().tqvers()?);
    for phase in calculator.phases()? {
        println!("{}: {}", phase.name()?, phase.model()?);
    }
    Ok(())
}

ChemApp and the Rust process must have matching architectures. Native execution may also require a valid ChemApp licence. See the repository README for installation, examples, platform evidence, and troubleshooting.

Re-exports§

pub use crate::calculator::Calculator;
pub use crate::entities::bond::Bond;
pub use crate::entities::bond::BondKind;
pub use crate::entities::species::Species;
pub use crate::entities::species::SpeciesRef;
pub use crate::error::ChemAppError;
pub use crate::interactions::Interaction;
pub use crate::interactions::InteractionChannel;
pub use crate::interactions::InteractionCrossCheck;
pub use crate::interactions::InteractionCrossCheckRequest;
pub use crate::interactions::InteractionDescriptor;
pub use crate::interactions::InteractionDescriptorCrossCheck;
pub use crate::interactions::InteractionDescriptorRecovery;
pub use crate::interactions::InteractionDescriptorSource;
pub use crate::interactions::InteractionMember;
pub use crate::interactions::InteractionMutationSupport;
pub use crate::interactions::InteractionOrder;
pub use crate::interactions::InteractionParameter;
pub use crate::interactions::InteractionParameterAddress;
pub use crate::interactions::InteractionParameterCell;
pub use crate::interactions::InteractionParameterRole;
pub use crate::interactions::InteractionRaw;
pub use crate::interactions::InteractionRecoveryReason;
pub use crate::interactions::InteractionRecoveryRequest;
pub use crate::interactions::InteractionResolution;
pub use crate::interactions::MagneticInteractionRole;
pub use crate::interactions::NativeInteractionIndex;
pub use crate::interactions::NativePoweredMember;
pub use crate::interactions::PhaseInteractionReport;
pub use crate::interactions::ResolvedInteractionDescriptor;
pub use crate::interactions::ResolvedPoweredMember;
pub use crate::iterator::BondIterator;
pub use crate::iterator::ConstituentIterator;
pub use crate::iterator::PhaseIterator;
pub use crate::iterator::SpeciesIterator;
pub use crate::iterator::SystemComponentIterator;
pub use crate::native::Engine;
pub use crate::snapshot::CalculatorSnapshot;
pub use crate::snapshot::SnapshotOptions;
pub use crate::snapshot::StreamSnapshot;

Modules§

cache
Baseline cache for reversible ChemApp parameter perturbations.
calculator
High-level, fallible ChemApp loading, calculation, mapping, and reporting.
defs
External function signatures of ChemApp libraries, both 32bit and 64bit are supported (Windows + Unix-like). Depending on the bitness and the calling convention, DLLs export the available functions slightly differently. For example, “stdcall” 32bit decorates function names with an prefix underscore and a @NBYTES suffix to indicate the total number of bytes the function arguments would occupy on the execution stack. The 64bit versions, however, use a different calling convention and usually do not decorate (or mangle) function names.
entities
Higher-order abstractions for system components, phases, etc.
error
This submodule wraps the native error codes from Fortran (integer values) into a Rust enum to facilitate working with their descriptions + support of non-ChemApp error (library loading, etc) added.
interactions
Model-aware inspection of ChemApp excess Gibbs and magnetic interactions.
iterator
Useful iterators over system components, phases, and phase constituents in a datafile.
native
This submodule exports ChemApp functions as-is with the minimal changes in the function signatures to adapt to the Rust infrastructure.
parse
Compatibility re-exports for the typed interaction parser.
snapshot
Engine-independent snapshots of one calculated ChemApp state.

Structs§

SystemDimensions
The eleven dimensions returned by Engine::tqsize and Engine::tqused.
TransparentHeader
Licensing and provenance metadata returned from a transparent .cst file.