Code for Test Particles & AP effect