def energy(mm):
  """Read total energy

  Args:
    mm (mmap): memory map
  Return:
    float: first total energy in Ry
  Example:
    >>> mm = read('scf.out')
    >>> e = energy(mm)
  """
  idx = mm.find(b'!')
  mm.seek(idx)
  eline = mm.readline()
  energy = float(eline.split()[-2])
  return energy