Move ComputeEnergy into public method.