I am interested in calculating the following expectation value for atoms using a converged Slater deteminant from in DFT
$$ \left< \Psi \left| \sum_{i,j=1}^N r_i^a r_j^b\right| \Psi \right> \; ,\tag{1}$$
with $a,b$ being some small integers (let's say $a=b=1$) and $i,j$ run over each individual electron up to the total number of electrons $N$, $r_i$ being the operator corresponding to the distance of electron $i$ from the nucleus. I want to use PySCF because the code should contain all tools I need.
Originally I assumed I can just use the converged electron density to calculate the expectation values, but I believe I would lose the exchange terms as opposed to explicitly writing out the Slater determinant on both sides.
I've figured that I will be needing one and two electron integrals. For example if $a=1$ and $b=0$ I think the matrix element reduces to
$$ \left< \Psi \left| \sum_{i=1}^N r_i\right| \Psi \right> = \frac{1}{N} \left( \sum_n \left< \phi_n|r|\phi_n \right> + \sum_{m,n} \sum_n \left< \phi_m|r|\phi_n \right> \right)\; ,\tag{2}$$
which should correspond to the standard one electron integral with the Slater determinant ansatz. I also believe if $b \neq 0$ I should be getting a two electron integral. Based on my previous question, I also have a code that can calculate an arbitrary one-electron integral between any molecular orbitals. I don't know yet how to do it for two electron integrals.
However, I believe calculating matrix elements of Slater determinants should not be a rare problem, so I think there must be a standard way in PySCF of doing this.
What is the best approach of calculating the matrix element I am looking for?