openmm / spice-dataset

A collection of QM data for training potential functions
MIT License
155 stars 9 forks source link

Gradient sign #94

Closed nec4 closed 9 months ago

nec4 commented 9 months ago

Hello - apologies if this is a silly question:

dft_total_gradient -> is this meant to be interpreted as the forces, or literally as dU/dx? Is it necessary to add a negative sign to recover the forces?

peastman commented 9 months ago

It's the gradient, meaning the negative of the forces.

nec4 commented 9 months ago

I see, so a negative sign must be added by the user downstream to do force matching. Thanks!

nec4 commented 9 months ago

Actually I am confused. When I plot the first entry vectors for the dft_total_gradient for the system [cl-] [k+] (two ions of opposite sign), plotting the first example of the raw dft_total_gradient vectors (and putting the tails at the respective atom positions and scaling the force vectors by a factor of 10 for clarity) gives the following picture:

Screen Shot 2024-02-07 at 7 53 32 PM

Which is what we would expect from attractive forces between oppositely charged ions in vaccum. So it seems the quantities in dft_total_gradient are true forces? Therefore there is no need to manually multiply by -1 in order to train on forces; the dft_total_gradient can just be directly loaded and used as the force?

peastman commented 9 months ago

The Psi4 documentation describes that field as, "The total electronic gradient [E_h/a0] of the requested DFT method."

nec4 commented 9 months ago

I must be missing a minus sign somewhere. Thanks.