Skip to content

Commit ad5981c

Browse files
authored
Steele potential with custom combining rules (#29)
1 parent 806a8e7 commit ad5981c

File tree

5 files changed

+103
-3
lines changed

5 files changed

+103
-3
lines changed

feos-core/src/phase_equilibria/mod.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ pub use phase_diagram_binary::PhaseDiagramHetero;
1717
pub use phase_diagram_pure::PhaseDiagram;
1818

1919
/// Level of detail in the iteration output.
20-
#[derive(Copy, Clone, PartialOrd, PartialEq)]
20+
#[derive(Copy, Clone, PartialOrd, PartialEq, Eq)]
2121
#[cfg_attr(feature = "python", pyo3::pyclass)]
2222
pub enum Verbosity {
2323
/// Do not print output.
@@ -37,7 +37,7 @@ impl Default for Verbosity {
3737
/// Options for the various phase equilibria solvers.
3838
///
3939
/// If the values are [None], solver specific default
40-
/// values are used.
40+
/// values are used.
4141
#[derive(Copy, Clone, Default)]
4242
pub struct SolverOptions {
4343
/// Maximum number of iterations.

feos-dft/CHANGELOG.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
77
## [Unreleased]
88
### Added
99
- Added getters for the fields of `Pore1D` in Python. [#30](https://github.com/feos-org/feos-dft/pull/30)
10+
- Added Steele potential with custom combining rules. [#29](https://github.com/feos-org/feos/pull/29)
1011

1112
### Changed
1213
- Made FMT functional more flexible w.r.t. the shape of the weight functions. [#31](https://github.com/feos-org/feos-dft/pull/31)

feos-dft/src/adsorption/external_potential.rs

Lines changed: 64 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -34,6 +34,13 @@ pub enum ExternalPotential<U> {
3434
rho_s: f64,
3535
xi: Option<f64>,
3636
},
37+
/// Steele potential with custom combining rules: $V_i^\mathrm{ext}(z)=2\pi m_i\xi\varepsilon_{si}\sigma_{si}^2\Delta\rho_s\left(0.4\left(\frac{\sigma_{si}}{z}\right)^{10}-\left(\frac{\sigma_{si}}{z}\right)^4-\frac{\sigma_{si}^4}{3\Delta\left(z+0.61\Delta\right)^3}\right),~~~~\Delta=3.35$
38+
CustomSteele {
39+
sigma_sf: Array1<f64>,
40+
epsilon_k_sf: Array1<f64>,
41+
rho_s: f64,
42+
xi: Option<f64>,
43+
},
3744
/// Double well potential: $V_i^\mathrm{ext}(z)=\mathrm{min}\left(\frac{2\pi}{45} m_i\varepsilon_{2si}\sigma_{si}^3\rho_s\left(2\left(\frac{2\sigma_{si}}{z}\right)^9-15\left(\frac{2\sigma_{si}}{z}\right)^3\right),0\right)+\frac{2\pi}{45} m_i\varepsilon_{1si}\sigma_{si}^3\rho_s\left(2\left(\frac{\sigma_{si}}{z}\right)^9-15\left(\frac{\sigma_{si}}{z}\right)^3\right),~~~~\varepsilon_{1si}=\sqrt{\varepsilon_{1ss}\varepsilon_{ii}},~~~~\varepsilon_{2si}=\sqrt{\varepsilon_{2ss}\varepsilon_{ii}},~~~~\sigma_{si}=\frac{1}{2}\left(\sigma_{ss}+\sigma_{ii}\right)$
3845
DoubleWell {
3946
sigma_ss: f64,
@@ -138,6 +145,20 @@ impl<U: EosUnit> ExternalPotential<U> {
138145
/ ((3.0 * DELTA_STEELE)
139146
* (z_grid + 0.61 * DELTA_STEELE).mapv(|x| x.powi(3))))
140147
}
148+
Self::CustomSteele {
149+
sigma_sf,
150+
epsilon_k_sf,
151+
rho_s,
152+
xi,
153+
} => {
154+
(2.0 * PI * mi * xi.unwrap_or(1.0) * epsilon_k_sf[i])
155+
* (sigma_sf[i].powi(2) * DELTA_STEELE * rho_s)
156+
* (0.4 * (sigma_sf[i] / z_grid).mapv(|x| x.powi(10))
157+
- (sigma_sf[i] / z_grid).mapv(|x| x.powi(4))
158+
- sigma_sf[i].powi(4)
159+
/ ((3.0 * DELTA_STEELE)
160+
* (z_grid + 0.61 * DELTA_STEELE).mapv(|x| x.powi(3))))
161+
}
141162
Self::DoubleWell {
142163
sigma_ss,
143164
epsilon1_k_ss,
@@ -277,6 +298,23 @@ impl<U: EosUnit> ExternalPotential<U> {
277298
sigma_sf[i] / (pore_size + DELTA_STEELE * 0.61),
278299
))
279300
}
301+
Self::CustomSteele {
302+
sigma_sf,
303+
epsilon_k_sf,
304+
rho_s,
305+
xi,
306+
} => {
307+
(2.0 * PI * mi * xi.unwrap_or(1.0) * epsilon_k_sf[i])
308+
* (sigma_sf[i].powi(2) * DELTA_STEELE * rho_s)
309+
* (psi(6, &(r_grid / pore_size), sigma_sf[i] / pore_size)
310+
- psi(3, &(r_grid / pore_size), sigma_sf[i] / pore_size)
311+
- sigma_sf[i] / DELTA_STEELE
312+
* phi(
313+
3,
314+
&(r_grid / (pore_size + DELTA_STEELE * 0.61)),
315+
sigma_sf[i] / (pore_size + DELTA_STEELE * 0.61),
316+
))
317+
}
280318
Self::DoubleWell {
281319
sigma_ss,
282320
epsilon1_k_ss,
@@ -440,6 +478,32 @@ impl<U: EosUnit> ExternalPotential<U> {
440478
pore_size + 0.61 * DELTA_STEELE,
441479
)))
442480
}
481+
Self::CustomSteele {
482+
sigma_sf,
483+
epsilon_k_sf,
484+
rho_s,
485+
xi,
486+
} => {
487+
(2.0 * PI * mi * xi.unwrap_or(1.0) * epsilon_k_sf[i])
488+
* (sigma_sf[i].powi(2) * DELTA_STEELE * rho_s)
489+
* (2.0 / 5.0 * sum_n(10, r_grid, sigma_sf[i], pore_size)
490+
- sum_n(4, r_grid, sigma_sf[i], pore_size)
491+
- sigma_sf[i] / (3.0 * DELTA_STEELE)
492+
* (sigma_sf[i].powi(3)
493+
/ r_grid
494+
.mapv(|r| (pore_size + 0.61 * DELTA_STEELE - r).powi(3))
495+
+ sigma_sf[i].powi(3)
496+
/ r_grid.mapv(|r| {
497+
(pore_size + 0.61 * DELTA_STEELE + r).powi(3)
498+
})
499+
+ 1.5
500+
* sum_n(
501+
3,
502+
r_grid,
503+
sigma_sf[i],
504+
pore_size + 0.61 * DELTA_STEELE,
505+
)))
506+
}
443507
Self::DoubleWell {
444508
sigma_ss,
445509
epsilon1_k_ss,

feos-dft/src/python/adsorption/external_potential.rs

Lines changed: 35 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -137,6 +137,41 @@ impl PyExternalPotential {
137137
})
138138
}
139139

140+
/// Steele potential with custom combining rules
141+
///
142+
/// .. math:: V_i^\mathrm{ext}(z)=2\pi m_i\xi\varepsilon_{si}\sigma_{si}^2\Delta\rho_s\left(0.4\left(\frac{\sigma_{si}}{z}\right)^{10}-\left(\frac{\sigma_{si}}{z}\right)^4-\frac{\sigma_{si}^4}{3\Delta\left(z+0.61\Delta\right)^3}\right),~~~~\Delta=3.35
143+
///
144+
/// Parameters
145+
/// ----------
146+
/// sigma_sf : numpy.ndarray[float]
147+
/// Solid-fluid interaction diameters.
148+
/// epsilon_k_sf : numpy.ndarray[float]
149+
/// Solid-fluid interaction energies.
150+
/// rho_s : float
151+
/// Density of the solid.
152+
/// xi : float, optional
153+
/// Binary wall-fluid interaction parameter.
154+
///
155+
/// Returns
156+
/// -------
157+
/// ExternalPotential
158+
///
159+
#[staticmethod]
160+
#[pyo3(text_signature = "(sigma_sf, epsilon_k_sf, rho_s, xi=None)")]
161+
pub fn CustomSteele(
162+
sigma_sf: &PyArray1<f64>,
163+
epsilon_k_sf: &PyArray1<f64>,
164+
rho_s: f64,
165+
xi: Option<f64>,
166+
) -> Self {
167+
Self(ExternalPotential::CustomSteele {
168+
sigma_sf: sigma_sf.to_owned_array(),
169+
epsilon_k_sf: epsilon_k_sf.to_owned_array(),
170+
rho_s,
171+
xi,
172+
})
173+
}
174+
140175
/// Double well potential
141176
///
142177
/// .. math:: V_i^\mathrm{ext}(z)=\mathrm{min}\left(\frac{2\pi}{45} m_i\varepsilon_{2si}\sigma_{si}^3\rho_s\left(2\left(\frac{2\sigma_{si}}{z}\right)^9-15\left(\frac{2\sigma_{si}}{z}\right)^3\right),0\right)+\frac{2\pi}{45} m_i\varepsilon_{1si}\sigma_{si}^3\rho_s\left(2\left(\frac{\sigma_{si}}{z}\right)^9-15\left(\frac{\sigma_{si}}{z}\right)^3\right),~~~~\varepsilon_{1si}=\sqrt{\varepsilon_{1ss}\varepsilon_{ii}},~~~~\varepsilon_{2si}=\sqrt{\varepsilon_{2ss}\varepsilon_{ii}},~~~~\sigma_{si}=\frac{1}{2}\left(\sigma_{ss}+\sigma_{ii}\right)

feos-dft/src/weight_functions.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -150,7 +150,7 @@ impl<T: DualNum<f64>> WeightFunction<T> {
150150
}
151151

152152
/// Possible weight function shapes.
153-
#[derive(Clone, Copy, PartialEq, Debug)]
153+
#[derive(Clone, Copy, PartialEq, Eq, Debug)]
154154
pub enum WeightFunctionShape {
155155
/// Heaviside step function
156156
Theta,

0 commit comments

Comments
 (0)