code: def as_dict(self):
          
          d = {"@module": self.__class__.__module__,
               "@class": self.__class__.__name__,
               "are_coops": self.are_coops,
               "efermi": self.efermi,
               "energies": self.energies.tolist(),
               "COHP": {str(spin): pops.tolist()
                        for spin, pops in self.cohp.items()}}
          if self.icohp:
              d["ICOHP"] = {str(spin): pops.tolist()
                            for spin, pops in self.icohp.items()}
          return d
docs: Json-serializable dict representation of COHP.