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

Add CPP NL converter for PET #289

Merged
merged 15 commits into from
Jul 15, 2024
Merged

Add CPP NL converter for PET #289

merged 15 commits into from
Jul 15, 2024

Conversation

abmazitov
Copy link
Contributor

@abmazitov abmazitov commented Jul 10, 2024

This commit adds a workaround for a PET neighborlist conververter, which takes the NL in the ASE format and converts it to a PET-compatible format, which is required by the PET message-passing subroutines. It also adds a pure-torch implementation of the same conversion for benchmarking purposes.

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)?

📚 Documentation preview 📚: https://metatrain--289.org.readthedocs.build/en/289/

@abmazitov abmazitov requested a review from spozdn as a code owner July 10, 2024 11:38
@frostedoyster frostedoyster linked an issue Jul 10, 2024 that may be closed by this pull request
@spozdn
Copy link
Contributor

spozdn commented Jul 14, 2024

I have fixed your issue with spozdn/pet@e6c4a02
@Luthaf you might want to take a look

@spozdn spozdn requested a review from Luthaf July 14, 2024 16:15
@@ -5,6 +5,21 @@
from metatensor.torch.atomistic import NeighborListOptions, System


def process_neighbors(
Copy link
Member

Choose a reason for hiding this comment

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

why do you redefine a function that just calls the operation?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Not sure 100%. I took this piece of code from the original pet repo, and there was a reason (maybe TorchScript related) to wrap this up. I'll try to remove the wrapper and we'll see how it goes

Copy link
Member

Choose a reason for hiding this comment

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

the only reason I could see would be to use keyword arguments, but there is a way to do this directly with the C++ operation (requiring some small changes to the function registration)

return system_dict


def get_system_batch_dict_old(
Copy link
Member

Choose a reason for hiding this comment

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

is this function still used?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

It is not used, but this is a pure torch implementation of the converter, that (1) contains the code that we can use for benchmarking and (2) contains a lot of comments on how the data is stored in PET. In principle, I can remove it, but I want to at least save the comments somehow.

Copy link
Member

Choose a reason for hiding this comment

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

you can add a large comment on top of this file explaining the data format!

@Luthaf
Copy link
Member

Luthaf commented Jul 15, 2024

@Luthaf you might want to take a look

I checked the code here, and it seems mostly fine. The PET commit you linked looks good as well, so I think the main remaining issue for smooth integration with LAMMPS & friends will be spozdn/pet#17

@abmazitov abmazitov requested a review from Luthaf July 15, 2024 12:03
Copy link
Member

@Luthaf Luthaf left a comment

Choose a reason for hiding this comment

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

The changes looks good to me and are only touching the architecture both of you are maintaining!

@abmazitov abmazitov merged commit b24d1d4 into main Jul 15, 2024
13 checks passed
@abmazitov abmazitov deleted the pet-cpp-nl-converter branch July 15, 2024 12:10
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.

Dramatic overhead of metatrain for MD in LAMMPS
4 participants