Construct a `PhononWfkqWork` from a :class:`ScfTask` object.
        The input files for WFQ and phonons are automatically generated from the input of the ScfTask.
        Each phonon task depends on the WFK file produced by scf_task and the associated WFQ file.

        Args:
            scf_task: ScfTask object.
            ngqpt: three integers defining the q-mesh
            with_becs: Activate calculation of Electric field and Born effective charges.
            ph_tolerance: dict {"varname": value} with the tolerance for the phonon run.
                None to use AbiPy default.
            tolwfr: tolerance used to compute WFQ.
            ddk_tolerance: dict {"varname": value} with the tolerance used in the DDK run if with_becs.
                None to use AbiPy default.
            shiftq: Q-mesh shift. Multiple shifts are not supported.
            is_ngqpt: the ngqpt is interpreted as a set of integers defining the q-mesh, otherwise
                      is an explicit list of q-points
            remove_wfkq: Remove WKQ files when the children are completed.
            manager: :class:`TaskManager` object.

        .. note:

            Use k-meshes with one shift and q-meshes that are multiple of ngkpt
            to decrease the number of WFQ files to be computed.

def from_scf_task(cls, scf_task, ngqpt, ph_tolerance=None, tolwfr=1.0e-22, nband=None,
                      with_becs=False, ddk_tolerance=None, shiftq=(0, 0, 0), is_ngqpt=True, remove_wfkq=True,
                      manager=None):
        """
        Construct a `PhononWfkqWork` from a :class:`ScfTask` object.
        The input files for WFQ and phonons are automatically generated from the input of the ScfTask.
        Each phonon task depends on the WFK file produced by scf_task and the associated WFQ file.

        Args:
            scf_task: ScfTask object.
            ngqpt: three integers defining the q-mesh
            with_becs: Activate calculation of Electric field and Born effective charges.
            ph_tolerance: dict {"varname": value} with the tolerance for the phonon run.
                None to use AbiPy default.
            tolwfr: tolerance used to compute WFQ.
            ddk_tolerance: dict {"varname": value} with the tolerance used in the DDK run if with_becs.
                None to use AbiPy default.
            shiftq: Q-mesh shift. Multiple shifts are not supported.
            is_ngqpt: the ngqpt is interpreted as a set of integers defining the q-mesh, otherwise
                      is an explicit list of q-points
            remove_wfkq: Remove WKQ files when the children are completed.
            manager: :class:`TaskManager` object.

        .. note:

            Use k-meshes with one shift and q-meshes that are multiple of ngkpt
            to decrease the number of WFQ files to be computed.
        """
        if not isinstance(scf_task, ScfTask):
            raise TypeError("task `%s` does not inherit from ScfTask" % scf_task)

        shiftq = np.reshape(shiftq, (3,))
        if is_ngqpt:
            qpoints = scf_task.input.abiget_ibz(ngkpt=ngqpt, shiftk=shiftq, kptopt=1).points
        else:
            qpoints = ngqpt

        new = cls(manager=manager)
        new.remove_wfkq = remove_wfkq
        new.wfkq_tasks = []
        new.wfkq_task_children = collections.defaultdict(list)

        if with_becs:
            # Add DDK and BECS.
            new.add_becs_from_scf_task(scf_task, ddk_tolerance, ph_tolerance)

        # Get ngkpt, shift for electrons from input.
        # Won't try to skip WFQ if multiple shifts or off-diagonal kptrlatt
        ngkpt, shiftk = scf_task.input.get_ngkpt_shiftk()
        try_to_skip_wfkq = True
        if ngkpt is None or len(shiftk) > 1 and is_ngqpt:
            try_to_skip_wfkq = True

        # TODO: One could avoid kptopt 3 by computing WFK in the IBZ and then rotating.
        # but this has to be done inside Abinit.
        for qpt in qpoints:
            is_gamma = np.sum(qpt ** 2) < 1e-12
            if with_becs and is_gamma: continue

            # Avoid WFQ if k + q = k (requires ngkpt, multiple shifts are not supported)
            need_wfkq = True
            if is_gamma:
                need_wfkq = False
            elif try_to_skip_wfkq:
                # k = (i + shiftk) / ngkpt
                qinds = np.rint(qpt * ngqpt - shiftq)
                f = (qinds * ngkpt) % ngqpt
                need_wfkq = np.any(f != 0)

            if need_wfkq:
                nscf_inp = scf_task.input.new_with_vars(qpt=qpt, nqpt=1, iscf=-2, kptopt=3, tolwfr=tolwfr)
                if nband:
                    nbdbuf = max(2,nband*0.1)
                    nscf_inp.set_vars(nband=nband+nbdbuf, nbdbuf=nbdbuf)
                wfkq_task = new.register_nscf_task(nscf_inp, deps={scf_task: ["DEN", "WFK"]})
                new.wfkq_tasks.append(wfkq_task)

            multi = scf_task.input.make_ph_inputs_qpoint(qpt, tolerance=ph_tolerance)
            for ph_inp in multi:
                deps = {scf_task: "WFK", wfkq_task: "WFQ"} if need_wfkq else {scf_task: "WFK"}
                #ph_inp["prtwf"] = -1
                t = new.register_phonon_task(ph_inp, deps=deps)
                if need_wfkq:
                    new.wfkq_task_children[wfkq_task].append(t)

        return new