Calculates the center of mass of the slab

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