Package: feos
FeOs - A Framework for Equations of State and Classical Density Functional TheoryTheFeOspackage provides Rust implementations of different equation of state and Helmholtz energy functional models and corresponding Python bindings.fromfeos.eosimportEquationOfState,Statefromfeos.pcsaftimportPcSaftParameters,PcSaftRecord# PC-SAFT parameters for methanol (Gross and Sadowski 2002)record=PcSaftRecord(1.5255,3.23,188.9,kappa_ab=0.035176,epsilon_k_ab=2899.5,na=1,nb=1)# Build an equation of stateparameters=PcSaftParameters.from_model_records([record])eos=EquationOfState.pcsaft(parameters)# Define thermodynamic conditionscritical_point=State.critical_point(eos)# Compute propertiesp=critical_point.pressure()t=critical_point.temperatureprint(f'Critical point for methanol: T={t}, p={p}.')Critical point for methanol: T=531.5 K, p=10.7 MPa.ModelsThe following models are currently published as part of theFeOsframeworknamedescriptioneosdftpcsaftperturbed-chain (polar) statistical associating fluid theory✓✓gc-pcsaft(heterosegmented) group contribution PC-SAFT✓✓petsperturbed truncated and shifted Lennard-Jones mixtures✓✓uvtheoryequation of state for Mie fluids and mixtures✓saftvrqmieequation of state for quantum fluids and mixtures✓✓The list is being expanded continuously. Currently under development are implementations of ePC-SAFT and a Helmholtz energy functional for the UV theory.Other public repositories that implement models within theFeOsframework, but are currently not part of thefeosPython package, arenamedescriptioneosdftfeos-fused-chainsheterosegmented fused-sphere chain functional✓ParametersIn addition to the source code for the Rust and Python packages, this repository contains JSON files with previously publishedparametersfor the different models including group contribution methods. The parameter files can be read directly from Rust or Python.Properties and phase equilibriaThe crate makes use ofgeneralized (hyper-) dual numbersto generically calculate exact partial derivatives from Helmholtz energy equations of state. The derivatives are used to calculateequilibrium properties(pressure, heat capacity, fugacity, andmanymore),transport properties(viscosity, thermal conductivity, diffusion coefficients) using the entropy scaling approachcritical pointsandphase equilibriafor pure components and mixtures.In addition to that, utilities are provided to assist in the handling ofparametersfor both molecular equations of state and (homosegmented) group contribution methods and for the generation of phase diagrams for pure components and binary mixtures.Classical density functional theoryFeOsuses efficient numerical methods to calculate density profiles in inhomogeneous systems. Highlights include:Fast calculation of convolution integrals in cartesian (1D, 2D and 3D), polar, cylindrical, and spherical coordinate systems using FFT and related algorithms.Automatic calculation of partial derivatives of Helmholtz energy densities (including temperature derivatives) using automatic differentiation withgeneralized (hyper-) dual numbers.Modeling of heterosegmented molecules, including branched molecules.Functionalities for calculating surface tensions, adsorption isotherms, pair correlation functions, and solvation free energies.Cargo featuresWithout additional features activated, the commandcargo test --releasewill only build and test the core functionalities of the crate. To run unit and integration tests for specific models, runcargo test --release --features pcsaftto test, e.g., the implementation of PC-SAFT orcargo test --release --features all_modelsto run tests on all implemented models.Python packageFeOsuses thePyO3framework to provide Python bindings. The Python package can be installed viapipand runs on Windows, Linux and macOS:pip install feosIf there is no compiled package for your system available from PyPI and you have a Rust compiler installed, you can instead build the python package from source usingpip install git+https://github.com/feos-org/feosThis command builds the package without link-time optimization (LTO) that can be used to increase the performance further.
See theBuilding from sourcesection for information about building the wheel including LTO.Building from sourceTo compile the code you need the Rust compiler andmaturin(>=0.13,<0.14) installed.
To install the package directly into the active environment (virtualenv or conda), usematurin develop --releasewhich uses thepythonandall_modelsfeature as specified in thepyproject.tomlfile.Alternatively, you can specify the models or features that you want to include in the python package explicitly, e.g.maturin develop --release --features "python pcsaft dft"for the PC-SAFT equation of state and Helmholtz energy functional.To build wheels including link-time optimization (LTO), usematurin build --profile="release-lto"which will use thepythonandall_modelsfeatures specified in thepyproject.tomlfile.
Use the following command to build a wheel with specific features:maturin build --profile="release-lto" --features "python ..."LTO increases compile times measurably but the resulting wheel is more performant and has a smaller size.
For development however, we recommend using the--releaseflag.DocumentationFor a documentation of the Python API, Python examples, and a guide to the underlying Rust framework check out thedocumentation.BenchmarksCheck out thebenchesdirectory for information about provided Rust benchmarks and how to run them.DevelopersThis software is currently maintained by members of the groups ofProf. Joachim Gross,Institute of Thermodynamics and Thermal Process Engineering (ITT), University of StuttgartProf. André Bardow,Energy and Process Systems Engineering (EPSE), ETH ZurichContributingFeOsgrew from the need to maintain a common codebase used within the scientific work done in our groups. We share the code publicly as a platform to publish our own research but also encourage other researchers and developers to contribute their own models or implementations of existing equations of state.If you want to contribute toFeOs, there are several ways to go: improving the documentation and helping with language issues, testing the code on your systems to find bugs, adding new models or algorithms, or providing feature requests. Feel free to message us if you have questions or open an issue to discuss improvements.Cite usIf you findFeOsuseful for your own scientific studies, consider citing ourpublicationaccompanying this library.@article{rehner2023feos,
  author = {Rehner, Philipp and Bauer, Gernot and Gross, Joachim},
  title = {FeOs: An Open-Source Framework for Equations of State and Classical Density Functional Theory},
  journal = {Industrial \& Engineering Chemistry Research},
  volume = {62},
  number = {12},
  pages = {5347-5357},
  year = {2023},
}