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

ASE Backend For PBC Computation #310

Merged
merged 4 commits into from
Oct 22, 2024
Merged

Conversation

melo-gonzo
Copy link
Collaborator

@melo-gonzo melo-gonzo commented Oct 21, 2024

This PR adds a flag to the PeriodicBoundaryCondition transform to use either pymatgen or ase as a backend. The ASE backend is implemented and makes use of the NeighborList utility in ASE. This requires creating an atoms object, and specifying a cutoff distance per node. The two functions calculate_ase_periodic_shifts and calculate_periodic_shifts are quite similar, however hard to combine due to the dependency on the different backends, so they are kept separate for now.

Some parameters that may have an impact on results:
NeighborList: self_interaction, bothways
Atoms: pbc

For example, blindly applying PBC in x, y, and z for a structure which is not meant to be periodic in these directions may impact results.

Copy link
Collaborator

@laserkelvin laserkelvin left a comment

Choose a reason for hiding this comment

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

Added minor comments, but the I might have a bigger lift/ask: could you write a unit test to ensure the products (i.e. offsets, src and dst nodes) are the same?

You could potentially do a really high level comparison: make torch_geometric.data.Data with the edges from both algorithms, pack the data into the graphs, and just do a pmg_graph == ase_graph assertion.

matsciml/datasets/transforms/pbc.py Outdated Show resolved Hide resolved
matsciml/datasets/utils.py Show resolved Hide resolved
@laserkelvin laserkelvin added the enhancement New feature or request label Oct 21, 2024
@laserkelvin
Copy link
Collaborator

Related to #267 - possibly leading up to replacing pymatgen with equivalent ase functionality.

@melo-gonzo
Copy link
Collaborator Author

I also added two tests to check for equivalence of src and dst node calculation here

Copy link
Collaborator

@laserkelvin laserkelvin left a comment

Choose a reason for hiding this comment

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

LGTM, thanks for doing this!

@laserkelvin laserkelvin merged commit 5192eaa into IntelLabs:main Oct 22, 2024
2 of 3 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants