Skip to content
Merged
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
7 changes: 5 additions & 2 deletions crates/feos/src/pcsaft/dft/pure_saft_functional.rs
Original file line number Diff line number Diff line change
Expand Up @@ -123,10 +123,13 @@ impl<'a> FunctionalContribution for PureFMTAssocFunctional<'a> {
xi.iter_mut().zip(&n2).for_each(|(xi, &n2)| {
if n2.re() < N0_CUTOFF * 4.0 * PI * p.m[0] * r.re().powi(2) {
*xi = N::one();
} else if xi.re() < 0.0 {
*xi = N::zero(); // |n2v| > n2 only from FFT ringing; continuum bound xi in [0, 1]
}
});
let rho0 = (&n0 / p.m[0] * &xi).insert_axis(Axis(0));

// n0 < 0 only from FFT ringing; the association term needs rho0 >= 0 (sqrt(1 + 4 Delta rho0))
let n0p = n0.mapv(|n0| if n0.re() < 0.0 { N::zero() } else { n0 });
let rho0 = (&n0p / p.m[0] * &xi).insert_axis(Axis(0));
phi += &(a._helmholtz_energy_density(temperature, &rho0, &n2, &n3m1rec, &xi))?;
}

Expand Down
Loading