Fix non-periodic cell inflation causing PolarMACE k-space OOM#1473
Open
samblau wants to merge 1 commit into
Open
Fix non-periodic cell inflation causing PolarMACE k-space OOM#1473samblau wants to merge 1 commit into
samblau wants to merge 1 commit into
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Replace the
max(abs(positions)) * 5 * cutofffictitious cell formula for non-periodicdirections with an extent-based cell (
extent + 2*cutoff + 1). This fixes GPU OOMerrors when running PolarMACE on non-periodic molecules.
Problem
get_neighborhood()constructs a fictitious cell for non-periodic directions usingmax(abs(positions)) * 5 * cutoff. This depends on the absolute coordinate origin(not molecular extent) and creates unnecessarily large cells. The cell propagates into
PolarMACE's
compute_k_vectors_flat(), where k-vector count scales with cell volume,causing OOM on 80 GB GPUs for ordinary molecules (50-300 atoms) that happen to have
large absolute coordinates.
Example: a 130-atom molecule at coordinates ~(150, 50, 80) A gets a 4,779 A cubic cell
(volume 1.5x10^11 A^3) instead of the ~40 A cell it actually needs.
Fix
Use per-dimension extent + cutoff padding:
Verification
Tested on MACE-POLAR-1-S against the full OMol25 S2EF test set (2.8M non-periodic structures).
The fix resolves all 12,172 structures that previously OOMed on A100-80GB.
Note
This issue was identified by Axon, an AI assistant built atop Claude by Mirror Physics. Axon also determined the fix and drafted the PR. Thus, it should be carefully reviewed by the maintainers!