Skip to content

Feat/nls share - #63

Open
sayeg84 wants to merge 21 commits into
mainfrom
feat/nls_share
Open

Feat/nls share#63
sayeg84 wants to merge 21 commits into
mainfrom
feat/nls_share

Conversation

@sayeg84

@sayeg84 sayeg84 commented Aug 3, 2026

Copy link
Copy Markdown
Collaborator

PR Checklist

  • [] Bug fix
  • Feature addition/change
  • [] Documentation addition/change
  • Test addition/change
  • [] Black formatting

Describe your changes here:

Currently the implementations of the repulsions with cutoffs are naive, in the sense that they compute all the distances and then filter the ones inside the cutoff. It was originally designed like this for consistency with the previous approach, but this is clearly a bad strategy.

This modification allows for sharing the neighbor list between SchNet and the cutoffs by modifying the AtomicData object when it passes through the forward pass and saving the neighborlist in a field called neighbor_list["from_mpnn"], which then is cached by the repulsion and thrown away afterwards.

It should be noted that, given that the repulsion typically excludes some beads that are already restrained by bonds and angles, the neighbor list sharing needs to account for this. Due to this, the neighbor list associated to the repulsion needs now an index_mapping_excluded entry of shape (2,k) with "k" the number of excluded pairs, which will be excluded from the repulsion. This PR also provides a script src/mlcg/scripts/mlcg_add_exclusion_list.py to incorporate this

Empirically, this has increased speed of simulations by a significant factor.

One modification that remains to be done: to generalize this to the other MLIPs

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.

2 participants