If you want to stop thinking about someone, you should try to find something to keep your mind occupied. It could be your work, your family, friends, a new hobby, or a new special someone. It doesn’t really matter what or who it is as long as you keep your mind off that person.
Avoid being alone or idle, because your thoughts will surely go back to him. Ask your friends when’s the next get-together is and prepare to go out with them. But if you really want to be productive while trying to forget about your failed relationship, then devote all your time to your work. Take extra load, or go on long overtimes and soon your mind will accept the fact that there’s no place for your ex in there.