Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix gradient evaluation when one of coordinates is close to another #1208

Merged
merged 5 commits into from
Mar 6, 2025

Conversation

foxtran
Copy link
Contributor

@foxtran foxtran commented Mar 4, 2025

Fix #986

If one of coordinates close to another in another atom, S(ii,jj) tends to zero, at the same time corresponding H0 is also tends to zero and therefore H0(k)/S(ii,jj) is constant. But since S(ii,jj) was skipped, the H(ii,jj) becomes zero that is incorrect.

foxtran added 2 commits March 4, 2025 20:14
foxtran added 2 commits March 5, 2025 03:58
Signed-off-by: Igor S. Gerasimov <[email protected]>
Signed-off-by: Igor S. Gerasimov <[email protected]>
Copy link
Contributor

@thfroitzheim thfroitzheim left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This looks good to me. Generally, the division by S is not really ideal but tblite does it properly. So it makes more sense to replace everything with tblite in the future.

I tested it a bit and also compared with tblite. As far as I can see this eliminates most of the problems raised in #986. Only the water example you found seems to be still wrong. So likely another small bug...
For reference, tblite is generally correct when compared with the numerical gradient.

@thfroitzheim thfroitzheim merged commit fc512bb into grimme-lab:main Mar 6, 2025
19 checks passed
@toxtran
Copy link

toxtran commented Mar 6, 2025

Oh... I need to fix more :D

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Bug in gradient calculation
3 participants