6
$\begingroup$

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].

$\endgroup$
3
  • 1
    $\begingroup$ +1 and welcome. Maybe you can try PySCFad (PySCF with automatic derivatives). Your question will likely get closed if you don't provide the input/output file. By providing these, people can get the derivatives matrix to work (with the problems that you mentioned fixed) and put the new input/output file in an answer. $\endgroup$ Commented May 31 at 0:53
  • $\begingroup$ @NikeDattani-NoFreeTime Thank you very much, I have added a code example and discussed my expectations. $\endgroup$ Commented May 31 at 8:21
  • $\begingroup$ I can't really make sense of it. You can try to manually get the numerical derivative of $\mathbf{S}$ for a simpler system and compare elements between the matrices. I have successfully used numerical derivatives of integrals to implement a SCF gradient, albeit in FORTRAN (and the code is really ugly and supports only STO-6G s functions). $\endgroup$ Commented Jun 5 at 5:20

1 Answer 1

2
$\begingroup$

The derivative of the overlap matrix

$$ S_{\mu \nu} = \langle \mu | \nu \rangle $$

with respect to a nuclear coordinate $R_i$ is given by

$$ {\rm d}S_{\mu \nu} / {\rm d} R_{i} = \Bigg\langle \frac {{\rm d}\mu} {{\rm d}R_i} \Bigg| \nu \Bigg \rangle + \Bigg\langle \mu \Bigg| \frac {{\rm d}\nu} {{\rm d}R_i} \Bigg \rangle. $$

Note that ${\rm d}\mu / dR_i$ vanishes unless $\mu$ is centered on atom $i$. Now, if you write

$$ D_{\mu \nu; i} = \Bigg\langle \mu \Bigg| \frac {{\rm d}\nu} {{\rm d}R_i} \Bigg \rangle $$

you get

$$ {\rm d}S_{\mu \nu} / {\rm d} R_{i} = D_{\mu \nu;i} + D_{\nu \mu;i} $$

Since the derivative integral $D$ trivially vanishes unless the derivative operator acts on the coordinate of the basis function in question, you can pack D as an $ 3 \times N_{\rm atom} \times N_{\rm bf} \times N_{\rm bf} $ array. This is what I assume PySCF is doing.

$\endgroup$
1
  • $\begingroup$ You are totally right! Pyscf does in fact pack the derivative according to your $D$. In my calculations I missed the product rule of the derivative... Thank you! $\endgroup$ Commented Jun 18 at 9:01

You must log in to answer this question.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.