4
$\begingroup$

I am trying to write a basic Hartree-Fock code to compute orbital energies and total energy of a molecule at almost all basis sets. I wrote the integral code in Cython/Python and is very slow. I would like to use libint to compute the integrals. However, I am unable to find references to use the libint library in python. Any pointers to use libint library in python would be much appreciated.

$\endgroup$
3
  • 1
    $\begingroup$ Did you try a alternative runtime, like PyPy? If your integral code is pure python it should be able to run on pypy. Depending on the speedup you need, it may suffice. From speed.pypy.org : "The geometric average of all benchmarks is 0.21 or 4.8 times faster than cpython". $\endgroup$
    – ksousa
    Commented Dec 25, 2022 at 18:45
  • 1
    $\begingroup$ @ksousa, my code is a mixture of Cython and Python, with the computationally heavy sections implemented in Cython. However, I am now trying to rework that code to include optimized libraries wherever possible. That's why I am interested in getting libint to work with Python. $\endgroup$ Commented Dec 26, 2022 at 3:18
  • 1
    $\begingroup$ Well, there's a test_hf.py script that's part of the libint tests - it looks like a complete script for water. $\endgroup$ Commented Dec 27, 2022 at 22:20

2 Answers 2

5
$\begingroup$

PyQuante is one of the first quantum chemistry codes written in Python, and it has been around for a long time. There is a binding to Ed Valeev's libint version 1 in PyQuante, see clibint.c and clibint.h; I am sure these will be as much help to you as they were for me a decade ago when I wrote my own interface to libint.

$\endgroup$
1
  • $\begingroup$ Thank you @SusiLehtola. $\endgroup$ Commented Jan 5, 2023 at 15:55
4
$\begingroup$

Some background:

The following answer by Anycorn was "accepted" by the OP:

"I wrote python bindings for libint. Did you look in python/tests? there are two tests, including sample hf program"

but it was deleted due to being "very low quality".

Geoff's comment was even better, as it gave the exact URL to a complete script, rather than just suggesting for the OP to look in a folder where they may or may not find what they need.

Conclusion:

Using libint with Python has been demonstrated for the $\ce{H2O}$ molecule in this complete script.

$\endgroup$
1

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .