What you have is Fasciculitis - muscle spasm, marked by rapid, uncoordinated contraction of many small muscle fibers
Fasciculations may be due to fatigue, cold, medications, metabolic disorders, reduced blood supply (common in smokers), nerve damage
, or neurodegenerative disease
. Fasciculations may occur at rest or after muscle contraction
, and may last several minutes..
Avoiding exercising in extreme heat helps prevent heat cramps
. Heat cramps can also be avoided by drinking ample amounts of water before prolonged exercise in hot weather
Gently and gradually stretching and massaging the affected muscle may ease the pain and hasten recovery. A massage technique that can work is applying broad pressure on the cramping muscle. Applying ice can help if cramps persist. Fluid and salt replacement, by drinking water or properly prepared "sports drinks," and/or eating fruits and salads bearing sodium, potassium, magnesium
, and calcium (bananas are a good source) can also help.
Taking a warm bath before bedtime may increase circulation to the legs and reduce the incidence of night-time leg cramp.
I hope you understand