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
7 changes: 7 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,14 +7,21 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
## [Breaking]
### Added
- Added `PoreSpecification` enum to specify the state of the fluid in the pore (currently chemical potential or moles). [#371](https://github.com/feos-org/feos/pull/371)
- Added the `Grid` and `PoreProfile` classes as an entry points to DFT in various coordinate systems in Python. [#376](https://github.com/feos-org/feos/pull/376)

### Changed
- Changed data type of initial temperatures or pressure for phase equilibrium calculations (`TemperatureOrPressure::Other`) from `D` to `f64`. [#369](https://github.com/feos-org/feos/pull/369)
- Reworked DFT solution algorithms slightly for the cases in which additional specifications are given. [#371](https://github.com/feos-org/feos/pull/371)
- External potentials are passed and returned as quantities (energies) instead of reduced units. [#372](https://github.com/feos-org/feos/pull/372)
- Merged the `Adsorption1D` and `Adsorption3D` classes in Python into `Adsorption` using dynamically dimensioned arrays. [#376](https://github.com/feos-org/feos/pull/376)

### Removed
- Removed the `DFTSpecification` trait in favor of only using the `DFTSpecification` enum (renamed from `DFTSpecifications`). [#371](https://github.com/feos-org/feos/pull/371)
- Removed the `Pore2D` and `Pore3D` interfaces including the (limited) calculation of external potentials for complex pore grometries. [#376](https://github.com/feos-org/feos/pull/376)
- Removed the free energy-averaged external (FEA) potential. [#376](https://github.com/feos-org/feos/pull/376)

### Packaging
- Removed the `gauss-quad` dependency which was only used in the FEA potential calculation. [#376](https://github.com/feos-org/feos/pull/376)

## [Unreleased]

Expand Down
1 change: 0 additions & 1 deletion Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,6 @@ petgraph = "0.8"
rustdct = "0.7"
rustfft = "6.0"
libm = "0.2"
gauss-quad = "0.3"
approx = "0.5"
criterion = "0.8"
paste = "1.0"
Expand Down
3 changes: 1 addition & 2 deletions crates/feos-dft/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -23,11 +23,10 @@ rustdct = { workspace = true }
rustfft = { workspace = true }
num-traits = { workspace = true }
libm = { workspace = true }
gauss-quad = { workspace = true, optional = true }
petgraph = { workspace = true }

feos-core = { workspace = true }

[features]
default = []
rayon = ["gauss-quad", "ndarray/rayon"]
rayon = ["ndarray/rayon"]
125 changes: 0 additions & 125 deletions crates/feos-dft/src/adsorption/external_potential.rs
Original file line number Diff line number Diff line change
@@ -1,13 +1,7 @@
#[cfg(feature = "rayon")]
use crate::adsorption::fea_potential::calculate_fea_potential;
use crate::functional::HelmholtzEnergyFunctional;
#[cfg(feature = "rayon")]
use crate::geometry::Geometry;
use libm::tgamma;
use nalgebra::DVector;
use ndarray::{Array1, Array2, Axis as Axis_nd};
#[cfg(feature = "rayon")]
use quantity::Length;
use std::f64::consts::PI;
use std::ops::Deref;

Expand Down Expand Up @@ -52,20 +46,6 @@ pub enum ExternalPotential {
epsilon2_k_ss: f64,
rho_s: f64,
},
/// Free-energy averaged potential:
#[cfg(feature = "rayon")]
FreeEnergyAveraged {
coordinates: Length<Array2<f64>>,
sigma_ss: Array1<f64>,
epsilon_k_ss: Array1<f64>,
pore_center: [f64; 3],
system_size: [Length; 3],
n_grid: [usize; 2],
cutoff_radius: Option<f64>,
},

/// Custom potential
Custom(Array2<f64>),
}

/// Parameters of the fluid required to evaluate the external potential.
Expand All @@ -89,12 +69,7 @@ impl ExternalPotential {
&self,
z_grid: &Array1<f64>,
fluid_parameters: &P,
#[cfg_attr(not(feature = "rayon"), expect(unused_variables))] temperature: f64,
) -> Array2<f64> {
if let ExternalPotential::Custom(potential) = self {
return potential.clone();
}

// Allocate external potential
let m = fluid_parameters.m();
let mut ext_pot = Array2::zeros((m.len(), z_grid.len()));
Expand Down Expand Up @@ -197,36 +172,6 @@ impl ExternalPotential {
* (2.0 * (sigma_sf[i] / z_grid).mapv(|x| x.powi(9))
- 15.0 * (sigma_sf[i] / z_grid).mapv(|x| x.powi(3))))
}
#[cfg(feature = "rayon")]
Self::FreeEnergyAveraged {
coordinates,
sigma_ss,
epsilon_k_ss,
pore_center,
system_size,
n_grid,
cutoff_radius,
} => {
// combining rules
let epsilon_k_sf =
(fluid_parameters.epsilon_k_ff()[i] * epsilon_k_ss).map(|e| e.sqrt());
let sigma_sf = (fluid_parameters.sigma_ff()[i] + sigma_ss) * 0.5;

calculate_fea_potential(
z_grid,
mi,
coordinates,
sigma_sf,
epsilon_k_sf,
pore_center,
system_size,
n_grid,
temperature,
Geometry::Cartesian,
*cutoff_radius,
)
}
_ => unreachable!(),
});
}
ext_pot
Expand All @@ -238,12 +183,7 @@ impl ExternalPotential {
r_grid: &Array1<f64>,
pore_size: f64,
fluid_parameters: &P,
#[cfg_attr(not(feature = "rayon"), expect(unused_variables))] temperature: f64,
) -> Array2<f64> {
if let ExternalPotential::Custom(potential) = self {
return potential.clone();
}

// Allocate external potential
let m = fluid_parameters.m();
let mut ext_pot = Array2::zeros((m.len(), r_grid.len()));
Expand Down Expand Up @@ -363,36 +303,6 @@ impl ExternalPotential {
* sigma_sf[i].powi(3)
* *rho_s)
}
#[cfg(feature = "rayon")]
Self::FreeEnergyAveraged {
coordinates,
sigma_ss,
epsilon_k_ss,
pore_center,
system_size,
n_grid,
cutoff_radius,
} => {
// combining rules
let epsilon_k_sf =
(fluid_parameters.epsilon_k_ff()[i] * epsilon_k_ss).map(|e| e.sqrt());
let sigma_sf = (fluid_parameters.sigma_ff()[i] + sigma_ss) * 0.5;

calculate_fea_potential(
r_grid,
mi,
coordinates,
sigma_sf,
epsilon_k_sf,
pore_center,
system_size,
n_grid,
temperature,
Geometry::Cylindrical,
*cutoff_radius,
)
}
_ => unreachable!(),
});
}
ext_pot
Expand All @@ -404,12 +314,7 @@ impl ExternalPotential {
r_grid: &Array1<f64>,
pore_size: f64,
fluid_parameters: &P,
#[cfg_attr(not(feature = "rayon"), expect(unused_variables))] temperature: f64,
) -> Array2<f64> {
if let ExternalPotential::Custom(potential) = self {
return potential.clone();
}

// Allocate external potential
let m = fluid_parameters.m();
let mut ext_pot = Array2::zeros((m.len(), r_grid.len()));
Expand Down Expand Up @@ -553,36 +458,6 @@ impl ExternalPotential {
* (2.0 / 5.0 * sum_n(10, r_grid, sigma_sf[i], pore_size)
- sum_n(4, r_grid, sigma_sf[i], pore_size)))
}
#[cfg(feature = "rayon")]
Self::FreeEnergyAveraged {
coordinates,
sigma_ss,
epsilon_k_ss,
pore_center,
system_size,
n_grid,
cutoff_radius,
} => {
// combining rules
let epsilon_k_sf =
(fluid_parameters.epsilon_k_ff()[i] * epsilon_k_ss).map(|e| e.sqrt());
let sigma_sf = (fluid_parameters.sigma_ff()[i] + sigma_ss) * 0.5;

calculate_fea_potential(
r_grid,
mi,
coordinates,
sigma_sf,
epsilon_k_sf,
pore_center,
system_size,
n_grid,
temperature,
Geometry::Spherical,
*cutoff_radius,
)
}
_ => unreachable!(),
});
}
ext_pot
Expand Down
141 changes: 0 additions & 141 deletions crates/feos-dft/src/adsorption/fea_potential.rs

This file was deleted.

Loading