@not_in_run<EOL><INDENT>def f_iter_runs(self, start=<NUM_LIT:0>, stop=None, step=<NUM_LIT:1>, yields='<STR_LIT:name>'):<DEDENT>
if stop is None:<EOL><INDENT>stop =len(self)<EOL><DEDENT>elif stop > len(self):<EOL><INDENT>raise ValueError('<STR_LIT>')<EOL><DEDENT>yields = yields.lower()<EOL>if yields == '<STR_LIT:name>':<EOL><INDENT>yield_func = lambda x: self.f_idx_to_run(x)<EOL><DEDENT>elif yields == '<STR_LIT>':<EOL><INDENT>yield_func = lambda x: x<EOL><DEDENT>elif yields == '<STR_LIT>':<EOL><INDENT>yield_func = lambda x: self<EOL><DEDENT>elif yields == '<STR_LIT>':<EOL><INDENT>yield_func = lambda x: self.__copy__()<EOL><DEDENT>else:<EOL><INDENT>raise ValueError('<STR_LIT>')<EOL><DEDENT>for idx in range(start, stop, step):<EOL><INDENT>self.f_set_crun(idx)<EOL>yield yield_func(idx)<EOL><DEDENT>self.f_set_crun(None)<EOL>
Makes the trajectory iterate over all runs.

        :param start: Start index of run

        :param stop: Stop index, leave ``None`` for length of trajectory

        :param step: Stepsize

        :param yields:

            What should be yielded: ``'name'`` of run, ``idx`` of run
            or ``'self'`` to simply return the trajectory container.

            You can also pick ``'copy'`` to get **shallow** copies (ie the tree is copied but
            no leave nodes except explored ones.) of your trajectory,
            might lead to some of overhead.

        Note that after a full iteration, the trajectory is set back to normal.

        Thus, the following code snippet

        ::

            for run_name in traj.f_iter_runs():

                 # Do some stuff here...


        is equivalent to

        ::

            for run_name in traj.f_get_run_names(sort=True):
                traj.f_set_crun(run_name)

                # Do some stuff here...

            traj.f_set_crun(None)


        :return:

            Iterator over runs. The iterator itself will return the run names but modify
            the trajectory in each iteration and set it back do normal in the end.