code: def center_of_mass(self):
          
          weights = [s.species.weight for s in self]
          center_of_mass = np.average(self.frac_coords,
                                      weights=weights, axis=0)
          return center_of_mass
docs: Calculates the center of mass of the slab