code: def sub_chempots(gamma_dict, chempots):
      
  
      coeffs = [gamma_dict[k] for k in gamma_dict.keys()]
      chempot_vals = []
      for k in gamma_dict.keys():
          if k not in chempots.keys():
              chempot_vals.append(k)
          elif k == 1:
              chempot_vals.append(1)
          else:
              chempot_vals.append(chempots[k])
  
      return np.dot(coeffs, chempot_vals)
docs: Uses dot product of numpy array to sub chemical potentials
          into the surface grand potential. This is much faster
          than using the subs function in sympy.
      Args:
          gamma_dict (dict): Surface grand potential equation
              as a coefficient dictionary
          chempots (dict): Dictionary assigning each chemical
              potential (key) in gamma a value
      Returns:
          Surface energy as a float