adding a function to compute moment magnitude