lab-cosmo / librascal

A scalable and versatile library to generate representations for atomic-scale learning
https://lab-cosmo.github.io/librascal/
GNU Lesser General Public License v2.1
80 stars 17 forks source link

implementation of central and neighbour mask for spherical expansions #420

Open agoscinski opened 1 year ago

agoscinski commented 1 year ago

This is the work extracted from the feat/plumed branch to limit the computation only on specific species similar as the central atoms mask feature, but this supports gradient computation. It does not change the size of the gradients and features. It will just return zeros for atoms that are not masked. It also supports the limitation on species neighbour species.

The reason why I did not want to extend the central atoms mask feature was that this implies a change in the object size (number of samples changes), which causes more places in the code than just one file. To support the computation of the gradients, we also need to consider the computation of central atoms that are not in the mask, but have a neighbour in the mask in their environment. Currently the central atoms mask is applied in the center structure manager, but to consider neighbours we would need to move it to adapter strict. This causes to deal with multiple files, the structure manager object, and the change in the property size made several other places in the code complain, such that I did not wanted to go further with this approach.

Also one advantage is that the interface does not need to be updated (the interface does not need to add a central atom mask into the structure). For the scope of this, using it for 2-3 projects I think it is the best solution.

For spherical invariants a bit more work has to be done. But it should already profit from the mask applied on spherical expansions

I mean it is like Michele said a straightforward change.

The tests work, tested locally on IMX cluster, because our CI tests here are broken