def tag_kinds(atoms):
    """Tag different atom kinds, depending on oxidation state, magnetization, etc.

    E.g. if there are 4 different types of 'Fe', tag them with 1,2,3 and 4.
    """
    # Prepare dictionary [symbol][magnetization] => tag  (tag is 0, if only single oxidation state)
    symbols = set(atoms.get_chemical_symbols())

    def get_kind(atom):
        return f"{{'symbol': {atom.symbol}, 'charge': {atom.charge}, 'magmom': {atom.magmom}}}"

    element_groups = [[atom for atom in atoms if atom.symbol == symbol] for symbol in symbols]
    for group in element_groups:
        kinds = sorted({get_kind(atom) for atom in group})

        if len(kinds) == 1:
            # we don't tag if all atoms of the element have the same properties
            continue

        for atom in group:
            atom.tag = kinds.index(get_kind(atom)) + 1

    return atoms