Gets the cohesive for a material (eV per formula unit). Cohesive energy
            is defined as the difference between the bulk energy and the sum of
            total DFT energy of isolated atoms for atom elements in the bulk.
        Args:
            material_id (str): Materials Project material_id, e.g. 'mp-123'.
            per_atom (bool): Whether or not to return cohesive energy per atom
        Returns:
            Cohesive energy (eV).

def get_cohesive_energy(self, material_id, per_atom=False):
        """
        Gets the cohesive for a material (eV per formula unit). Cohesive energy
            is defined as the difference between the bulk energy and the sum of
            total DFT energy of isolated atoms for atom elements in the bulk.
        Args:
            material_id (str): Materials Project material_id, e.g. 'mp-123'.
            per_atom (bool): Whether or not to return cohesive energy per atom
        Returns:
            Cohesive energy (eV).
        """
        entry = self.get_entry_by_material_id(material_id)
        ebulk = entry.energy / \
                entry.composition.get_integer_formula_and_factor()[1]
        comp_dict = entry.composition.reduced_composition.as_dict()

        isolated_atom_e_sum, n = 0, 0
        for el in comp_dict.keys():
            e = self._make_request("/element/%s/tasks/isolated_atom" % (el),
                                  mp_decode=False)[0]
            isolated_atom_e_sum += e['output']["final_energy"] * comp_dict[el]
            n += comp_dict[el]
        ecoh_per_formula = isolated_atom_e_sum - ebulk
        return ecoh_per_formula/n if per_atom else ecoh_per_formula