mozithermoest
v0.3.0
Published
MoziThermoEst is a toolkit for estimating thermodynamic properties.
Readme
MoziThermoEst 🧪📈
MoziThermoEst is a TypeScript toolkit for estimating thermodynamic properties with:
- Antoine vapor-pressure fitting and prediction 🌡️
- Joback group-contribution property estimation 🧬
- Unit-aware typed inputs (via
mozithermodb-settings) 📦 - Compatibility wrappers for nullable/legacy flows 🔁
Highlights ✨
- Canonical Antoine fitting from SI arrays (
K,Pa) - Typed Antoine wrappers with automatic unit normalization
- Robust fitting losses (
linear,soft_l1,huber,cauchy,arctan) - Joback table-backed calculations for 41 contribution groups
- Full Joback properties + heat-capacity function output
Installation 📥
npm install mozithermoestQuick Start
1) Antoine fit + vapor pressure 🧊➡️💨
import { fitAntoine, calcVaporPressureWithUnits } from "mozithermoest";
const T_K = [298, 308, 318, 328, 338, 348];
const P_Pa = [3392.9, 5738.33, 9332.6, 14657.31, 22310.87, 33018.32];
const fit = fitAntoine(T_K, P_Pa, {
base: "log10",
fit_in_log_space: true,
loss: "soft_l1",
});
const pBar = calcVaporPressureWithUnits(
{ value: 373.15, unit: "K" },
fit.A,
fit.B,
fit.C,
"bar",
fit.base,
);
console.log(fit.A, fit.B, fit.C, pBar.vapor_pressure, pBar.unit);2) Joback full properties 🧬
import { calcJoback } from "mozithermoest";
const groups = {
"-CH3": 2,
"=CH- @ring": 3,
"=C< @ring": 3,
"-OH @phenol": 1,
};
const result = calcJoback(groups, 18);
console.log(result.boiling_point_temperature);
console.log(result.critical_pressure);
if (result.heat_capacity.value) {
console.log(result.heat_capacity.value(300), result.heat_capacity.unit);
}API Overview 🧭
Antoine (canonical)
fitAntoine(TDataK, PDataPa, options)calcVaporPressure(temperature, A, B, C, base?)calcVaporPressureWithUnits(temperature, A, B, C, pressureUnit?, base?)loadExperimentalData(dataset)wheredataset = { temperaturesK, pressuresPa }loadExperimentalDataFromCsvText(csvText, temperatureUnit, pressureUnit)(cross-platform)AntoineError
Antoine (compatibility wrappers)
estimateCoefficients(temperatures, pressures, options)-> nullable resultestimateCoefficientsFromExperimentalData(dataset, options)-> nullable resultestimateCoefficientsFromDataset(dataset, options)-> nullable resultcalcVaporPressure(...)/calcVaporPressureWithUnits(...)(legacy aliases exported too)Antoineclass (legacy facade):Antoine.fitAntoine(...)Antoine.outlierReport(...)Antoine.calc(...)Antoine.loadExperimentalData(dataset)Antoine.loadExperimentalDataFromCsvText(...)
Joback (canonical)
loadJobackTable()listAvailableJobackGroups()calcJobackProperties(groups, totalAtomsNumber)calcJobackHeatCapacity(groups, totalAtomsNumber)calcJoback(groups, totalAtomsNumber)Jobackclass andJobackError
Joback (compatibility wrappers)
jobackCalc/joback_calcjobackPropCalc/joback_prop_calcjobackHeatCapacityCalc/joback_heat_capacity_calcjobackGroupContributionInfo/_infojobackGroupContributionNames/_namesjobackGroupContributionIds/_idsjobackGroupContributionCategory/_category
Supported Units 📐
- Temperature:
K,C,F,R - Pressure:
Pa,kPa,bar,atm,psi
Canonical Antoine fitting is always solved internally in K and Pa.
Running Local Examples ▶️
From project root:
npx tsx examples/exp-1.ts
npx tsx examples/joback-exp-0.ts
npx tsx examples/joback-exp-1.ts
npx tsx examples/joback-exp-2.ts
npx tsx examples/joback-exp-3.tsNotes:
examples/exp-1.tsdata-loading flows should provide canonical objects ({ temperaturesK, pressuresPa }) or CSV text.- Joback examples show alias-keyed and field-name-keyed group payloads.
📄 License
Licensed under the Apache-2.0 License. See LICENSE.
❓ FAQ
For questions, contact Sina Gilassi on LinkedIn.
