Efficient particle labeling in atomistic simulations