Kernel fit pore size distribution#

DFT kernel fit#

Module contains methods of calculating a pore size distribution starting from a DFT kernel. Please note that calculation of DFT/NLDFT/QSDFT kernels is outside the scope of this program.

pygaps.characterisation.psd_kernel.psd_dft(isotherm: PointIsotherm | ModelIsotherm, kernel: str = 'DFT-N2-77K-carbon-slit', branch: str = 'ads', p_limits: tuple[float, float] = None, kernel_units: dict = None, bspline_order: int = 2, verbose: bool = False)[source]#

Calculate the pore size distribution using a DFT kernel from an Isotherm.

Parameters:
  • isotherm (PointIsotherm, ModelIsotherm) -- The isotherm for which the pore size distribution will be calculated.

  • kernel (str) -- The name of the kernel, or the path where it can be found.

  • branch ({'ads', 'des'}, optional) -- Branch of the isotherm to use. It defaults to adsorption.

  • p_limits ([float, float]) -- Pressure range in which to calculate PSD, defaults to entire isotherm.

  • bspline_order (int) -- The smoothing order of the b-splines fit to the data. If set to 0, data will be returned as-is.

  • kernel_units (dict) -- A dictionary specifying kernel basis and units, contains loading_basis, loading_unit, material_basis, material_unit, pressure_mode and "pressure_unit". Defaults to mmol/g vs. relative pressure.

  • verbose (bool) -- Prints out extra information on the calculation and graphs the results.

Raises:
Returns:

dict -- A dictionary with the pore widths and the pore distributions, of the form:

  • pore_widths (array) : the widths of the pores

  • pore_distribution (array) : contribution of each pore width to the overall pore distribution

Notes

Density Functional Theory (DFT) along with its extensions (NLDFT, QSDFT, etc) have emerged as the most powerful methods of describing adsorption on surfaces and in pores [1], [2]. The theory allows the prediction of molecular behaviour solely on the basis of quantum mechanical considerations, and does not require other properties besides the electron structure and positions of the atoms involved. Calculations of large systems of atoms, such as those involved in adsorption in pores is a computationally intensive task, with modern computing power significantly improving the scales on which the modelling can be applied.

The theory can be used to model adsorption in a simplified pore of a particular width which yields the the adsorption isotherm on a material comprised solely on pores of that width. The calculation is then repeated on pores of different sizes, to obtain a 'kernel' or a collection of ideal isotherms on a distribution of pores. The generation of this kernel should be judicious, as both the adsorbent and the adsorbate must be modelled accurately. As it is a field in of in itself, the DFT calculations themselves are outside the scope of this program.

Using the kernel, the isotherm obtained through experimental means can be modelled. The contributions of each kernel isotherm to the overall data is determined through a minimisation function. The contributions and their corresponding pore size form the pore size distribution of the material.

The program accepts kernel files in a CSV format with the following structure:

Pressure(bar)

Pore size 1(nm)

Pore size 2(nm)

...

Pore size y(nm)

p1

l11

l21

...

ly1

p2

l12

l22

...

ly2

p3

l13

l23

...

ly3

...

...

...

...

...

px

l1x

l2x

...

lyz

The kernel should have sufficient points for a good interpolation as well as have a range of pressures that is wide enough to cover possible experimental values.

Limitations

The accuracy of predicting pore size through DFT kernels is only as good as the kernel itself, which should be tailored to the adsorbate, adsorbent and experimental conditions used.

The isotherm used to calculate the pore size distribution should have enough datapoints and pressure range in order to cover adsorption in the entire range of pores.

See also

pygaps.characterisation.psd_kernel.psd_dft_kernel_fit

backend function for DFT kernel fitting

References

pygaps.characterisation.psd_kernel.psd_dft_kernel_fit(pressure: list[float], loading: list[float], kernel_path: str, bspline_order: int = 2)[source]#

Fit a DFT kernel on experimental adsorption data.

Parameters:
  • loading (array) -- Adsorbed amount in mmol/g.

  • pressure (array) -- Relative pressure.

  • kernel_path (str) -- The location of the kernel to use.

  • bspline_order (int) -- The smoothing order of the b-splines fit to the data. If set to 0, data will be returned as-is.

Returns:

  • pore widths (array) -- The widths of the pores.

  • pore_dist (array) -- The distributions for each width (dV/dw).

  • pore_load_cum (array) -- Cumulative pore loading.

Notes

The function will take the data in the form of pressure and loading. It will then load the kernel either from disk or from memory and define a minimsation function as the sum of squared differences of the sum of all individual kernel isotherm loadings multiplied by their contribution as per the following function:

\[f(x) = \sum_{p=p_0}^{p=p_x} (n_{p,exp} - \sum_{w=w_0}^{w=w_y} n_{p, kernel} X_w )^2\]

The function is then minimised using the scipy.optimise.minimise module, with the constraint that the contribution of each kernel isotherm cannot be negative.