NEW YORK (Reuters) - Nighttime dreams in which you show up at work naked, encounter an ax-wielding psychopath or experience other tribulations may become a thing of the past thanks to a discovery reported on Sunday.

Applying electrical current to the brain, according to a study published online in Nature Neuroscience, induces "lucid dreaming," in which the dreamer is aware that he is dreaming and can often gain control of the ongoing plot.

The findings are the first to show that inducing brain waves of a specific frequency produces lucid dreaming.

For the study, scientists led by psychologist Ursula Voss of J.W. Goethe-University in Frankfurt, Germany, built on lab studies in which research volunteers in the REM (rapid-eye movement) stage of sleep experienced a lucid dream, as they reported when they awoke. Electroencephalograms showed that those dreams were accompanied by telltale electrical activity called gamma waves.

Those brain-waves are related to executive functions such as higher-order thinking, as well as awareness of one's mental state. But they are almost unheard of in REM sleep.

Voss and her colleagues therefore asked, if gamma waves occur naturally during lucid dreaming, what would happen if they induced a current with the same frequency as gamma waves in dreaming brains?

When they did, via electrodes on the scalp in a technique called transcranial alternating current stimulation (tACS), the 27 volunteers reported that they were aware that they were dreaming. The volunteers were also able to control the dream plot by, say, throwing some clothes on their dream self before going to work. They also felt as if their dream self was a third party whom they were merely observing.

Voss does not foresee a commercial market in lucid-dreaming machines. Devices currently sold "do not work well," she said in an interview, and those that deliver electrical stimulation to the brain, like the one in her study, "should always be monitored by a physician."

But if the results hold up, the technique might help people suffering from post-traumatic stress disorder, who often have terrifying dreams in which they re-play the traumatic experience. If they can dream lucidly, they might be able to bring about a different outcome, such as turning down a different street than the one with the roadside bomb or ducking into a restaurant before the rapist attacks them.

"By learning how to control the dream and distance oneself from the dream," Voss said, PTSD patients could reduce the emotional impact and begin to recover.

(Reporting by Sharon Begley; Editing by Dan Grebler)