Include long-range geometry in PolarMACE stress - #1678
Open
darthjaja6 wants to merge 3 commits into
Open
Conversation
darthjaja6
had a problem deploying
to
gpu-external
August 21, 2026 03:17 — with
GitHub Actions
Error
darthjaja6
force-pushed
the
fix/polar-periodic-stress-1642
branch
from
August 21, 2026 16:31
f736a12 to
d896cf3
Compare
darthjaja6
temporarily deployed
to
gpu-external
August 21, 2026 16:31 — with
GitHub Actions
Inactive
aacostadiaz
reviewed
Aug 31, 2026
aacostadiaz
left a comment
Collaborator
There was a problem hiding this comment.
Thanks for this. The fix looks good to me.
Waiting for WillBaldwin0/graph_electrostatics#5 to merge so we can flip the pin back to WillBaldwin0.
darthjaja6
temporarily deployed
to
gpu-external
August 31, 2026 08:24 — with
GitHub Actions
Inactive
darthjaja6
temporarily deployed
to
gpu-external
August 31, 2026 08:24 — with
GitHub Actions
Inactive
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
This fixes #1642.
The local MACE graph was already strained when stress was requested, but the long-range PolarMACE path was still using the original positions, cell, reciprocal cell and volume. That meant stress only saw the indirect response of the learned charge density and missed the explicit geometric derivative of the electrostatic energy.
This gives the long-range calculation the same affine positions and cell as the local model, then recomputes the reciprocal cell and volume from that strained cell. The original positions are still kept as the force differentiation variables.
I added an 8 Šperiodic water case to the finite-difference stress test. It failed by about 4.3e-5 eV/ų before this change and now agrees within 2e-7. The existing force case and all four periodic-box stress cases pass, and asking for stress does not change the energy or forces.
This currently pins graph_electrostatics to the commit from graph_electrostatics#5, because reciprocal-vector gradients need that small autograd fix. I’ll switch the pin back to the upstream repository once that PR is merged.