Thanks for the great software. I was wondering if anyone here has tried to build Psi4 as a single, standalone executable with no external dependencies (excluding libc or something like that). In particular, I was wondering if there was a straightforward way to build it without relying on Python (mainly for the ability to just copy an executable and run it, even if said executable is rather large due to static linking).
I did see a post from a few years ago (Execute psi4 from C++ program) which seemed to intersect with this topic, and was answered in the negative, but wanted to know if the answer has changed or if static linking was otherwise possible.
Hi, probably the answer for your purposes is still no for a standalone executable. The build system isn’t set up for it, but one could compile only with the required C++ deps (libxc, libint, gau2grid) statically linked, skip most of core.cc and all the export_*.cc files, and add in a main {} function. The trouble is, one couldn’t do quantum chemistry with the resulting executable as things like Molecule and BasisSet parsers/constructors involve Python, the SCF iteration logic is in Python, and much connective logic (do SCF, transform ints, do CC) is in Python. One could access some nice classes for integrals, Matrix handling, and QC routines from the C++, and that’s about it. (This is what Psi4 plugins use, but they also hook into Psi4’s Python driver to get run easily.) Thanks for the inquiry. Does this answer your question or did you have a different scheme or goal in mind?
As far as I know, there is no way of generating static libraries from Python code. This would run completely against the basic logic of Python, which is designed to be an interpreted language.
Thanks for the answer and sorry for the delay. Yes, this exactly answers my question. Indeed, it seems like it could be a little involved to replicate the Python logic in C++ (and this would not have very many users compared to the Python layer).
As to the other post re: Python and static libraries, I agree. I was curious about using exclusively C++.