If you want to have a prof from a class you did real well in write you a letter, my suggestion is to build up an informal relationship with the professor at some point and have a few good talks with him/her. I've done this with nearly all of my professors to varying degrees (being part of a very large university but a reasonably small department helped to some extent), and two of them wrote me recommendations, while my other two recs came from research advisors. Both had taught two of my advanced courses each, and I had frequent conversations with both over the course of a couple years (one had even been my advisor since I transferred in to the physics curriculum from engineering). Even if you do phenomenally well in your coursework, that's only going to give your professor about a paragraph of material to write about. But if you've sat down and talked with them about your aspirations, asked for advice, discussed the future of physics and its subfields, or even just remarked about how much you love the curriculum, that will give them a basis to turn that single paragraph into a page full of flattering remarks. Don't be bashful, get to know them...unless they're complete douchebags, they will eventually have a free moment to talk (and it never hurts to initiate a conversation by asking them to talk about their own research...same rule of thumb applies when asking about a potential research job).