correct for periodicity. added enforce_domain to update_partilces