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)