Accurate density-functional calculation of core-electron binding energies by a total-energy difference approach | Synapse