def chem_idxs(run_str):
    '  Parses the `pes` block of the run.dat file and\n         builds a dictionary of the PESs and corresponding channels the\n         user wishes to run.\n\n         Parses the `spc` block of the run.dat file and\n         builds a dictionary of the species the\n         user wishes to run.\n\n         May break if idx is given on two lines of string.\n\n        :param run_str: string of the run.dat input file\n        :type run_str: str\n        :returns: ({pes_idx: list of channel_idxs}, {1: list of species idxs})\n        :rtype: dict[str: tuple]\n    '
    pes_block = ioformat.ptt.end_block(run_str, 'pes', footer='pes')
    if (pes_block is not None):
        _pes_idxs = {}
        for line in pes_block.strip().splitlines():
            [pes_nums, chn_nums] = line.split(':')
            _pes_nums = ioformat.ptt.idx_lst_from_line(pes_nums)
            _chn_nums = ioformat.ptt.idx_lst_from_line(chn_nums)
            for idx in _pes_nums:
                _pes_idxs.update({(idx - 1): tuple(((val - 1) for val in _chn_nums))})
    else:
        _pes_idxs = None
    spc_block = ioformat.ptt.end_block(run_str, 'spc', footer='spc')
    if (spc_block is not None):
        _idxs = ()
        for line in spc_block.splitlines():
            _idxs += ioformat.ptt.idx_lst_from_line(line)
        _spc_idxs = {1: tuple(((val - 1) for val in _idxs))}
    else:
        _spc_idxs = None
    if ((_pes_idxs is None) and (_spc_idxs is None)):
        error_message('No pes or spc section given in run.dat file. Quitting')
        sys.exit()
    return (_pes_idxs, _spc_idxs)
Parses the `pes` block of the run.dat file and
 builds a dictionary of the PESs and corresponding channels the
 user wishes to run.

 Parses the `spc` block of the run.dat file and
 builds a dictionary of the species the
 user wishes to run.

 May break if idx is given on two lines of string.

:param run_str: string of the run.dat input file
:type run_str: str
:returns: ({pes_idx: list of channel_idxs}, {1: list of species idxs})
:rtype: dict[str: tuple]
def chem_idxs(run_str):
    '  Parses the `pes` block of the run.dat file and\n         builds a dictionary of the PESs and corresponding channels the\n         user wishes to run.\n\n         Parses the `spc` block of the run.dat file and\n         builds a dictionary of the species the\n         user wishes to run.\n\n         May break if idx is given on two lines of string.\n\n        :param run_str: string of the run.dat input file\n        :type run_str: str\n        :returns: ({pes_idx: list of channel_idxs}, {1: list of species idxs})\n        :rtype: dict[str: tuple]\n    '
    pes_block = ioformat.ptt.end_block(run_str, 'pes', footer='pes')
    if (pes_block is not None):
        _pes_idxs = {}
        for line in pes_block.strip().splitlines():
            [pes_nums, chn_nums] = line.split(':')
            _pes_nums = ioformat.ptt.idx_lst_from_line(pes_nums)
            _chn_nums = ioformat.ptt.idx_lst_from_line(chn_nums)
            for idx in _pes_nums:
                _pes_idxs.update({(idx - 1): tuple(((val - 1) for val in _chn_nums))})
    else:
        _pes_idxs = None
    spc_block = ioformat.ptt.end_block(run_str, 'spc', footer='spc')
    if (spc_block is not None):
        _idxs = ()
        for line in spc_block.splitlines():
            _idxs += ioformat.ptt.idx_lst_from_line(line)
        _spc_idxs = {1: tuple(((val - 1) for val in _idxs))}
    else:
        _spc_idxs = None
    if ((_pes_idxs is None) and (_spc_idxs is None)):
        error_message('No pes or spc section given in run.dat file. Quitting')
        sys.exit()
    return (_pes_idxs, _spc_idxs)