If crossover_gap in DifferentialEvaluationMetropolisHastings is equal to 0 -- i.e. if the DE-MC algorithm is always used instead of also having normal metropolis steps -- then the sampler attempts the operation generation % crossover_gap which ends up being generation % 0 and you get a divide by zero error.