If you have a mechanical model of the structure and the time-series of the acceleration of the earthquake, then using the definitions of the absorbed/dissipated energy would give you the answer (because you would have force, displacement, velocity...).