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

Remove for loop from EwaldCalculator #84

Merged
merged 4 commits into from
Oct 21, 2024
Merged

Remove for loop from EwaldCalculator #84

merged 4 commits into from
Oct 21, 2024

Conversation

sirmarcel
Copy link
Contributor

@sirmarcel sirmarcel commented Oct 18, 2024

Fix #80, by @ceriottm

This passes the test suite, but I'd appreciate some feedback from @kvhuguenin or some other original dev to make sure that all the charge reshaping is handled correctly. Thanks!


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

@sirmarcel sirmarcel requested a review from kvhuguenin October 18, 2024 11:38
Copy link
Contributor

@PicoCentauri PicoCentauri left a comment

Choose a reason for hiding this comment

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

Looks good to me and if the (physical) tests pass the potential should be correct as well.

src/torchpme/calculators/ewald.py Outdated Show resolved Hide resolved
@ceriottm
Copy link
Contributor

Since we're unlikely to return on this, and since there's another version which is ~10% faster, why not implementing that? I think there's just some multidimensional charge reshaping to figure out.

@sirmarcel
Copy link
Contributor Author

I'm happy to change to your other version if/when it passes all the tests. If anyone has the bandwidth to make that happen fast, that would be great.

Replaced previous use of broadcasting with einsum,
removed check of charges shape -- this is enforced
at the calculator level now.
@sirmarcel
Copy link
Contributor Author

Pushed a more readable version. Very slightly slower than the turbo-optimised version from @ceriottm , but at least I'm confident I'll be able to still understand this in a few months. I think we should merge this ASAP and optimise more if needed later.

@PicoCentauri PicoCentauri merged commit fb22938 into main Oct 21, 2024
5 checks passed
@PicoCentauri PicoCentauri deleted the fix_ewald branch October 21, 2024 15:54
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.

Ewald calculator is extremely slow due to for loop
3 participants