def get_natoms_element(formula):
    """
    Converts 'Be24W2' to {'Be': 24, 'W' : 2}, also BeW to {'Be' : 1, 'W' : 1}
    """
    import re
    elem_count_dict = {}
    elements = re.findall('[A-Z][^A-Z]*', formula)
    for i, elm in enumerate(elements):
        elem_count = re.findall('\\d+|\\D+', elm)
        if len(elem_count) == 1:
            elem_count_dict[elem_count[0]] = 1
        else:
            elem_count_dict[elem_count[0]] = float(elem_count[1])
    return elem_count_dict
