Trying to fix the changes caused by making rGeom more like pGeom.

The changes two commits ago in 
e05b644e2c44b356df16a63f62ed034395b4ff7f
seemed like a good idea, but the subsequent commit re-enabled a bunch of code
that reveals there are many consequences.
I still think it may be a good idea, but am getting deeper into a hole.
Committing now, so I can get back out of the hole, even though this is not yet complete...
Re-enable (and slightly refactor) the QM calculations in double ended method.

Rearranged the ordering of the if blocks a bit, to make them less deeply nested.
Hopefully didn't change what it actually does (apart from the fact that it was
commented out)

This is like the commit of the same name on the other branch, but without
the "rGeom" problems...
Merge branch 'embed' and 'embed-fix', removing the mess on 'embed'

I'm leaving those commits in history because
1) my history is already public and I think Pierre may have pulled it
2) it wasn't a bad idea, and maybe we should do it one day.

However, I was getting in a big hole, so I have replaced it with
this fix, which I think is functioning.