nodes: 0, module; 1, function_definition; 2, function_name:_format_ase2clusgeo; 3, parameters; 4, block; 5, identifier:obj; 6, default_parameter; 7, expression_statement; 8, comment:#atoms metadata; 9, expression_statement; 10, if_statement; 11, expression_statement; 12, expression_statement; 13, expression_statement; 14, for_statement; 15, expression_statement; 16, expression_statement; 17, expression_statement; 18, expression_statement; 19, return_statement; 20, identifier:all_atomtypes; 21, None; 22, comment:""" Takes an ase Atoms object and returns numpy arrays and integers
      which are read by the internal clusgeo. Apos is currently a flattened
      out numpy array
  
      Args:
          obj():
          all_atomtypes():
          sort():
      """; 23, assignment; 24, comparison_operator:all_atomtypes is not None; 25, block; 26, else_clause; 27, assignment; 28, assignment; 29, assignment; 30, identifier:atomtype; 31, identifier:atomtype_lst; 32, block; 33, assignment; 34, assignment; 35, identifier:atomtype_lst; 36, assignment; 37, expression_list; 38, identifier:totalAN; 39, call; 40, identifier:all_atomtypes; 41, None; 42, expression_statement; 43, block; 44, identifier:atomtype_lst; 45, call; 46, identifier:n_atoms_per_type_lst; 47, list; 48, identifier:pos_lst; 49, list; 50, expression_statement; 51, expression_statement; 52, expression_statement; 53, comment:# store data in lists; 54, expression_statement; 55, expression_statement; 56, identifier:typeNs; 57, identifier:n_atoms_per_type_lst; 58, identifier:Ntypes; 59, call; 60, identifier:Apos; 61, call; 62, identifier:Apos; 63, identifier:typeNs; 64, identifier:Ntypes; 65, identifier:atomtype_lst; 66, identifier:totalAN; 67, identifier:len; 68, argument_list; 69, assignment; 70, expression_statement; 71, attribute; 72, argument_list; 73, assignment; 74, assignment; 75, assignment; 76, call; 77, call; 78, identifier:len; 79, argument_list; 80, attribute; 81, argument_list; 82, identifier:obj; 83, identifier:atomtype_set; 84, call; 85, assignment; 86, identifier:np; 87, identifier:sort; 88, call; 89, identifier:condition; 90, comparison_operator:obj.get_atomic_numbers() == atomtype; 91, identifier:pos_onetype; 92, subscript; 93, identifier:n_onetype; 94, subscript; 95, attribute; 96, argument_list; 97, attribute; 98, argument_list; 99, identifier:n_atoms_per_type_lst; 100, call; 101, identifier:ravel; 102, identifier:set; 103, argument_list; 104, identifier:atomtype_set; 105, call; 106, identifier:list; 107, argument_list; 108, call; 109, identifier:atomtype; 110, call; 111, identifier:condition; 112, attribute; 113, integer:0; 114, identifier:pos_lst; 115, identifier:append; 116, identifier:pos_onetype; 117, identifier:n_atoms_per_type_lst; 118, identifier:append; 119, identifier:n_onetype; 120, attribute; 121, argument_list; 122, identifier:all_atomtypes; 123, identifier:set; 124, argument_list; 125, identifier:atomtype_set; 126, attribute; 127, argument_list; 128, attribute; 129, argument_list; 130, identifier:pos_onetype; 131, identifier:shape; 132, identifier:np; 133, identifier:concatenate; 134, identifier:pos_lst; 135, call; 136, identifier:obj; 137, identifier:get_atomic_numbers; 138, identifier:obj; 139, identifier:get_positions; 140, attribute; 141, argument_list; 142, identifier:obj; 143, identifier:get_atomic_numbers
code: def _format_ase2clusgeo(obj, all_atomtypes=None):
      """ Takes an ase Atoms object and returns numpy arrays and integers
      which are read by the internal clusgeo. Apos is currently a flattened
      out numpy array
  
      Args:
          obj():
          all_atomtypes():
          sort():
      """
      #atoms metadata
      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]
  
          # store data in lists
          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