Skip to content

Conversation

E-Rum
Copy link
Contributor

@E-Rum E-Rum commented Aug 20, 2025

At some point, if we want to proceed with batching, we need to introduce padding to the inputs. This is the first commit that introduces initial padding only for the direct calculator and the Coulomb potential.

Contributor (creator of pull-request) checklist

  • Tests updated (for new features and bugfixes)?
  • Documentation updated (for new features)?
  • Issue referenced (for PRs that solve an issue)?

Reviewer checklist

  • CHANGELOG updated with public API or any other important changes?

📚 Documentation preview 📚: https://torch-pme--199.org.readthedocs.build/en/199/

@E-Rum E-Rum linked an issue Oct 10, 2025 that may be closed by this pull request
@E-Rum
Copy link
Contributor Author

E-Rum commented Oct 10, 2025

I think this is it.
The main changes I’ve made so far, besides adding batching, are: I removed tests that check for a non-zero cell. Honestly, I think we can actually get rid of these permanently, because at some point an error will be raised anyway when we take cell.inv— and it will throw an error.

Another thing I’ve removed for now is the check for the periodicity boolean tensor. Previously, we allowed only 2D and 3D tensors. To enable batching, I removed these checks, so now if a 1D or 0D tensor is passed to ewald, we just silently return a 0 contribution. I think this is fine for the purposes of training models, but of course it’s not ideal from a design or user-friendly perspective.

Note: batching is now allowed only for systems of the same type: either all systems are PBC or all are non-PBC. Probably @sirmarcel implemented something fancier in the JAX PME version, but I think it’s impossible to do it here without creating a separate calculator. Therefore, training for mixed PBC systems would probably require two dataloaders, which I think is fine.

@E-Rum E-Rum requested a review from PicoCentauri October 10, 2025 14:16
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.

Batched calculator over structures

1 participant