choderalab / modelforge

Infrastructure to implement and train NNPs
https://modelforge.readthedocs.io/en/latest/
MIT License
9 stars 4 forks source link

System representation or compute graph should be insensitive to atom pairs with distances greater than cutoff #103

Open wiederm opened 2 months ago

wiederm commented 2 months ago

As discussed with @jchodera, the assumption that the neighbor list returns atom pairs with distances below the cutoff distance might be violated under specific scenarios. The features produced by the neural networks should be insensitive to these atom pairs.

chrisiacovella commented 2 months ago

Can you expand further on what this means? I'm not quite understanding.

wiederm commented 2 months ago

A given neighbor list implementation might not always return atom pairs with distances strictly below the cutoff distance. Therefore, the system representation of the neural network potential should ignore such atom pairs.

This is already the case for models representing their environment using atom-centered radial symmetry functions: the radial basis function goes to zero as the cutoff is approached. For other representations we need to make sure that a similar cutoff to the representation is applied.

chrisiacovella commented 2 months ago

Ah, now I understand. The way I implemented the Chiron neighbor list, it returns a mask for the neighbor list (allowing for fixed size of the array) and I use this mask as a pre-factor of the potential energy (i.e., it will multiply anything beyond the cutoff with 0 so it does not contribute to the energy, anything within the cutoff is by 1). I was thinking about how this would translate/be implemented for the NNPs.

wiederm commented 2 months ago

I think this issue has become more relevant since we realized that some of the neighborlist implementations are not able to compute distances using the minimum image convention.

jchodera commented 2 months ago

More generally, the issue is that neighborlist implementations may return a variety of valid results, such as

  1. returning only atom pairs that are exactly within cutoff
  2. returning all atom pairs within cutoff + buffer (e.g. Verlet pairlist)
  3. returning all atom pairs using the minimum-image convention (Note: We have to make sure the smallest box dimension is greater than 2*cutoff for this to be valid)

We want to make sure that the potential is computed identically with all three valid pairlists---which properly include everything within the cutoff (but maybe some extra).