code: def brute_permutation(A, B):
      
  
      rmsd_min = np.inf
      view_min = None
  
      # Sets initial ordering for row indices to [0, 1, 2, ..., len(A)], used in
      # brute-force method
  
      num_atoms = A.shape[0]
      initial_order = list(range(num_atoms))
  
      for reorder_indices in generate_permutations(initial_order, num_atoms):
  
          # Re-order the atom array and coordinate matrix
          coords_ordered = B[reorder_indices]
  
          # Calculate the RMSD between structure 1 and the Hungarian re-ordered
          # structure 2
          rmsd_temp = kabsch_rmsd(A, coords_ordered)
  
          # Replaces the atoms and coordinates with the current structure if the
          # RMSD is lower
          if rmsd_temp < rmsd_min:
              rmsd_min = rmsd_temp
              view_min = copy.deepcopy(reorder_indices)
  
      return view_min
docs: Re-orders the input atom list and xyz coordinates using the brute force
      method of permuting all rows of the input coordinates
  
      Parameters
      ----------
      A : array
          (N,D) matrix, where N is points and D is dimension
      B : array
          (N,D) matrix, where N is points and D is dimension
  
      Returns
      -------
      view : array
          (N,1) matrix, reordered view of B projected to A