Calculation of molecular weight