d_K wasnt set, now working, periodic boundaries not working correctly