Georgina, Duchess of Devonshire, the 18th-century aristocrat played by Keira Knightley in her latest film, The Duchess, was treated at London's first sex clinic, a book published this month will reveal.

Devastated by her failure to provide a male heir for an unloving husband, Georgiana, who was the society It Girl of her day, was introduced to the pioneering Dr James Graham by her mother, Lady Spencer. After enduring a series of unlikely procedures, such as repeated ice cold champagne douches, the duchess was persuaded to lie with her feet above her head after sexual intercourse.

The neglected wife, gambling addict and political campaigner was among a number of influential men and women who visited Graham's extraordinary therapeutic establishment.

The story of the rise and fall of a man who also notoriously launched the society career of the adventuress Lady Emma Hamilton, the great love of Admiral Lord Nelson, is told for the first time in Doctor of Love, Lydia Syson's biography of Graham.

The young Lady Hamilton, or plain Emy Lyon from north Wales as she was then, was picked up by the Scottish doctor on the streets near his clinic, known as the Temple of Health, at the Adelphi, off the Strand in London. She had been plying her trade as a prostitute.

Lyon was quickly installed in Graham's temple as Hebe Vestina, the Rosy Goddess of Youth and Health, and instructed in a series of poses that represented the ideal of the fruitful woman. Dressed in Grecian sandals and flowing garments, it was here she was first spotted by her future husband, the ageing diplomat, William Hamilton, and her place in high society was secured.

Graham's lavish erotic therapy centre, complete with celestial bed, became one of the most fashionable destinations for the aristocracy of the day. It promised increased sexual pleasure and fertility through a series of electrical pulses and intoxicating aromas. And it cost £50.

Although an ardent supporter of Graham, Georgiana's mother chronicled the treatment her daughter received in astonished tones. She had 'every night and morning, I believe for several months to pour a whole large flask of the same water, or of the Champaign wine, cooled in ice, into and upon the fountain of life!'.

Such quirky practices made Graham and his patients, who often arrived at the temple disguised by masks or veils, the targets of popular ridicule.

Another celebrity visitor to the temple was the actress Mary Robinson. At the time Robinson was known throughout England as Perdita, a nickname that came from the character she had played in a production of Shakespeare's The Winter's Tale. The 17-year-old Prince of Wales had seen her in the role in 1779 and promptly made her his mistress.

Robinson visited Graham, it is now believed, in a last-ditch attempt to become pregnant and so claim some living from the royal purse.

Like Georgiana, she benefited from treatments such as the celestial bed, which was tilted up at the feet end to promote conception. It is a medically unproved theory, but one still in currency. It was recently hailed as more effective than IVF by Cuban-American singer Gloria Estefan, who claimed she had passed on the tip to rock queen Madonna after hearing it first from the late former TV presenter Paula Yates, a mother of four children.

Born in Edinburgh in 1745, Graham travelled to America after training in medicine and learned about electricity from the scientist Ebenezer Kinnersley, a close associate of Benjamin Franklin. He immediately began work on a prototype of the celestial bed.

In 1781, Graham moved his temple to new premises in Pall Mall, big enough to house an improved bed. This canopied contraption was 12ft by 9ft, covered with clockwork musical figures and adorned with a cage containing turtle doves. The movements of the occupants of the bed set off music through organ pipes which sounded with increasing tempo as their encounter went on.

Towards the end of his life Graham became obsessed with a new therapy called earthbathing which involved being buried up to the neck in soil. He underwent a series of religious revelations too, some leading him into mania.

Before he died in Edinburgh in 1794 he had begun to experiment with the idea of fasting to prolong his life.