Bury the rock all the way under the sand. Then GENTLY work the clam into the substrate until you feel the foot meet the rock. As a matter of fact, scratch that. DO NOT risk damaging the foot of the clam. The foot is all the clam has, literally.
Bury the rock all the way under the sand. Move some sand away from the rock so you can GENTLY place the clam on top of the rock. Once this is done move some sand back towards the foot of the clam until the sand can hold the clam upright, or in any position you wish. Within a few hours the clam should calm down and reattach.
My clams both used to "clamp" closed very frequently. They do this when they are uncomfortable I am assuming.