Localized-orbital Density Functional Theory code for educational purposes.
Project description
PyDFT
[!NOTE]
Python based Density Functional Theory code for educational purposes. The documentation of PyDFT can be found here.
Purpose
PyDFT is a pure-Python package for performing localized-orbital Density Functional Theory (DFT) calculations using Gaussian Type Orbitals. It implements restricted Kohn-Sham DFT for closed-shell molecules and currently supports the LDA and PBE exchange-correlation functionals.
The goal of PyDFT is not to be the fastest DFT code, but to be the most transparent one. It is designed first and foremost as an educational tool that reveals how a DFT calculation is actually assembled, from numerical grids and electron densities to potentials, matrix elements, and the self-consistent field procedure. Every intermediate quantity is exposed to the user and can be inspected, plotted, or modified, and considerable effort was put into documenting the code. PyDFT is not intended for professional calculations and does not offer the speed or breadth of features of mature open-source or commercial packages; what it offers instead is a clear, modifiable view into a working DFT code.
The figure below gives a high-level overview of a complete PyDFT calculation: from molecular input and dependencies, through construction of the Becke grid and one-electron matrices, to the Kohn-Sham SCF iteration and the wide range of quantities exposed for inspection.
[!TIP]
Interested in other educational quantum chemical codes? Have a look at the packages below.
- PyQInt is a hybrid C++/Python (Cython) code for performing Hartree-Fock calculations. This code contains many relevant features, such a geometry optimization, orbital localization and crystal orbital hamilton population analysis.
- HFCXX is a full C++ code for performing Hartree-Fock calculations.
- DFTCXX is a full C++ code for performing Density Functional Theory Calculations.
Features
The sections below highlight a few of the capabilities that make PyDFT useful as a teaching and exploration tool.
Numerical integration using Becke grids
Electron-electron interaction terms (both classical as well as exchange-correlation) are performed by means of extensive numerical integration schemes performed over so-called Becke grids. Utilizing these grids, molecular integrals are decomposed into series of weighted atomic integrals.
Molecular orbital visualization
PyDFT can be readily used alongside matplotlib to make figures of molecular orbitals or density fields.
Extensive output
Internal matrices, e.g. overlap or Hamiltonian matrix, are exposed to the user and can be readily visualized using specific matrix visualization routines.
Tunable numerical settings
Numerical choices that are usually hidden behind defaults in production codes, such as the radial and angular resolution of the grid, the spherical-harmonic expansion used for the Hartree potential, the exchange-correlation functional, and the SCF convergence criteria, are all exposed directly. This makes it straightforward to study how each setting affects accuracy, stability, and computational cost.
Installation
PyDFT supports Python 3.10 and newer.
To install PyDFT and its core runtime dependencies, run
pip install pydft
The plotting and example scripts use optional visualization dependencies:
pip install "pydft[plot]"
To install the dependencies used by the example scripts, including isosurface support, run
pip install "pydft[examples]"
Usage
Check the current version
import pydft
print(pydft.__version__)
Performing a simple calculation
from pydft import MoleculeBuilder, DFT
CO = MoleculeBuilder().get_molecule("CO")
dft = DFT(CO, basis='sto3g')
res = dft.scf(1e-4)
print("Total electronic energy: %f Ht" % res['energy'])
Community guidelines
- Contributions to PyDFT are always welcome and appreciated. Before doing so, please first read the CONTRIBUTING guide.
- For reporting issues or problems with the software, you are kindly invited to to open a new issue with the bug label.
- If you seek support in using PyDFT, please open an issue with the question label.
- If you wish to contact the developers, please send an e-mail to ivo@ivofilot.nl.
License
Unless otherwise stated, all code in this repository is provided under the GNU General Public License version 3.
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distributions
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file pydft-1.0.0-py3-none-any.whl.
File metadata
- Download URL: pydft-1.0.0-py3-none-any.whl
- Upload date:
- Size: 50.5 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.12
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
a4dcdcd6c68a36c3e9b5235c823bbb8af732c90f04118a076f5bf11ed1cb0772
|
|
| MD5 |
d9f5367b2ac09b38209b314fcdff3341
|
|
| BLAKE2b-256 |
2d1f0fb1d49d920d6563ed834d984e1463875f13e9014f1ae0a46e62cefafd8d
|
Provenance
The following attestation bundles were made for pydft-1.0.0-py3-none-any.whl:
Publisher:
build_pypi.yml on ifilot/pydft
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
pydft-1.0.0-py3-none-any.whl -
Subject digest:
a4dcdcd6c68a36c3e9b5235c823bbb8af732c90f04118a076f5bf11ed1cb0772 - Sigstore transparency entry: 1674424930
- Sigstore integration time:
-
Permalink:
ifilot/pydft@0fd2dfc622d5c551b92b80b22663ddf9b303ad90 -
Branch / Tag:
refs/tags/v1.0.0 - Owner: https://github.com/ifilot
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
build_pypi.yml@0fd2dfc622d5c551b92b80b22663ddf9b303ad90 -
Trigger Event:
push
-
Statement type: