On the calculation of nearest neighbors in activity coefficient models