Open thesamriel opened 10 months ago
I will be looking into this for the AVX512 Single-Site functor which I am developing as part of #784 . This should, ofc, be investigated individually on a range of architectures before making any changes to the AutoVec, AVX, and SVE functors but I can at the very least provide an initial investigation with AVX512, if not investigate this on a range of architectures with a range of instructions/functors.
By default, md-flexible is compiled with a mixing functionality, meaning we can have several types of particles in our simulation. In the force functors, we retrieve the mixed coefficients from a ParticlePropertiesLibrary, essentially a look-up table. E.g., for the Lennard-Jones functor we need
sigmaSquared
andepsilon24
.In our practical course MD-Lab, students reported getting worse results using such a look-up table, compared to directly calculating the mixed coefficients in the functor. Therefore, we should reevaluate if this might be true for md-flexible as well.
The mixing rules for the LJ parameters are:
$$ \sigma_{ij} = \frac{\sigma_i + \sigma_j}{2} $$
$$ \epsilon_{ij} = \sqrt{\epsilon_i \epsilon_j} $$
We probably decided for recalculated look-up tables to avoid the costly squareroot operation. However, the additional memory access might turn out to be even more expensive. Results may vary for AoS and SoA.
Additional idea: Instead of storing only epsilons, we could store the square roots of epsilon to calculate $\epsilon_{ij} = \sqrt{\epsilon_i}\sqrt{ \epsilon_j}$