An python library for calculations using the classical Density Functional Theory (cDFT) for Lennard-Jones fluids in 1D and 3D geometries.
- NumPy is the fundamental package for scientific computing with Python.
- SciPy is a collection of fundamental algorithms for scientific computing in Python.
- PyFFTW is a pythonic wrapper around FFTW, the speedy FFT library.
- PyTorch is a high-level library for machine learning, with multidimensional tensors that can also be operated on a CUDA-capable NVIDIA GPU.
- Matplotlib is a comprehensive library for creating static, animated, and interactive visualizations in Python.
- Optional: SciencePlots is a Matplotlib styles for scientific figures
Clone PyDFTlj
repository if you haven't done it yet.
git clone https://github.com/elvissoares/PyDFTlj
Go to PyDFTlj
's root folder, there you will find setup.py
file, and run the command below:
pip install -e .
The command -e
permits to edit the local source code and add these changes to the pydftlj library.
You can run
pip install git+https://github.com/elvissoares/PyDFTlj
and then you will be able to access the pydftlj library.
The cDFT is the extension of the equation of state to treat inhomogeneous fluids. For a fluid with temperature T, total volume V, and chemical potential
where $F[\rho (\boldsymbol{r})] $ is the free-energy functional, $V^{(\text{ext})} $ is the external potential, and $\mu $ is the chemical potential. The free-energy functional can be written as a sum $ F = F^\text{id} + F^\text{exc} $, where $F^\text{id} $ is the ideal gas contribution and
The ideal-gas contribution $F^\text{id} $ is given by the exact expression
where $k_B $ is the Boltzmann constant, and $\Lambda $ is the well-known thermal de Broglie wavelength.
The excess Helmholtz free-energy,
$$ F^{\text{exc}}[\rho (\boldsymbol{r})] = F^{\text{hs}}[\rho (\boldsymbol{r})] + F^{\text{att}}[\rho (\boldsymbol{r})] $$ where $F^{\text{hs}} $ is the hard-sphere repulsive interaction excess contribution and $F^{\text{att}} $ is the attractive interaction excess contribution.
The hard-sphere contribution,
- Rosenfeld Functional (RF) - Rosenfeld, Y., Phys. Rev. Lett. 63, 980–983 (1989)
- White Bear version I (WBI) - Yu, Y.-X. & Wu, J., J. Chem. Phys. 117, 10156–10164 (2002); Roth, R., Evans, R., Lang, A. & Kahl, G., J. Phys. Condens. Matter 14, 12063–12078 (2002)
- White Bear version II (WBII) - Hansen-Goos, H. & Roth, R. J., Phys. Condens. Matter 18, 8413–8425 (2006)
The attractive contribution,
- Mean Field Approximation (MFA) -
- Weighted Density Approximation (WDA) - Shen, G., Ji, X., & Lu, X. (2013). The Journal of Chemical Physics, 138(22), 224706.
- Modified Mean-Field Approximation (MMFA) - Soares, E. do A., Barreto, A. G., & Tavares, F. W. (2021). Fluid Phase Equilibria, 542–543, 113095.
where [x] represents the implemented functionals.
The thermodynamic equilibrium is given by the functional derivative of the grand potential in the form
When necessary, we use the MBWR1 equation of state for Lennard-Jones Fluids. We also describe the direct correlation function using the double Yukawa potential from the FMSA2.
If you use PyDFTlj in your work, please consider to cite it using the following reference:
Soares, Elvis do A, Amaro G Barreto, and Frederico W Tavares. 2023. “Classical Density Functional Theory Reveals Structural Information of H2 and CH4 Fluids Adsorbed in MOF-5.” Fluid Phase Equilibria, July, 113887. ArXiv: 2303.11384
Bibtex:
@article{Soares2023,
author = {Soares, Elvis do A and Barreto, Amaro G and Tavares, Frederico W},
doi = {10.1016/j.fluid.2023.113887},
issn = {03783812},
journal = {Fluid Phase Equilibria},
keywords = {Adsorption,Density functional theory,Metal–organic framework,Structure factor},
month = {jul},
pages = {113887},
title = {{Classical density functional theory reveals structural information of H2 and CH4 fluids adsorbed in MOF-5}},
url = {https://linkinghub.elsevier.com/retrieve/pii/S037838122300167X},
year = {2023}
}
Elvis Soares: [email protected]
Universidade Federal do Rio de janeiro
School of Chemistry
To access the examples folder you will need to clone PyDFTlj
repository if you haven't done it yet.
git clone https://github.com/elvissoares/PyDFTlj
The, you can access our examples folder and you can find different applications of the PyDFTlj.
Fig.1 - The phase diagram of the LJ fluid. The curve represents the MBWR EoS1. | Fig.2 - The saturation pressure as a function of the inverse of the temperature. |
Fig.3 - The density profiles of LJ fluid near a hardwall with reduce temperature T*=1.35 and reduced density of ρ*=0.5. Symbols: MC data. Lines: Different DFT formulations. |
Fig.7 - The radial distribution function of LJ fluid at reduced density of ρ*=0.84 and reduced temperature of T*=0.71. Symbols: MC data. Lines: Different DFT formulations. |
Fig.8 - Excess adsorbed quantity of CH4 inside the MOF-5 at 300 K. Symbols: MC data. Lines: Different DFT formulations. |