Function useful to read bands from Boltztrap output and get a
            BandStructureSymmLine object comparable with that one from a DFT
            calculation (if the same kpt_line is provided). Default kpt_line
            and labels_dict is the standard path of high symmetry k-point for
            the specified structure. They could be extracted from the
            BandStructureSymmLine object that you want to compare with. efermi
            variable must be specified to create the BandStructureSymmLine
            object (usually it comes from DFT or Boltztrap calc)

def get_symm_bands(self, structure, efermi, kpt_line=None,
                       labels_dict=None):
        """
            Function useful to read bands from Boltztrap output and get a
            BandStructureSymmLine object comparable with that one from a DFT
            calculation (if the same kpt_line is provided). Default kpt_line
            and labels_dict is the standard path of high symmetry k-point for
            the specified structure. They could be extracted from the
            BandStructureSymmLine object that you want to compare with. efermi
            variable must be specified to create the BandStructureSymmLine
            object (usually it comes from DFT or Boltztrap calc)
        """
        try:
            if kpt_line is None:
                kpath = HighSymmKpath(structure)
                kpt_line = [Kpoint(k, structure.lattice.reciprocal_lattice) for
                            k in
                            kpath.get_kpoints(coords_are_cartesian=False)[0]]
                labels_dict = {l: k for k, l in zip(
                    *kpath.get_kpoints(coords_are_cartesian=False)) if l}
                kpt_line = [kp.frac_coords for kp in kpt_line]
            elif type(kpt_line[0]) == Kpoint:
                kpt_line = [kp.frac_coords for kp in kpt_line]
                labels_dict = {k: labels_dict[k].frac_coords for k in
                               labels_dict}

            idx_list = []
            #       kpt_dense=np.array([kp for kp in self._bz_kpoints])
            for i, kp in enumerate(kpt_line):
                w = []
                prec = 1e-05
                while len(w) == 0:
                    w = np.where(np.all(
                        np.abs(kp - self._bz_kpoints) < [prec] * 3,
                        axis=1))[0]
                    prec *= 10

                # print( prec )
                idx_list.append([i, w[0]])

                # if len(w)>0:
                #     idx_list.append([i,w[0]])
                # else:
                #     w=np.where(np.all(np.abs(kp.frac_coords-self._bz_kpoints)
                # <[1e-04,1e-04,1e-04],axis=1))[0]
                #     idx_list.append([i,w[0]])

            idx_list = np.array(idx_list)
            # print( idx_list.shape )

            bands_dict = {Spin.up: (self._bz_bands * Energy(1, "Ry").to(
                "eV") + efermi).T[:, idx_list[:, 1]].tolist()}
            # bz_kpoints = bz_kpoints[idx_list[:,1]].tolist()

            sbs = BandStructureSymmLine(kpt_line, bands_dict,
                                        structure.lattice.reciprocal_lattice,
                                        efermi,
                                        labels_dict=labels_dict)

            return sbs

        except:
            raise BoltztrapError(
                "Bands are not in output of BoltzTraP.\nBolztrapRunner must "
                "be run with run_type=BANDS")