Changed so that particles weights are calculated in logarithmic
scale to improve numerical issues.