code: def _format_ase2clusgeo(obj, all_atomtypes=None):
      totalAN = len(obj)
      if all_atomtypes is not None:
          atomtype_set = set(all_atomtypes)
      else:
          atomtype_set = set(obj.get_atomic_numbers())
      atomtype_lst = np.sort(list(atomtype_set))
      n_atoms_per_type_lst = []
      pos_lst = []
      for atomtype in atomtype_lst:
          condition = obj.get_atomic_numbers() == atomtype
          pos_onetype = obj.get_positions()[condition]
          n_onetype = pos_onetype.shape[0]
          pos_lst.append(pos_onetype)
          n_atoms_per_type_lst.append(n_onetype)
      typeNs = n_atoms_per_type_lst
      Ntypes = len(n_atoms_per_type_lst)
      atomtype_lst
      Apos = np.concatenate(pos_lst).ravel()
      return Apos, typeNs, Ntypes, atomtype_lst, totalAN