def split_traj_by_residues(traj, start=0, stop=-1, step=1):
    """return a generator

    Examples
    --------
    >>> import pytraj as pt
    >>> traj = pt.datafiles.load_rna()
    >>> g = pt.tools.split_traj_by_residues(traj)
    >>> t0 = next(g)
    >>> print(t0.top.n_residues)
    1
    """
    from pytraj.externals.six.moves import range
    from pytraj.utils.cyutils import get_positive_idx
    _stop = get_positive_idx(stop, traj.top.n_residues)
    for i in range(start, _stop, step):
        j = ':' + str(i + 1)
        yield traj[j]
