Rest energy and mass calculation