pytorch_cluster
pytorch_cluster copied to clipboard
Add Support for Periodic Boundary Conditions in radius_graph
Hi PyTorch Geometric Team,
I’m using the radius_graph function extensively in my research and would love to see support for periodic boundary conditions (PBC). This feature would be especially useful in applications involving molecular simulations or crystalline systems, where periodicity needs to be accounted for when constructing the graph.
Proposed Feature
- Add an optional
pbcargument toradius_graphto enable periodic boundary conditions. - Incorporate the minimum image convention (MIC) to ensure distances are computed correctly across periodic boundaries.
- Ideally, the implementation should accept a cell parameter or a box tensor that defines the unit cell dimensions.
Key Considerations
- It’s unclear if the minimum image convention can be implemented efficiently within the current framework. Would it be feasible to extend the existing code to support this?
- Supporting PBC could greatly benefit researchers working with molecular dynamics, crystallography, and related fields.
Potential API:
edge_index = radius_graph(pos, r, pbc=True, cell=torch.tensor([[a, 0, 0], [0, b, 0], [0, 0, c]]))
Motivation
Handling periodicity correctly in distance calculations would allow radius_graph to be more applicable in domains such as materials science and chemistry, where systems often exist within periodic boundaries.
I’d be happy to discuss this further or contribute to testing if this feature is feasible. Thanks for all the great work on PyTorch Geometric!