3
$\begingroup$

I have been trying to write a basic HF code that can compute the MOs and total energy of a molecule. I followed the following reference for overlap and kinetic integrals. During a conversation with a developer of Libint, I was told that I should try implementing spherical harmonics into the code. I found this paper for the conversion from cartesian to spherical harmonics. Any beginner or intermediate level pointers on how the integrals are computed in spherical harmonics would be much appreciated. I am not looking for specific implementation details, but for the general algorithm.

$\endgroup$
6
  • 2
    $\begingroup$ +1 but it's not clear to me where exactly your problem lies? You know what spherical harmonics are, but you don't know how to write a code to do integrals that involve them? It also might help for us to understand better the underlying motivation for this code. Is it meant to be faster than libcint (the GitHub repository talks a lot about parallelization)? I'll also mention this question: mattermodeling.stackexchange.com/q/9595/5 which was asked by a student that was writing an HF code for their high school project. That code is now complete: github.com/lela2011/Maturaarbeit $\endgroup$ May 9, 2023 at 17:26
  • $\begingroup$ The motivation behind writing the code is twofold: (i) I would eventually need to teach students how these codes work (if I land a faculty position), and (ii) Even otherwise, it is good to know how the codes that we routinely use work. To answer the question about "is it meant to be faster than libcint?" No, I just want to know how these integrals are implemented in spherical harmonics. $\endgroup$ May 9, 2023 at 17:51
  • $\begingroup$ Thanks, this answers my question about the motivation behind writing the code, but not the part about what your problem is. Right now I don't know how to answer the question because I don't know where exactly the problem lies! I do agree that there's value in knowing how a code works, but writing a full fledged software to do the same thing as an existing code, isn't the only way to learn how the existing code works. Writing a code for electron repulsion integrals is more time-consuming than it is valuable in my opinion. It's re-inventing a wheel rather than a car. But tell us how we can help! $\endgroup$ May 9, 2023 at 18:10
  • $\begingroup$ Prof. Dattani, I agree that I would be reinventing the wheel if I try implementing it. Leaving the part of me implementing the routines, can you guide me to some pointers on how the integrals are computed in spherical harmonics? $\endgroup$ May 9, 2023 at 18:25
  • $\begingroup$ Yes, I think the question needs to be more specific though! $\endgroup$ May 9, 2023 at 18:26

1 Answer 1

3
$\begingroup$

Molecular integrals aren't typically computed in spherical harmonics. What you do instead is to compute the integrals in the Cartesian representation, where they are separable, and then transform to the spherical representation as quickly as possible your algorithm allows, since there are $n_c=\lambda(\lambda+1)/2$ cartesians but only $n_s=2\lambda+1$ spherical harmonics for angular momentum $\lambda$.

What this means is that when computing the $(pq|rs)$ integrals, you convert an index to the spherical basis as soon as possible, so that the recursions for the remaining indices only deal with $n_s$ components for each transformed index instead of $n_c$ components for untransformed indices.

In practice, it is hard to say at which point the transformation should be done, since this is where all algorithms are different: McMurchie-Davidson, Obara-Saika / Head-Gordon-Pople, and Rys quadrature all have different recursion relations and different scaling with the total angular momentum.

For a concise introduction to molecular integrals, I recommend you consult "the purple Bible" i.e. Molecular Electronic-Structure Theory by Helgaker, Jørgensen, and Olsen, which discusses the various algorithms at length. Its chapter 9 is dedicated to molecular integral evaluation and is almost a 100 pages!

$\endgroup$

You must log in to answer this question.

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