where the return value is the score for the pair of particles separated by distance. And theÂ DistanceScoreAndDerivatives argument would be the same except that it would return a pair of doubles, on for the score and one for the derivative.
We would then (gradually), provide functor versions of the existing distance-based pair scores and implement the corresponding PairScores in terms of the functor and this template class.
For python users, we could provide a python implementation of DistancePairScore that would allow experimenting with such pair scores (but which would be rather slow).
The advantages of this over the proposed changes are mostly that of flexibility, efficiency and reduced amount of code to right. On the flexibility side, doing things this way makes it easier to create modified versions of existing pair scores (eg by weighting them) as that just requires writing a functor that calls the other functions and adds up the values with the expected weights. On the efficiency side, such an approach computes the distances and then uses them immediately, rather than storing them in memory and passing over the stored values repeatedly. And on the reduced code side, it just requires adding one non-trivial class (whose implementation already exists) and we had wanted to move the scoring computations to functors anyway (and that can be done on-demand).