Skip to content

fix(electrostatics): apply slab correction in Ewald and PME - #614

Merged
CompRhys merged 1 commit into
TorchSim:mainfrom
lil-lon:fix/ewald-pme-slab-correction
Oct 12, 2026
Merged

CompRhys merged 1 commit into
TorchSim:mainfrom
lil-lon:fix/ewald-pme-slab-correction

Conversation

@lil-lon

@lil-lon lil-lon commented Oct 12, 2026

Copy link
Copy Markdown
Contributor

Summary

  • EwaldModel and PMEModel now pass pbc and slab_correction to ewald_summation and particle_mesh_ewald, so states with one non-periodic axis get the slab correction added in nvalchemi-toolkit-ops 0.4.0.
  • Before this change pbc only reached the neighbor list. The reciprocal-space sum treated a slab as fully periodic, so energy, forces and stress included the interaction between slab images along the non-periodic axis.
  • Added a test that compares both models with a direct Coulomb sum over the 2D lattice. This reference may be more thorough than the test suite needs, so I am happy to simplify it if you prefer.

Results change for slab states such as pbc=[True, True, False]. Fully periodic states are unaffected.

Found while investigating #606.

Checklist

Before a pull request can be merged, the following items must be checked:

  • Doc strings have been added in the Google docstring format.
  • Run ruff on your code.
  • Tests have been added for any new functionality or bug fixes.

@CompRhys

Copy link
Copy Markdown
Member

thanks for catching! in general my hope with #606 is that we can drop replace these electrostatics model's with MLIPops to become backend agnostic.

@CompRhys
CompRhys merged commit 09bec7a into TorchSim:main Oct 12, 2026
62 of 64 checks passed
@lil-lon
lil-lon deleted the fix/ewald-pme-slab-correction branch October 12, 2026 14:22
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.

2 participants