The energy of semicoherent interfaces