I want to calculate the derivative of the overlap matrix $S$ with regard to atomic positions. For this derivative I expect a dimension of (3$\times$natm$\times$nao$\times$nao).
Using the pyscf grad.rhf.get_ovlp() method I receive a derivative of size (3$\times$nao$\times$nao). Furthermore I receive non-zero terms on elements belonging to the same atom. Last but not least the matrix I receive is not even symmetric. How can I use pyscf to get the derivative I need?
EDIT: This is a minimal example
from pyscf import scf, grad, gto mol = gto.Mole() mol.build( atom = '''O -0.93940 0.01570 -0.66740 H -0.00994 -0.84002 -0.83652 H 0.10473 0.75287 -0.86054''', basis = 'minao') grad_mol = grad.rhf.Gradients(scf.RHF(mol)) dS_dr = grad_mol.get_ovlp(mol) In particular I expect dS_dr[0:5,0:5] to be zero, as the basis functions are centered on the same atom. But there are 4 non-zero terms in this block, [0,2], [1,2], [2,0] and [2,1]. Also the elements I expect to be non-zero are not symmetric e.g. [0,6] = -[6,0].