This method is called when all the q-points have been computed.
        It runs `mrgddb` in sequential on the local machine to produce
        the final DDB file in the outdir of the `Work`.

        Args:
            delete_source_ddbs: True if input DDB should be removed once final DDB is created.
            only_dfpt_tasks: False to merge all DDB files produced by the tasks of the work
                Useful e.g. for finite stress corrections in which the stress in the
                initial configuration should be merged in the final DDB.
            exclude_tasks: List of tasks that should be excluded when merging the partial DDB files.
            include_tasks: List of tasks that should be included when merging the partial DDB files.
                Mutually exclusive with exclude_tasks.

        Returns:
            path to the output DDB file

def merge_ddb_files(self, delete_source_ddbs=True, only_dfpt_tasks=True,
                        exclude_tasks=None, include_tasks=None):
        """
        This method is called when all the q-points have been computed.
        It runs `mrgddb` in sequential on the local machine to produce
        the final DDB file in the outdir of the `Work`.

        Args:
            delete_source_ddbs: True if input DDB should be removed once final DDB is created.
            only_dfpt_tasks: False to merge all DDB files produced by the tasks of the work
                Useful e.g. for finite stress corrections in which the stress in the
                initial configuration should be merged in the final DDB.
            exclude_tasks: List of tasks that should be excluded when merging the partial DDB files.
            include_tasks: List of tasks that should be included when merging the partial DDB files.
                Mutually exclusive with exclude_tasks.

        Returns:
            path to the output DDB file
        """
        if exclude_tasks:
            my_tasks = [task for task in self if task not in exclude_tasks]
        elif include_tasks:
            my_tasks = [task for task in self if task in include_tasks]
        else:
            my_tasks = [task for task in self]

        if only_dfpt_tasks:
            ddb_files = list(filter(None, [task.outdir.has_abiext("DDB") for task in my_tasks \
                                       if isinstance(task, DfptTask)]))
        else:
            ddb_files = list(filter(None, [task.outdir.has_abiext("DDB") for task in my_tasks]))

        self.history.info("Will call mrgddb to merge %s DDB files:" % len(ddb_files))
        # DDB files are always produces so this should never happen!
        if not ddb_files:
            raise RuntimeError("Cannot find any DDB file to merge by the task of " % self)

        # Final DDB file will be produced in the outdir of the work.
        out_ddb = self.outdir.path_in("out_DDB")

        if len(ddb_files) == 1:
            # Avoid the merge. Just copy the DDB file to the outdir of the work.
            shutil.copy(ddb_files[0], out_ddb)
        else:
            # Call mrgddb
            desc = "DDB file merged by %s on %s" % (self.__class__.__name__, time.asctime())
            mrgddb = wrappers.Mrgddb(manager=self[0].manager, verbose=0)
            mrgddb.merge(self.outdir.path, ddb_files, out_ddb=out_ddb, description=desc,
                         delete_source_ddbs=delete_source_ddbs)

        return out_ddb