Skip to content

Include long-range geometry in PolarMACE stress - #1678

Open
darthjaja6 wants to merge 3 commits into
ACEsuit:developfrom
darthjaja6:fix/polar-periodic-stress-1642
Open

Include long-range geometry in PolarMACE stress#1678
darthjaja6 wants to merge 3 commits into
ACEsuit:developfrom
darthjaja6:fix/polar-periodic-stress-1642

Conversation

@darthjaja6

Copy link
Copy Markdown
Contributor

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.

@darthjaja6
darthjaja6 force-pushed the fix/polar-periodic-stress-1642 branch from f736a12 to d896cf3 Compare August 21, 2026 16:31

@aacostadiaz aacostadiaz left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

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.

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.

PolarMACE periodic stress may omit explicit strain dependence of the long-range electrostatic energy

2 participants