Calculating the number of atoms/ions