You may want to try to annoy them enough that they detach bu pointing a power head toward them, shade them, etc.
It is always best to get them to detach by themselves, however, if all else fails, very carefull tug on the clam, without ripping him off the rock, until he gets tired of fighting you and releases his grip. Being carefull here is the operative word.