9
$\begingroup$

I would like to use libcint, the integral library in pyscf from Fortran. Its webpage has a Fortran API and developer manual, but looks like I still need a tutorial. I posted here, would like to cross post here, since more people are here.

Namely from here, what kind of modifications would be needed to print out results as:

from pyscf import gto
mol = gto.Mole()
mol.atom = '''O 0 0 0; H  0 1 0; H 0 0 1'''
mol.basis = 'sto-3g'
mol.build()

kin = mol.intor('int1e_kin')
vnuc = mol.intor('int1e_nuc')
overlap = mol.intor('int1e_ovlp')
eri = mol.intor('int2e')

print('kin', kin.shape, kin)

via Fortran? Thanks a lot.

$\endgroup$
14
  • $\begingroup$ +1 and welcome to our new community! Thank you for contributing your question here and we hope to see much more of you in the future !!! Hopefully you get an answer soon! $\endgroup$ Dec 17, 2021 at 22:53
  • $\begingroup$ Just to clarify a few things. 1. Where is the API for this located, I tried to look on the wiki link from GitHub, but can't connect to the site? 2. What does the Fortran example you linked do? Are you able to get that to run or is that also a part of the question? 3. Do you just want the kinetic energy integrals or all the other ones you make, but don't print in the python example? $\endgroup$
    – Tyberius
    Dec 18, 2021 at 2:34
  • $\begingroup$ Thanks for your comments. 1. I am not sure. github.com/sunqm/libcint mentions 'It provides C/Fortran API to evaluate one-electron / two-electron integrals for Cartesian / real-spheric / spinor Gaussian type functions.'; 2. The Fortran example will check if some integrals are zero, I think (lines 135, 152, 165); 3. I want kin, vnuc, overlap, and eri; ultimately, load from Fortran without using python (I am not sure if I use Fortran to load python to load pyscf will take too long time) The printing line is just for me to have a check. $\endgroup$ Dec 18, 2021 at 3:06
  • 2
    $\begingroup$ @Lancashire3000 dumping the matrices and tensor to disk from Python would be the easiest, if you will any way handle them in-core. The interface is so good, and wrapping a system call to Python isn't that expensive. Interfacing directly from Fortran to e.g. libcint will require a lot of effort since you need to build the molecule and the basis set and then loop over the shells to compute the integrals shell by shell. PySCF is really fast in my experience, I don't think the overhead is a problem. $\endgroup$ Dec 18, 2021 at 3:52
  • 1
    $\begingroup$ By the way, the question of how to solve your problem of writing integrals faster, is a different one (should be asked in a separate post), but if you have 100s of GB of integrals, then using Parallel HDF5 on a striped data system might be better, since you can have 100s of nodes printing to the integrals file in parallel. Various efforts were made to implement this since at least as far back as 2016 but I'm not sure where that feature stands at the moment, in the public NECI repository. $\endgroup$ Dec 18, 2021 at 8:15

0

Browse other questions tagged .