Centre-of-mass energy of hydrogenic ions in a magnetic field