code: def get_d(slab):
      
      sorted_sites = sorted(slab, key=lambda site: site.frac_coords[2])
      for i, site in enumerate(sorted_sites):
          if "%.6f" % (site.frac_coords[2]) == \
                          "%.6f" % (sorted_sites[i + 1].frac_coords[2]):
              continue
          else:
              d = abs(site.frac_coords[2] - \
                      sorted_sites[i + 1].frac_coords[2])
              break
      return slab.lattice.get_cartesian_coords([0, 0, d])[2]
docs: Determine the distance of space between
      each layer of atoms along c