The attached notebook has a Mathematica function which tabulates elements in a given chemical formula and gives the number of respective atoms. From then on, it is easy to calculate molecular weight or any other calculation pertaining to individual atoms.