got rid of wrapping errors in ewald and distance matrices