r/comp_chem • u/manassharma007 • Aug 24 '26
Update: the pure-Python DFT code I shared here earlier this year is now published — and has grown quite a bit
About 6 months ago I posted here about PyFock, the Gaussian-basis DFT code I had been building with essentially all of the performance-critical quantum-chemistry parts such as molecular integrals, density fitting, XC evaluation, etc., written directly in Python and just-in-time compiled. This is in contrast to what PySCF/Psi4 do where they utilise ahead-of-time (AOT) compiled C/C++ code for expensive calculations.
That post led to some really useful discussion here, particularly about comparisons with PySCF/GPU4PySCF, ERI performance, JIT compilation, and whether this kind of architecture can remain competitive as the code grows.
So I thought I would come back with an update.
The PyFock paper is now published in The Journal of Physical Chemistry A.
Official website: https://pyfock.bragitoff.com/
Web GUI: https://pyfock-gui.bragitoff.com/
More importantly, PyFock itself has grown quite a bit since I first posted it here.
Some of the things added since then include:
Analytical DFT nuclear gradients and forces
an ASE calculator, allowing geometry optimizations and other ASE workflows
a VQE interface through PennyLane
native implementations of XC functionals, including LDA, GGA and meta-GGA functionals, so LibXC is now optional
significantly improved electron-repulsion integral evaluation on both CPUs and GPUs
continued improvements to the GPU implementation and overall performance
ECP support and several other additions to the electronic-structure infrastructure
The original motivation is still the same:
Can the performance-critical algorithms of a Gaussian-basis electronic-structure code remain directly readable and modifiable in Python without sacrificing too much performance?
For me, the interesting part is still the hackability. If you want to change an ERI algorithm, experiment with screening, modify an XC implementation, or try a different GPU strategy, you can modify the actual Python kernel instead of having to work through a separate C/C++ backend.
At this point PyFock is becoming less of a proof-of-concept and more of a small electronic-structure development platform.
It is obviously still nowhere near the feature set or maturity of PySCF, Psi4, TURBOMOLE, etc., and that isn't the claim. The goal is to make the low-level algorithms unusually transparent while keeping the code fast enough to actually experiment with realistic systems.
2
u/FeLoNy111 Aug 24 '26
ASE integration is awesome. My issue with DFT -> ASE workflows has been that things have been pretty consistently fragile, eg VASP has to run in a temporary directory and then ASE is just a file reader. This would seem to solve that general fragility
Nice work!
2
u/Internal-Swordfish-9 Aug 24 '26
Nice work. Have you compared with PySCF? Not sure what extra your code adds compare to PySCF
11
u/nano-zan Aug 24 '26
This might be a bit stupid question, but I'll still ask it anyways. What is the purpose of a pure python framework for DFT and is it worth the slow speed python brings compared to c/c++ frameworks?