An atomistic model of switching in FePt nanoparticles