Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -153,7 +153,7 @@ maturin build --profile="release-lto"
```

which will use the `wheel` feature collection specified in the `pyproject.toml` file.
The `emscripten_wheel` collection provides the same models and AD support for Pyodide while omitting incompatible features (such as Rayon, SQLite, and the Rayon-dependent 3D DFT classes).
The `emscripten_wheel` collection provides the same models and AD support for Pyodide while omitting incompatible features (such as Rayon and SQLite).
Use the following command to build a wheel with specific features:

```
Expand Down
18 changes: 5 additions & 13 deletions docs/api/dft.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,15 +8,6 @@ Implementations of Helmholtz energy functionals for DFT.
```{eval-rst}
.. currentmodule:: feos

.. autosummary::
:toctree: generated/

HelmholtzEnergyFunctional
```

```{eval-rst}
.. currentmodule:: feos

.. autosummary::
HelmholtzEnergyFunctional.pcsaft
HelmholtzEnergyFunctional.gc_pcsaft
Expand All @@ -43,11 +34,11 @@ Implementations of Helmholtz energy functionals for DFT.

ExternalPotential
Geometry
Grid
Pore1D
Pore2D
Pore3D
Adsorption1D
Adsorption3D
PoreProfile
PoreSpecification
Adsorption
```

## Solvation
Expand All @@ -68,4 +59,5 @@ Implementations of Helmholtz energy functionals for DFT.

FMTVersion
DFTSolver
DFTSolverLog
```
1 change: 1 addition & 0 deletions docs/api/eos.md
Original file line number Diff line number Diff line change
Expand Up @@ -90,4 +90,5 @@ eos = feos.EquationOfState.pcsaft(pc_saft_parameters).joback(joback_parameters)
StateVec
PhaseEquilibrium
PhaseDiagram
PhaseDiagramHetero
```
20 changes: 20 additions & 0 deletions docs/conf.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
import os
import sys
import feos
import sphinx.ext.autosummary

sys.path.append(os.path.abspath(os.path.join(__file__, "../..")))
sys.path.insert(0, os.path.abspath('.'))
Expand Down Expand Up @@ -38,6 +39,25 @@
autodoc_typehints = "both"
autosummary_generate = True
templates_path = ['_templates']


def hide_missing_constructor(app, what, name, obj, options, signature, return_annotation):
# classes without a constructor (no `#[new]`) would otherwise be shown as `Class()`
if what == "class" and getattr(obj, "__text_signature__", None) is None:
return "", None


# autosummary turns empty signatures into `()`, keep them empty instead
_mangle_signature = sphinx.ext.autosummary.mangle_signature
sphinx.ext.autosummary.mangle_signature = lambda sig, max_chars=30: (
_mangle_signature(sig, max_chars) if sig else ""
)


def setup(app):
app.connect("autodoc-process-signature", hide_missing_constructor)


exclude_patterns = ['_build', 'Thumbs.db', '.DS_Store', '**.ipynb_checkpoints']

# -- Options for HTML output -------------------------------------------------
Expand Down
2 changes: 1 addition & 1 deletion docs/index.md
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ let parameters = Parameters::from_json(
let eos = &PcSaft::new(parameters);

// Define thermodynamic conditions
let critical_point = State::critical_point(&eos, None, None, None, Default::default())?;
let critical_point = State::critical_point(&eos, (), None, None, Default::default())?;

// Compute properties
let p = critical_point.pressure(Contributions::Total);
Expand Down
31 changes: 15 additions & 16 deletions docs/installation.md
Original file line number Diff line number Diff line change
Expand Up @@ -16,28 +16,27 @@ pip install git+https://github.com/feos-org/feos
````

````{tab-item} Rust
In Rust, the `feos-dft` crate and each equation of state or DFT functional is a separate, optional module behind a feature flag.
To use {math}`\text{FeO}_\text{s}` with all models (including Python bindings), use the `all_models` feature:
In Rust, DFT and each equation of state or Helmholtz energy functional is a separate, optional module behind a feature flag.
To use {math}`\text{FeO}_\text{s}` with all models, use the `all_models` feature:

```toml
[dependencies]
feos-core = "0.4"
feos = { version="0.4", features = ["all_models"] }
quantity = "0.6"
```
cargo add feos --features all_models
```

In the following example we use only the PC-SAFT equation of state and Helmholtz energy functionals:

```
cargo add feos --features "dft pcsaft"
```

To access the generic implementations for properties and phase equilibria, the `feos-core` crate is also included as dependency. Finally, {math}`\text{FeO}_\text{s}` makes extensive use of SI units provided by the `quantity` crate.
The generic implementations for properties and phase equilibria (`feos-core`) and for DFT (`feos-dft`) are re-exported as `feos::core` and `feos::dft`, so no additional dependencies are required.

In the following example we use only the PC-SAFT equation of state and Helmholtz energy functionals (without Python bindings):
{math}`\text{FeO}_\text{s}` makes extensive use of SI units provided by the `quantity` crate, which has to be added separately:

```toml
[dependencies]
feos-core = "0.4"
feos-dft = "0.4"
feos = { version="0.4", features = ["dft", "pcsaft"] }
quantity = "0.6"
```
cargo add quantity
```

To access generic DFT functionalities like interfaces and adsorption isotherms, the `feos-dft` crate is added to the dependencies.
Make sure that the version of `quantity` matches the one used by `feos`. Otherwise, the units are not compatible.
````
`````
12 changes: 6 additions & 6 deletions docs/recipes/recipes_contact_angle.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@
"\n",
"# set up surface\n",
"ext_pot = feos.ExternalPotential.LJ93(sigma_ss=3.0, epsilon_k_ss=120.0, rho_s=0.08)\n",
"pore = feos.Pore1D(feos.Geometry.Cartesian, 50*si.ANGSTROM, ext_pot)"
"pore = feos.Pore1D(functional, feos.Geometry.Cartesian, 50*si.ANGSTROM, ext_pot)"
]
},
{
Expand All @@ -37,10 +37,10 @@
{
"data": {
"text/latex": [
"$31.99°$"
"$31.997°$"
],
"text/plain": [
"31.990466526671963°"
"31.99653644908266°"
]
},
"execution_count": 2,
Expand All @@ -59,7 +59,7 @@
"gamma_sv = vapor_profile.interfacial_tension / si.ANGSTROM**2\n",
"\n",
"# calculate the vapor/liquid interfacial tension\n",
"vle_profile = feos.PlanarInterface.from_pdgt(vle, 2048).solve()\n",
"vle_profile = feos.Interface.planar_from_pdgt(vle, 2048).solve()\n",
"gamma_vl = vle_profile.surface_tension\n",
"\n",
"# calculate the contact angle from Young's equation\n",
Expand All @@ -69,7 +69,7 @@
],
"metadata": {
"kernelspec": {
"display_name": "feos",
"display_name": "feos_devel",
"language": "python",
"name": "python3"
},
Expand All @@ -83,7 +83,7 @@
"name": "python",
"nbconvert_exporter": "python",
"pygments_lexer": "ipython3",
"version": "3.14.0"
"version": "3.14.7"
}
},
"nbformat": 4,
Expand Down
20 changes: 10 additions & 10 deletions docs/recipes/recipes_surface_tension_pure.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -63,10 +63,10 @@
{
"data": {
"text/latex": [
"$20.191\\,\\mathrm{\\frac{mN}{m}}$"
"$20.198\\,\\mathrm{\\frac{mN}{m}}$"
],
"text/plain": [
"20.190692939005643 mN/m"
"20.19808975615558 mN/m"
]
},
"execution_count": 3,
Expand All @@ -75,8 +75,8 @@
}
],
"source": [
"surface_tension_pdgt = (feos.PlanarInterface\n",
" .from_pdgt(vle, 1024)\n",
"surface_tension_pdgt = (feos.Interface\n",
" .planar_from_pdgt(vle, 1024)\n",
" .solve()\n",
" .surface_tension)\n",
"surface_tension_pdgt"
Expand All @@ -91,10 +91,10 @@
{
"data": {
"text/latex": [
"$20.191\\,\\mathrm{\\frac{mN}{m}}$"
"$20.194\\,\\mathrm{\\frac{mN}{m}}$"
],
"text/plain": [
"20.190693016626028 mN/m"
"20.194223394324272 mN/m"
]
},
"execution_count": 4,
Expand All @@ -103,8 +103,8 @@
}
],
"source": [
"surface_tension_tanh = (feos.PlanarInterface\n",
" .from_tanh(vle, 1024, 100 * si.ANGSTROM, 500 * si.KELVIN)\n",
"surface_tension_tanh = (feos.Interface\n",
" .planar_from_tanh(vle, 1024, 100 * si.ANGSTROM, 500 * si.KELVIN)\n",
" .solve()\n",
" .surface_tension\n",
")\n",
Expand All @@ -114,7 +114,7 @@
],
"metadata": {
"kernelspec": {
"display_name": "feos",
"display_name": "feos_devel",
"language": "python",
"name": "python3"
},
Expand All @@ -128,7 +128,7 @@
"name": "python",
"nbconvert_exporter": "python",
"pygments_lexer": "ipython3",
"version": "3.13.5"
"version": "3.14.7"
}
},
"nbformat": 4,
Expand Down
58 changes: 29 additions & 29 deletions docs/tutorials/dft/pcsaft_surface_tension.ipynb

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion docs/tutorials/index.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# Tutorials

You can find each of the tutorials below as jupyter notebook in the github repository in the [`examples` folder](https://github.com/feos-org/feos/tree/main/examples).
You can find each of the tutorials below as jupyter notebook in the github repository in the [`docs/tutorials` folder](https://github.com/feos-org/feos/tree/main/docs/tutorials).

```{eval-rst}
.. toctree::
Expand Down
38 changes: 3 additions & 35 deletions docs/tutorials/utility/core_dual_numbers.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -114,7 +114,7 @@
" for j in range(self.n):\n",
" ak_mix += np.sqrt(ak[i] * ak[j]) * (x[i] * x[j] * (1.0 - self.delta_ij[i, j]))\n",
" else:\n",
" ak_mix = ak\n",
" ak_mix = ak[0]\n",
" b = np.sum(x * self.b)\n",
" v = 1.0 / state.density\n",
" a = state.density * (np.log(v / (v - b)) - ak_mix / (b * SQRT2 * 2.0 * state.temperature)\n",
Expand Down Expand Up @@ -240,15 +240,7 @@
"temperature: 300.0\n",
"molefracs : [1.0]\n",
"density : 2.4543491066169247e-05\n",
"A/kT : [0.00012419]\n"
]
},
{
"name": "stderr",
"output_type": "stream",
"text": [
"/tmp/ipykernel_2182195/809879024.py:1: DeprecationWarning: Conversion of an array with ndim > 0 to a scalar is deprecated, and will error in future. Ensure you extract a single element from your array before performing this operation. (Deprecated NumPy 1.25.)\n",
" state.helmholtz_energy() / (si.KB * 300*si.KELVIN)\n"
"A/kT : 0.00012419216233064458\n"
]
},
{
Expand Down Expand Up @@ -299,14 +291,6 @@
"A/kT : 0.00012419216233064458 + -0.005045192367012291ε\n"
]
},
{
"name": "stderr",
"output_type": "stream",
"text": [
"/tmp/ipykernel_2182195/966462947.py:64: DeprecationWarning: Conversion of an array with ndim > 0 to a scalar is deprecated, and will error in future. Ensure you extract a single element from your array before performing this operation. (Deprecated NumPy 1.25.)\n",
" ak = ((1.0 - np.sqrt(tr)) * self.kappa + 1.0)**2 * self.a_r\n"
]
},
{
"data": {
"text/latex": [
Expand Down Expand Up @@ -350,14 +334,6 @@
"A/kT : 0.00012419216233064458 + -0.0000006261809548282462ε\n"
]
},
{
"name": "stderr",
"output_type": "stream",
"text": [
"/tmp/ipykernel_2182195/966462947.py:64: DeprecationWarning: Conversion of an array with ndim > 0 to a scalar is deprecated, and will error in future. Ensure you extract a single element from your array before performing this operation. (Deprecated NumPy 1.25.)\n",
" ak = ((1.0 - np.sqrt(tr)) * self.kappa + 1.0)**2 * self.a_r\n"
]
},
{
"data": {
"text/latex": [
Expand Down Expand Up @@ -423,14 +399,6 @@
"A/kT : 0.00012419216233064458 + -0.0000006261809548282462ε1 + 0.000000004710234326181233ε1²\n"
]
},
{
"name": "stderr",
"output_type": "stream",
"text": [
"/tmp/ipykernel_2182195/966462947.py:64: DeprecationWarning: Conversion of an array with ndim > 0 to a scalar is deprecated, and will error in future. Ensure you extract a single element from your array before performing this operation. (Deprecated NumPy 1.25.)\n",
" ak = ((1.0 - np.sqrt(tr)) * self.kappa + 1.0)**2 * self.a_r\n"
]
},
{
"data": {
"text/latex": [
Expand Down Expand Up @@ -477,7 +445,7 @@
"name": "python",
"nbconvert_exporter": "python",
"pygments_lexer": "ipython3",
"version": "3.14.0"
"version": "3.14.7"
}
},
"nbformat": 4,
Expand Down
13 changes: 13 additions & 0 deletions examples/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
# Examples

This folder contains a collection of example notebooks that are **not actively maintained**.
The first code cell of each notebook states the `feos` version that it was last run with, e.g.,

```python
# feos version: 0.9.6
```

If a notebook does not work with the latest version of `feos`, you can install the version stated in the notebook, e.g., `pip install feos==0.9.6`.

The tutorials and recipes in the [documentation](https://feos-org.github.io/feos/) are kept up to date with the latest release.
Their notebooks are located in the [`docs/tutorials`](../docs/tutorials) and [`docs/recipes`](../docs/recipes) folders.
3 changes: 2 additions & 1 deletion examples/core_dual_numbers.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,7 @@
"metadata": {},
"outputs": [],
"source": [
"# feos version: 0.9.6\n",
"import feos\n",
"import si_units as si\n",
"import numpy as np\n",
Expand Down Expand Up @@ -114,7 +115,7 @@
" for j in range(self.n):\n",
" ak_mix += np.sqrt(ak[i] * ak[j]) * (x[i] * x[j] * (1.0 - self.delta_ij[i, j]))\n",
" else:\n",
" ak_mix = ak\n",
" ak_mix = ak[0]\n",
" b = np.sum(x * self.b)\n",
" v = 1.0 / state.density\n",
" a = state.density * (np.log(v / (v - b)) - ak_mix / (b * SQRT2 * 2.0 * state.temperature)\n",
Expand Down
1 change: 1 addition & 0 deletions examples/core_user_defined_eos.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@
"metadata": {},
"outputs": [],
"source": [
"# feos version: 0.9.6\n",
"import feos\n",
"import si_units as si\n",
"import numpy as np\n",
Expand Down
1 change: 1 addition & 0 deletions examples/core_working_with_units.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@
"metadata": {},
"outputs": [],
"source": [
"# feos version: 0.11.0\n",
"import si_units as si\n",
"import numpy as np"
]
Expand Down
1 change: 1 addition & 0 deletions examples/gc_pcsaft_functional.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@
"metadata": {},
"outputs": [],
"source": [
"# feos version: 0.10.1\n",
"import feos\n",
"import si_units as si\n",
"import matplotlib.pyplot as plt"
Expand Down
Loading
Loading