Skip to main content

tpt_sci_dft_classical/
lib.rs

1//! # tpt-sci-dft-classical
2//!
3//! **Classical / soft-matter density functional theory (DFT)** for the
4//! `tpt-science` pillar, provided by wrapping the [`feos`] framework
5//! ([`feos_dft`], MIT OR Apache-2.0). This crate is a thin, opinionated layer
6//! over `feos` so downstream science consumers get a stable, TPT-flavoured
7//! entry point without reaching into the full `feos` API:
8//!
9//! * Re-exports the `feos` DFT pieces ([`feos_dft`]) — profiles, solvers,
10//!   convolutions, geometries.
11//! * Wraps the PC-SAFT Helmholtz functional (`feos::pcsaft::PcSaft`, available
12//!   with the `feos` crate's `pcsaft` feature) behind a
13//!   small [`ClassicalDft`] builder that solves a **1-D density profile** for a
14//!   pure component given temperature and bulk density.
15//!
16//! The heavy lifting (functional derivatives, Picard / Anderson mixing, FFT
17//! convolutions) is done by `feos` itself; this crate only assembles the
18//! inputs and exposes a tidy result.
19//!
20//! # Example
21//!
22//! ```ignore
23//! use tpt_sci_dft_classical::ClassicalDft;
24//! use feos::pcsaft::{PcSaft, PcSaftParameters};
25//! use feos_core::parameter::IdentifierOption;
26//!
27//! // Build a PC-SAFT functional for a single pure component from its
28//! // parameters, then solve a planar density profile at (T, rho_bulk).
29//! let parameters = PcSaftParameters::from_json(
30//!     vec!["propane"], "../../parameters/pcsaft/esper2023.json",
31//!     None, IdentifierOption::Name,
32//! ).unwrap();
33//! let dft = ClassicalDft::with_functional(PcSaft::new(parameters));
34//! ```
35#![forbid(unsafe_code)]
36
37mod error;
38mod profile;
39mod square_gradient;
40
41pub use error::DftError;
42pub use profile::ClassicalDft;
43pub use square_gradient::{
44    DftSolution1D, DftSolution3D, PlanarSolve, SolveStats, SquareGradientDft, VdWParams,
45    VolumetricSolve,
46};
47
48/// Re-export of the wrapped `feos` framework so consumers can use the full
49/// underlying DFT machinery directly if they need to.
50pub use feos;
51/// Re-export of the wrapped `feos_dft` crate (profiles, solvers, geometries).
52pub use feos_dft;