def __atom_type_sortkey(atom, order=None):
    """
    Used as a key for sorting atom type for GPUMD in.xyz files

    Args:
        atom (ase.Atom):
            Atom object

        order (list(str)):
            A list of atomic symbol strings in the desired order.

    """
    if order:
        for i, sym in enumerate(order):
            if sym == atom.symbol:
                return i
    else:
        ValueError('type sortkey error: Missing order.')