calculate number of atoms