def are_equal(self, d1, d2):
        """
        Args:
            d1: First defect. A pymatgen Defect object.
            d2: Second defect. A pymatgen Defect object.

        Returns:
            True if defects are identical in type and sublattice.
        """
        possible_defect_types = (Defect, Vacancy, Substitution, Interstitial)

        if not isinstance(d1, possible_defect_types) or \
            not isinstance(d2, possible_defect_types):
            raise ValueError("Cannot use PointDefectComparator to" + \
                             " compare non-defect objects...")

        if not isinstance(d1, d2.__class__):
            return False
        elif d1.site.specie != d2.site.specie:
            return False
        elif self.check_charge and (d1.charge != d2.charge):
            return False

        sm = StructureMatcher( ltol=0.01,
                               primitive_cell=self.check_primitive_cell,
                               scale=self.check_lattice_scale)

        if not sm.fit(d1.bulk_structure, d2.bulk_structure):
            return False

        d1 = d1.copy()
        d2 = d2.copy()
        if self.check_primitive_cell or self.check_lattice_scale:
            # if allowing for base structure volume or supercell modifications,
            # then need to preprocess defect objects to allow for matching
            d1_mod_bulk_structure, d2_mod_bulk_structure, _, _ = sm._preprocess(
                d1.bulk_structure, d2.bulk_structure)
            d1_defect_site = PeriodicSite(d1.site.specie, d1.site.coords,
                                          d1_mod_bulk_structure.lattice,
                                          to_unit_cell=True,
                                          coords_are_cartesian=True)
            d2_defect_site = PeriodicSite( d2.site.specie, d2.site.coords,
                                           d2_mod_bulk_structure.lattice,
                                           to_unit_cell=True,
                                           coords_are_cartesian=True)

            d1._structure = d1_mod_bulk_structure
            d2._structure = d2_mod_bulk_structure
            d1._defect_site = d1_defect_site
            d2._defect_site = d2_defect_site

        return sm.fit(d1.generate_defect_structure(),
                      d2.generate_defect_structure())