Python 无限 while 和 for 循环

发布于 2025-01-16 02:58:43 字数 5273 浏览 0 评论 0原文

我的代码似乎陷入了无限循环。它应该遍历一条能量曲线,其中 2 个局部最小值之间的每个点都被添加到子列表 teil_reaction 中,然后移动到下一组点。此外,前一个子列表的最后一个点也是下一个子列表中的第一个点。

def reaction_components(reaction):
    '''
    reaction : List of processed frames which are extracted from trajectory
    '''
    results = []
    
    
    i = 0

    while i < len(reaction):
        j = 0
        teil_reaction = []
        teil_reaction.append(reaction[i])

        for m in range(i, len(reaction)-1):
            if float(reaction[m+1][1]) > float(reaction[m][1]):
                teil_reaction.append(reaction[m+1])
                j = m + 1
        for k in range(j, len(reaction)-1):
            if float(reaction[k+1][1]) < float(reaction[k][1]):
                teil_reaction.append(reaction[k+1])
                i = k + 1
        results.append(teil_reaction)


    return results

reaction 的示例列表为 [['CCCCCCCCCCCCCSSc1nnc(s1)SSCCCCCCCCCCCC', '-103.306546877671'], ['CCCCCCCCCCCCCSSc1nnc(s1)SSCCCCCC[CH2].[CH2]CCCC', '-102.624657924951'], ['CCCCCCCCCCCCCSSc1nnc(s1)SSCCCCCCCCCCCC', '-102.684704435085'], ['CCCCCCCCCCCCCSS[C]1[N][N][C](S1)S[S].[CH2]CCCCCCCCCCCC' , '-102.672296611091'], ['CCCCCCCCCCCCCSS/[C]=N/[N]C(=S)SSCCCCCCCCCCCC', '-102.626944643619'], ['CCCCCCCCCCCSSc1nnc(s1)SSCCCCCCCCCCCC', '-102.733656248752'], ['CCCCCCCCCCCCCSS[C][N][N]C(=S)SSCCCCCCCCCCCC', '-102.705294168498'], ['CCCCCCCCCCCCCSSC1=N[N][C](S1)SSCCCCCCCCCCCC', '-102.670037250294'], ['CCCCCCCCCCCCCSS[C]1[N][N]/C(=[S]/SCCCCCCCCCCCC)/S1', '-102.729557090939'], ['CCCCCCCCCCCCCSSc1nnc(s1)SSCCCCCCCCCCCC', '-102.784465082168'], ['CCCCCCCCCCCCCSS/[C]=N/[N]C(=S)SSCCCCCCCCCCCC', '-102.678559581466'], ['CCCCCCCCCCCCCSSc1nnc(s1)SSCCCCCCCCCCCC', '-102.780173450946'], ['CCCCCCCCCCCCSS[C]1[N][N]/C(=[S]/SCCCCCCCCCCCC)/S1', '-102.706003472069'], ['CCCCCCCCCCCCCSS[C]1[N][N][C](S1)SSCCCCCCCCCCCC', '-102.694715899746'], ['CCCCCCCCCCCCCSS/[C]=N/[N]C(=S)SSCCCCCCCCCCCC', ' -102.701110428064'], ['CCCCCCCCCCCCCSS[C]1[N][N][C](S1)SSCCCCCCCCCCCC', '-102.711452078891'], ['CCCCCCCCCCCCCSSC(=S)[N]/N=[C]/SSCCCCCCCCCCCCCC', '- 102.753669258961'], ['CCCCCCCCCCCCCSS[C]1[N]N=C(S1)SSCCCCCCCCCCCC', '-102.636410618884'], ['CCCCCCCCCCCCCSSC(=S)[N]/N=[C]/SSCCCCCCCCCCCC', '-102.644213340892'] , ['CCCCCCCCCCCCCSS[C]1[N][N][C](S1)SSCCCCCCCCCCCC', '-102.741411107096'], ['CCCCCCCCCCCCCSSC(=S)[N][N][C]SSCCCCCCCCCCCCCC', '-102.779722244847 '], ['CCCCCCCCCCCCCSSc1nnc(s1)SSCCCCCCCCCCCC', '-102.726065146631'], ['CCCCCCCCCCCC[CH2].[S]SC1=N[N][C](S1)SSCCCCCCCCCCCC', '-102.704259648046'], ['CCCCCCCCCCCCCSS[C]1[N][N][C](S1)SSCCCCCCCCCCCC', '-102.672777278714'], ['CCCCCCCCCCCC[CH2].[S]S[C]1[N][N][ C](S1)SSCCCCCCCCCCCC', '-102.744655804617'], ['CCCCCCCCCCCC[S].S=C1N=N[C](S1)SSCCCCCCCCCCCC', '-102.669981592196'], ['CCCCCCCCCCCCCSS[C]1[N][N][C]( S1)SSCCCCCCCCCCCC', '-102.713068529744'], ['CCCCCCCCCCCCCSSC1=N[N][C](S1)S[S].[CH2]CCCCCCCCCCCC', '-102.645422980799'], ['CCCCCCCCCCCCCSS[C]1[N][N][C](S1)SSCCCCCCCCCCCC', '-102.729184657256'], ['CCCCCCCCCCCC[S].[S][C]1[N][N][C ](S1)SSCCCCCCCCCCCC', '-102.64224131805'], ['CCCCCCCCCCCCCSS[C]1[N][N][C](S1)SSCCCCCCCCCCCC', '-102.711487535061'], ['CCCCCCCCCCCSSC1=N[N]C(=S)S1.[ S]CCCCCCCCCCCC', '-102.715369662393'], ['CCCCCCCCCCCCSS[C]1[N][N][C](S1)SSCCCCCCCCCCCC', '-102.736595850749'], ['CCCCCCCCCCCC[S@]1S[C@@]21[N][N][C](S2)SSCCCCCCCCCCCC', '-102.672769568432'], ['CCCCCCCCCCCCCSS[C]1[N][N][C ](S1)SSCCCCCCCCCCCC', '-102.764725479807'], ['CCCCCCCCCCCCCSSC1=N[N]/C(=[S]\\SCCCCCCCCCCCC)/S1', '-102.695966797633'], ['CCCCCCCCCCCCCSS[C]1[N][N][C ](S1)SSCCCCCCCCCCCC', '-102.626868480522'], ['CCCCCCCCCCCC[CH2].[S]Sc1nnc(s1)SSCCCCCCCCCCCC', '-102.588700582455'], ['CCCCCCCCCCCCCSS[C]1[N][N][C](S1)SSCCCCCCCCCCCC' , '-102.674540493719'], ['CCCCCCCCCCCC[S@@]1S[C]2[N][N][C]([S@@]12)SSCCCCCCCCCCCC', '-102.643461645226'], ['CCCCCCCCCCCCCSS[C]1[N][N][C](S1)SSCCCCCCCCCCCC', '-102.752445118235'], ['CCCCCCCCCCCC[CH2].[S].S=C1[N][N][C ](S1)SSCCCCCCCCCCCC', '-102.708718648469'], ['CCCCCCCCCCCCCSS[C]1[N][N][C](S1)SSCCCCCCCCCCCC', '-102.730896209081'], ['CCCCCCCCCCCCCSS[C]1[N][N]C(= S)S1.[S]CCCCCCCCCCCC', '-102.719973340574'], ['CCCCCCCCCCCCCSS[C]1[N][N][C](S1)SSCCCCCCCCCCCC', '-102.665803332006'], ['CCCCCCCCCCCCCSSC(=S)[N][N][C] SSCCCCCCCCCCCC', '-102.754915967134'],['CCCCCCCCCCCCCSS[C]1[N][N][C](S1)SSCCCCCCCCCCCC','-102.744766028688'],['CCCCCCCCCCCCCSSC(=S)/N=N\\[C] SSCCCCCCCCCCCC', '-102.721441123337'], ['CCCCCCCCCCCCCSS[C]1[N]N=C(S1)SSCCCCCCCCCCCC', '-102.706423668641'], ['CCCCCCCCCCCCCSSC1=N[N]C(=S)S1.[S]CCCCCCCCCCCC ', '-102.747038763646'], ['CCCCCCCCCCCCCSS[C]1N=N[C](S1)SSCCCCCCCCCCCC', '-102.716391644738'], ['CCCCCCCCCCCCCSSc1nnc(s1)S[S].[CH2]CCCCCCCCCCCC', '-102.680511792892'],['CCCCCCCCCCCCCSS[C]1[N]N=C(S1)SSCCCCCCCCCCCC','-102.703678629573'],['CCCCCCCCCCCC[S]。[S][C]/N=N\\ C(=S)SSCCCCCCCCCCCC', '-102.655618420991'],['CCCCCCCCCCCCCSS[C]1[N][N][C](S1)SSCCCCCCCCCCCC','-102.714449469878'],['CCCCCCCCCCCCCSS[C]/N=N\\C(=S )SSCCCCCCCCCCCC', '-102.676486450894'], ['CCCCCCCCCCCCCSS[C]1[N][N][C](S1)SSCCCCCCCCCCCC', '-102.702312172869'], ['CCCCCCCCCCCCCSS[C][N][N]C(=S )SSCCCCCCCCCCCC', '-102.650883426888'], ['CCCCCCCCCCCCCSS[C][N]N=C=S.[S]SCCCCCCCCCCCC', '-102.673888660336'], ['CCCCCCCCCCCC[S].S=C=NN=C=SS= [S]CCCCCCCCCCCC', '-102.632130520839']]

My code seems to run into an infinite loop. It's supposed to traverse an energy curve where every points between 2 local minima are added to a sublist teil_reaction and then it moves on to the next set of points. Furthermore, the last point of a previous sublist is also the first point in the next sublist.

def reaction_components(reaction):
    '''
    reaction : List of processed frames which are extracted from trajectory
    '''
    results = []
    
    
    i = 0

    while i < len(reaction):
        j = 0
        teil_reaction = []
        teil_reaction.append(reaction[i])

        for m in range(i, len(reaction)-1):
            if float(reaction[m+1][1]) > float(reaction[m][1]):
                teil_reaction.append(reaction[m+1])
                j = m + 1
        for k in range(j, len(reaction)-1):
            if float(reaction[k+1][1]) < float(reaction[k][1]):
                teil_reaction.append(reaction[k+1])
                i = k + 1
        results.append(teil_reaction)


    return results

An example list for reaction is [['CCCCCCCCCCCCSSc1nnc(s1)SSCCCCCCCCCCCC', '-103.306546877671'], ['CCCCCCCCCCCCSSc1nnc(s1)SSCCCCCC[CH2].[CH2]CCCC', '-102.624657924951'], ['CCCCCCCCCCCCSSc1nnc(s1)SSCCCCCCCCCCCC', '-102.684704435085'], ['CCCCCCCCCCCCSS[C]1[N][N][C](S1)S[S].[CH2]CCCCCCCCCCC', '-102.672296611091'], ['CCCCCCCCCCCCSS/[C]=N/[N]C(=S)SSCCCCCCCCCCCC', '-102.626944643619'], ['CCCCCCCCCCCCSSc1nnc(s1)SSCCCCCCCCCCCC', '-102.733656248752'], ['CCCCCCCCCCCCSS[C][N][N]C(=S)SSCCCCCCCCCCCC', '-102.705294168498'], ['CCCCCCCCCCCCSSC1=N[N][C](S1)SSCCCCCCCCCCCC', '-102.670037250294'], ['CCCCCCCCCCCCSS[C]1[N][N]/C(=[S]/SCCCCCCCCCCCC)/S1', '-102.729557090939'], ['CCCCCCCCCCCCSSc1nnc(s1)SSCCCCCCCCCCCC', '-102.784465082168'], ['CCCCCCCCCCCCSS/[C]=N/[N]C(=S)SSCCCCCCCCCCCC', '-102.678559581466'], ['CCCCCCCCCCCCSSc1nnc(s1)SSCCCCCCCCCCCC', '-102.780173450946'], ['CCCCCCCCCCCCSS[C]1[N][N]/C(=[S]/SCCCCCCCCCCCC)/S1', '-102.706003472069'], ['CCCCCCCCCCCCSS[C]1[N][N][C](S1)SSCCCCCCCCCCCC', '-102.694715899746'], ['CCCCCCCCCCCCSS/[C]=N/[N]C(=S)SSCCCCCCCCCCCC', '-102.701110428064'], ['CCCCCCCCCCCCSS[C]1[N][N][C](S1)SSCCCCCCCCCCCC', '-102.711452078891'], ['CCCCCCCCCCCCSSC(=S)[N]/N=[C]/SSCCCCCCCCCCCC', '-102.753669258961'], ['CCCCCCCCCCCCSS[C]1[N]N=C(S1)SSCCCCCCCCCCCC', '-102.636410618884'], ['CCCCCCCCCCCCSSC(=S)[N]/N=[C]/SSCCCCCCCCCCCC', '-102.644213340892'], ['CCCCCCCCCCCCSS[C]1[N][N][C](S1)SSCCCCCCCCCCCC', '-102.741411107096'], ['CCCCCCCCCCCCSSC(=S)[N][N][C]SSCCCCCCCCCCCC', '-102.779722244847'], ['CCCCCCCCCCCCSSc1nnc(s1)SSCCCCCCCCCCCC', '-102.726065146631'], ['CCCCCCCCCCC[CH2].[S]SC1=N[N][C](S1)SSCCCCCCCCCCCC', '-102.704259648046'], ['CCCCCCCCCCCCSS[C]1[N][N][C](S1)SSCCCCCCCCCCCC', '-102.672777278714'], ['CCCCCCCCCCC[CH2].[S]S[C]1[N][N][C](S1)SSCCCCCCCCCCCC', '-102.744655804617'], ['CCCCCCCCCCCC[S].S=C1N=N[C](S1)SSCCCCCCCCCCCC', '-102.669981592196'], ['CCCCCCCCCCCCSS[C]1[N][N][C](S1)SSCCCCCCCCCCCC', '-102.713068529744'], ['CCCCCCCCCCCCSSC1=N[N][C](S1)S[S].[CH2]CCCCCCCCCCC', '-102.645422980799'], ['CCCCCCCCCCCCSS[C]1[N][N][C](S1)SSCCCCCCCCCCCC', '-102.729184657256'], ['CCCCCCCCCCCC[S].[S][C]1[N][N][C](S1)SSCCCCCCCCCCCC', '-102.64224131805'], ['CCCCCCCCCCCCSS[C]1[N][N][C](S1)SSCCCCCCCCCCCC', '-102.711487535061'], ['CCCCCCCCCCCCSSC1=N[N]C(=S)S1.[S]CCCCCCCCCCCC', '-102.715369662393'], ['CCCCCCCCCCCCSS[C]1[N][N][C](S1)SSCCCCCCCCCCCC', '-102.736595850749'], ['CCCCCCCCCCCC[S@]1S[C@@]21[N][N][C](S2)SSCCCCCCCCCCCC', '-102.672769568432'], ['CCCCCCCCCCCCSS[C]1[N][N][C](S1)SSCCCCCCCCCCCC', '-102.764725479807'], ['CCCCCCCCCCCCSSC1=N[N]/C(=[S]\\SCCCCCCCCCCCC)/S1', '-102.695966797633'], ['CCCCCCCCCCCCSS[C]1[N][N][C](S1)SSCCCCCCCCCCCC', '-102.626868480522'], ['CCCCCCCCCCC[CH2].[S]Sc1nnc(s1)SSCCCCCCCCCCCC', '-102.588700582455'], ['CCCCCCCCCCCCSS[C]1[N][N][C](S1)SSCCCCCCCCCCCC', '-102.674540493719'], ['CCCCCCCCCCCC[S@@]1S[C]2[N][N][C]([S@@]12)SSCCCCCCCCCCCC', '-102.643461645226'], ['CCCCCCCCCCCCSS[C]1[N][N][C](S1)SSCCCCCCCCCCCC', '-102.752445118235'], ['CCCCCCCCCCC[CH2].[S].S=C1[N][N][C](S1)SSCCCCCCCCCCCC', '-102.708718648469'], ['CCCCCCCCCCCCSS[C]1[N][N][C](S1)SSCCCCCCCCCCCC', '-102.730896209081'], ['CCCCCCCCCCCCSS[C]1[N][N]C(=S)S1.[S]CCCCCCCCCCCC', '-102.719973340574'], ['CCCCCCCCCCCCSS[C]1[N][N][C](S1)SSCCCCCCCCCCCC', '-102.665803332006'], ['CCCCCCCCCCCCSSC(=S)[N][N][C]SSCCCCCCCCCCCC', '-102.754915967134'], ['CCCCCCCCCCCCSS[C]1[N][N][C](S1)SSCCCCCCCCCCCC', '-102.744766028688'], ['CCCCCCCCCCCCSSC(=S)/N=N\\[C]SSCCCCCCCCCCCC', '-102.721441123337'], ['CCCCCCCCCCCCSS[C]1[N]N=C(S1)SSCCCCCCCCCCCC', '-102.706423668641'], ['CCCCCCCCCCCCSSC1=N[N]C(=S)S1.[S]CCCCCCCCCCCC', '-102.747038763646'], ['CCCCCCCCCCCCSS[C]1N=N[C](S1)SSCCCCCCCCCCCC', '-102.716391644738'], ['CCCCCCCCCCCCSSc1nnc(s1)S[S].[CH2]CCCCCCCCCCC', '-102.680511792892'], ['CCCCCCCCCCCCSS[C]1[N]N=C(S1)SSCCCCCCCCCCCC', '-102.703678629573'], ['CCCCCCCCCCCC[S].[S][C]/N=N\\C(=S)SSCCCCCCCCCCCC', '-102.655618420991'], ['CCCCCCCCCCCCSS[C]1[N][N][C](S1)SSCCCCCCCCCCCC', '-102.714449469878'], ['CCCCCCCCCCCCSS[C]/N=N\\C(=S)SSCCCCCCCCCCCC', '-102.676486450894'], ['CCCCCCCCCCCCSS[C]1[N][N][C](S1)SSCCCCCCCCCCCC', '-102.702312172869'], ['CCCCCCCCCCCCSS[C][N][N]C(=S)SSCCCCCCCCCCCC', '-102.650883426888'], ['CCCCCCCCCCCCSS[C][N]N=C=S.[S]SCCCCCCCCCCCC', '-102.673888660336'], ['CCCCCCCCCCCC[S].S=C=NN=C=S.S=[S]CCCCCCCCCCCC', '-102.632130520839']]

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(2

鱼忆七猫命九 2025-01-23 02:58:43

range(j, len(reaction)-1)中的k不包含len(reaction)-1,因此k 可以具有的值为 len(reaction)-2,这也成为 i 可以具有的最大值,因为您修改 i 的唯一位置是i=k。由于 len(reaction)-2 小于 len(reaction)-1,循环条件满足,while 循环永远不会停止。

k in range(j, len(reaction)-1) doesn't include len(reaction)-1, So the maximun value that k can have is len(reaction)-2, and that also becomes the maximun value i can have since the only place you modify i is i=k. Since len(reaction)-2 is less than len(reaction)-1, the loop condition is fullfilled, and the while loop never stops.

日久见人心 2025-01-23 02:58:43

我不知道你想用你的代码做什么。一些评论会有所帮助。我有一个可行的替代解决方案:

def reaction_components(local_minima, reaction_array):
    '''
    reaction : List of processed frames which are extracted from trajectory
    '''
    results = []

    for i in range(len(local_minima) - 1):
        arr = []
        for j in range(local_minima[i], local_minima[i + 1] + 1):
            arr.append(reaction_array[j][1])
        results.append(arr)
    return results


def get_all_local_minima(array):
    local_minima = []
    for i in range(len(array) - 2):
        if array[i][1] > array[i + 1][1] < array[i + 2][1]:
            local_minima.append(i + 1)
    return local_minima

reaction = [['CCCCCCCCCCCCSSc1nnc(s1)SSCCCCCCCCCCCC', '-103.306546877671'],
            ['CCCCCCCCCCCCSSc1nnc(s1)SSCCCCCC[CH2].[CH2]CCCC', '-102.624657924951'],
            ['CCCCCCCCCCCCSSc1nnc(s1)SSCCCCCCCCCCCC', '-102.684704435085'],
            ['CCCCCCCCCCCCSS[C]1[N][N][C](S1)S[S].[CH2]CCCCCCCCCCC', '-102.672296611091'],
            ['CCCCCCCCCCCCSS/[C]=N/[N]C(=S)SSCCCCCCCCCCCC', '-102.626944643619'],
            ['CCCCCCCCCCCCSSc1nnc(s1)SSCCCCCCCCCCCC', '-102.733656248752'],
            ['CCCCCCCCCCCCSS[C][N][N]C(=S)SSCCCCCCCCCCCC', '-102.705294168498'],
            ['CCCCCCCCCCCCSSC1=N[N][C](S1)SSCCCCCCCCCCCC', '-102.670037250294'],
            ['CCCCCCCCCCCCSS[C]1[N][N]/C(=[S]/SCCCCCCCCCCCC)/S1', '-102.729557090939'],
            ['CCCCCCCCCCCCSSc1nnc(s1)SSCCCCCCCCCCCC', '-102.784465082168'],
            ['CCCCCCCCCCCCSS/[C]=N/[N]C(=S)SSCCCCCCCCCCCC', '-102.678559581466'],
            ['CCCCCCCCCCCCSSc1nnc(s1)SSCCCCCCCCCCCC', '-102.780173450946'],
            ['CCCCCCCCCCCCSS[C]1[N][N]/C(=[S]/SCCCCCCCCCCCC)/S1', '-102.706003472069'],
            ['CCCCCCCCCCCCSS[C]1[N][N][C](S1)SSCCCCCCCCCCCC', '-102.694715899746'],
            ['CCCCCCCCCCCCSS/[C]=N/[N]C(=S)SSCCCCCCCCCCCC', '-102.701110428064'],
            ['CCCCCCCCCCCCSS[C]1[N][N][C](S1)SSCCCCCCCCCCCC', '-102.711452078891'],
            ['CCCCCCCCCCCCSSC(=S)[N]/N=[C]/SSCCCCCCCCCCCC', '-102.753669258961'],
            ['CCCCCCCCCCCCSS[C]1[N]N=C(S1)SSCCCCCCCCCCCC', '-102.636410618884'],
            ['CCCCCCCCCCCCSSC(=S)[N]/N=[C]/SSCCCCCCCCCCCC', '-102.644213340892'],
            ['CCCCCCCCCCCCSS[C]1[N][N][C](S1)SSCCCCCCCCCCCC', '-102.741411107096'],
            ['CCCCCCCCCCCCSSC(=S)[N][N][C]SSCCCCCCCCCCCC', '-102.779722244847'],
            ['CCCCCCCCCCCCSSc1nnc(s1)SSCCCCCCCCCCCC', '-102.726065146631'],
            ['CCCCCCCCCCC[CH2].[S]SC1=N[N][C](S1)SSCCCCCCCCCCCC', '-102.704259648046'],
            ['CCCCCCCCCCCCSS[C]1[N][N][C](S1)SSCCCCCCCCCCCC', '-102.672777278714'],
            ['CCCCCCCCCCC[CH2].[S]S[C]1[N][N][C](S1)SSCCCCCCCCCCCC', '-102.744655804617'],
            ['CCCCCCCCCCCC[S].S=C1N=N[C](S1)SSCCCCCCCCCCCC', '-102.669981592196'],
            ['CCCCCCCCCCCCSS[C]1[N][N][C](S1)SSCCCCCCCCCCCC', '-102.713068529744'],
            ['CCCCCCCCCCCCSSC1=N[N][C](S1)S[S].[CH2]CCCCCCCCCCC', '-102.645422980799'],
            ['CCCCCCCCCCCCSS[C]1[N][N][C](S1)SSCCCCCCCCCCCC', '-102.729184657256'],
            ['CCCCCCCCCCCC[S].[S][C]1[N][N][C](S1)SSCCCCCCCCCCCC', '-102.64224131805'],
            ['CCCCCCCCCCCCSS[C]1[N][N][C](S1)SSCCCCCCCCCCCC', '-102.711487535061'],
            ['CCCCCCCCCCCCSSC1=N[N]C(=S)S1.[S]CCCCCCCCCCCC', '-102.715369662393'],
            ['CCCCCCCCCCCCSS[C]1[N][N][C](S1)SSCCCCCCCCCCCC', '-102.736595850749'],
            ['CCCCCCCCCCCC[S@]1S[C@@]21[N][N][C](S2)SSCCCCCCCCCCCC', '-102.672769568432'],
            ['CCCCCCCCCCCCSS[C]1[N][N][C](S1)SSCCCCCCCCCCCC', '-102.764725479807'],
            ['CCCCCCCCCCCCSSC1=N[N]/C(=[S]\\SCCCCCCCCCCCC)/S1', '-102.695966797633'],
            ['CCCCCCCCCCCCSS[C]1[N][N][C](S1)SSCCCCCCCCCCCC', '-102.626868480522'],
            ['CCCCCCCCCCC[CH2].[S]Sc1nnc(s1)SSCCCCCCCCCCCC', '-102.588700582455'],
            ['CCCCCCCCCCCCSS[C]1[N][N][C](S1)SSCCCCCCCCCCCC', '-102.674540493719'],
            ['CCCCCCCCCCCC[S@@]1S[C]2[N][N][C]([S@@]12)SSCCCCCCCCCCCC', '-102.643461645226'],
            ['CCCCCCCCCCCCSS[C]1[N][N][C](S1)SSCCCCCCCCCCCC', '-102.752445118235'],
            ['CCCCCCCCCCC[CH2].[S].S=C1[N][N][C](S1)SSCCCCCCCCCCCC', '-102.708718648469'],
            ['CCCCCCCCCCCCSS[C]1[N][N][C](S1)SSCCCCCCCCCCCC', '-102.730896209081'],
            ['CCCCCCCCCCCCSS[C]1[N][N]C(=S)S1.[S]CCCCCCCCCCCC', '-102.719973340574'],
            ['CCCCCCCCCCCCSS[C]1[N][N][C](S1)SSCCCCCCCCCCCC', '-102.665803332006'],
            ['CCCCCCCCCCCCSSC(=S)[N][N][C]SSCCCCCCCCCCCC', '-102.754915967134'],
            ['CCCCCCCCCCCCSS[C]1[N][N][C](S1)SSCCCCCCCCCCCC', '-102.744766028688'],
            ['CCCCCCCCCCCCSSC(=S)/N=N\\[C]SSCCCCCCCCCCCC', '-102.721441123337'],
            ['CCCCCCCCCCCCSS[C]1[N]N=C(S1)SSCCCCCCCCCCCC', '-102.706423668641'],
            ['CCCCCCCCCCCCSSC1=N[N]C(=S)S1.[S]CCCCCCCCCCCC', '-102.747038763646'],
            ['CCCCCCCCCCCCSS[C]1N=N[C](S1)SSCCCCCCCCCCCC', '-102.716391644738'],
            ['CCCCCCCCCCCCSSc1nnc(s1)S[S].[CH2]CCCCCCCCCCC', '-102.680511792892'],
            ['CCCCCCCCCCCCSS[C]1[N]N=C(S1)SSCCCCCCCCCCCC', '-102.703678629573'],
            ['CCCCCCCCCCCC[S].[S][C]/N=N\\C(=S)SSCCCCCCCCCCCC', '-102.655618420991'],
            ['CCCCCCCCCCCCSS[C]1[N][N][C](S1)SSCCCCCCCCCCCC', '-102.714449469878'],
            ['CCCCCCCCCCCCSS[C]/N=N\\C(=S)SSCCCCCCCCCCCC', '-102.676486450894'],
            ['CCCCCCCCCCCCSS[C]1[N][N][C](S1)SSCCCCCCCCCCCC', '-102.702312172869'],
            ['CCCCCCCCCCCCSS[C][N][N]C(=S)SSCCCCCCCCCCCC', '-102.650883426888'],
            ['CCCCCCCCCCCCSS[C][N]N=C=S.[S]SCCCCCCCCCCCC', '-102.673888660336'],
            ['CCCCCCCCCCCC[S].S=C=NN=C=S.S=[S]CCCCCCCCCCCC', '-102.632130520839']]

result = reaction_components(get_all_local_minima(reaction), reaction)

print(result)

结果是:

[['-102.624657924951', '-102.684704435085', '-102.672296611091', '-102.626944643619'], ['-102.626944643619', '-102.733656248752', '-102.705294168498', '-102.670037250294'], ['-102.670037250294', '-102.729557090939', '-102.784465082168', '-102.678559581466'], ['-102.678559581466', '-102.780173450946', '-102.706003472069', '-102.694715899746'], ['-102.694715899746', '-102.701110428064', '-102.711452078891', '-102.753669258961', '-102.636410618884'], ['-102.636410618884', '-102.644213340892', '-102.741411107096', '-102.779722244847', '-102.726065146631', '-102.704259648046', '-102.672777278714'], ['-102.672777278714', '-102.744655804617', '-102.669981592196'], ['-102.669981592196', '-102.713068529744', '-102.645422980799'], ['-102.645422980799', '-102.729184657256', '-102.64224131805'], ['-102.64224131805', '-102.711487535061', '-102.715369662393', '-102.736595850749', '-102.672769568432'], ['-102.672769568432', '-102.764725479807', '-102.695966797633', '-102.626868480522', '-102.588700582455'], ['-102.588700582455', '-102.674540493719', '-102.643461645226'], ['-102.643461645226', '-102.752445118235', '-102.708718648469'], ['-102.708718648469', '-102.730896209081', '-102.719973340574', '-102.665803332006'], ['-102.665803332006', '-102.754915967134', '-102.744766028688', '-102.721441123337', '-102.706423668641'], ['-102.706423668641', '-102.747038763646', '-102.716391644738', '-102.680511792892'], ['-102.680511792892', '-102.703678629573', '-102.655618420991'], ['-102.655618420991', '-102.714449469878', '-102.676486450894'], ['-102.676486450894', '-102.702312172869', '-102.650883426888']]

编辑:如果您还想要名称,请更改reaction_components中的行arr.append(reaction_array[j][1]) 方法到 arr.append(reaction_array[j])。您得到的结果如下所示:

[[['CCCCCCCCCCCCSSc1nnc(s1)SSCCCCCC[CH2].[CH2]CCCC', '-102.624657924951'], ['CCCCCCCCCCCCSSc1nnc(s1)SSCCCCCCCCCCCC', '-102.684704435085'], ['CCCCCCCCCCCCSS[C]1[N][N][C](S1)S[S].[CH2]CCCCCCCCCCC', '-102.672296611091'], ['CCCCCCCCCCCCSS/[C]=N/[N]C(=S)SSCCCCCCCCCCCC', '-102.626944643619']], [['CCCCCCCCCCCCSS/[C]=N/[N]C(=S)SSCCCCCCCCCCCC', '-102.626944643619'], ['CCCCCCCCCCCCSSc1nnc(s1)SSCCCCCCCCCCCC', '-102.733656248752'], ['CCCCCCCCCCCCSS[C][N][N]C(=S)SSCCCCCCCCCCCC', '-102.705294168498'], ['CCCCCCCCCCCCSSC1=N[N][C](S1)SSCCCCCCCCCCCC', '-102.670037250294']], [['CCCCCCCCCCCCSSC1=N[N][C](S1)SSCCCCCCCCCCCC', '-102.670037250294'], ['CCCCCCCCCCCCSS[C]1[N][N]/C(=[S]/SCCCCCCCCCCCC)/S1', '-102.729557090939'], ['CCCCCCCCCCCCSSc1nnc(s1)SSCCCCCCCCCCCC', '-102.784465082168'], ['CCCCCCCCCCCCSS/[C]=N/[N]C(=S)SSCCCCCCCCCCCC', '-102.678559581466']], [['CCCCCCCCCCCCSS/[C]=N/[N]C(=S)SSCCCCCCCCCCCC', '-102.678559581466'], ['CCCCCCCCCCCCSSc1nnc(s1)SSCCCCCCCCCCCC', '-102.780173450946'], ['CCCCCCCCCCCCSS[C]1[N][N]/C(=[S]/SCCCCCCCCCCCC)/S1', '-102.706003472069'], ['CCCCCCCCCCCCSS[C]1[N][N][C](S1)SSCCCCCCCCCCCC', '-102.694715899746']], [['CCCCCCCCCCCCSS[C]1[N][N][C](S1)SSCCCCCCCCCCCC', '-102.694715899746'], ['CCCCCCCCCCCCSS/[C]=N/[N]C(=S)SSCCCCCCCCCCCC', '-102.701110428064'], ['CCCCCCCCCCCCSS[C]1[N][N][C](S1)SSCCCCCCCCCCCC', '-102.711452078891'], ['CCCCCCCCCCCCSSC(=S)[N]/N=[C]/SSCCCCCCCCCCCC', '-102.753669258961'], ['CCCCCCCCCCCCSS[C]1[N]N=C(S1)SSCCCCCCCCCCCC', '-102.636410618884']], [['CCCCCCCCCCCCSS[C]1[N]N=C(S1)SSCCCCCCCCCCCC', '-102.636410618884'], ['CCCCCCCCCCCCSSC(=S)[N]/N=[C]/SSCCCCCCCCCCCC', '-102.644213340892'], ['CCCCCCCCCCCCSS[C]1[N][N][C](S1)SSCCCCCCCCCCCC', '-102.741411107096'], ['CCCCCCCCCCCCSSC(=S)[N][N][C]SSCCCCCCCCCCCC', '-102.779722244847'], ['CCCCCCCCCCCCSSc1nnc(s1)SSCCCCCCCCCCCC', '-102.726065146631'], ['CCCCCCCCCCC[CH2].[S]SC1=N[N][C](S1)SSCCCCCCCCCCCC', '-102.704259648046'], ['CCCCCCCCCCCCSS[C]1[N][N][C](S1)SSCCCCCCCCCCCC', '-102.672777278714']], [['CCCCCCCCCCCCSS[C]1[N][N][C](S1)SSCCCCCCCCCCCC', '-102.672777278714'], ['CCCCCCCCCCC[CH2].[S]S[C]1[N][N][C](S1)SSCCCCCCCCCCCC', '-102.744655804617'], ['CCCCCCCCCCCC[S].S=C1N=N[C](S1)SSCCCCCCCCCCCC', '-102.669981592196']], [['CCCCCCCCCCCC[S].S=C1N=N[C](S1)SSCCCCCCCCCCCC', '-102.669981592196'], ['CCCCCCCCCCCCSS[C]1[N][N][C](S1)SSCCCCCCCCCCCC', '-102.713068529744'], ['CCCCCCCCCCCCSSC1=N[N][C](S1)S[S].[CH2]CCCCCCCCCCC', '-102.645422980799']], [['CCCCCCCCCCCCSSC1=N[N][C](S1)S[S].[CH2]CCCCCCCCCCC', '-102.645422980799'], ['CCCCCCCCCCCCSS[C]1[N][N][C](S1)SSCCCCCCCCCCCC', '-102.729184657256'], ['CCCCCCCCCCCC[S].[S][C]1[N][N][C](S1)SSCCCCCCCCCCCC', '-102.64224131805']], [['CCCCCCCCCCCC[S].[S][C]1[N][N][C](S1)SSCCCCCCCCCCCC', '-102.64224131805'], ['CCCCCCCCCCCCSS[C]1[N][N][C](S1)SSCCCCCCCCCCCC', '-102.711487535061'], ['CCCCCCCCCCCCSSC1=N[N]C(=S)S1.[S]CCCCCCCCCCCC', '-102.715369662393'], ['CCCCCCCCCCCCSS[C]1[N][N][C](S1)SSCCCCCCCCCCCC', '-102.736595850749'], ['CCCCCCCCCCCC[S@]1S[C@@]21[N][N][C](S2)SSCCCCCCCCCCCC', '-102.672769568432']], [['CCCCCCCCCCCC[S@]1S[C@@]21[N][N][C](S2)SSCCCCCCCCCCCC', '-102.672769568432'], ['CCCCCCCCCCCCSS[C]1[N][N][C](S1)SSCCCCCCCCCCCC', '-102.764725479807'], ['CCCCCCCCCCCCSSC1=N[N]/C(=[S]\\SCCCCCCCCCCCC)/S1', '-102.695966797633'], ['CCCCCCCCCCCCSS[C]1[N][N][C](S1)SSCCCCCCCCCCCC', '-102.626868480522'], ['CCCCCCCCCCC[CH2].[S]Sc1nnc(s1)SSCCCCCCCCCCCC', '-102.588700582455']], [['CCCCCCCCCCC[CH2].[S]Sc1nnc(s1)SSCCCCCCCCCCCC', '-102.588700582455'], ['CCCCCCCCCCCCSS[C]1[N][N][C](S1)SSCCCCCCCCCCCC', '-102.674540493719'], ['CCCCCCCCCCCC[S@@]1S[C]2[N][N][C]([S@@]12)SSCCCCCCCCCCCC', '-102.643461645226']], [['CCCCCCCCCCCC[S@@]1S[C]2[N][N][C]([S@@]12)SSCCCCCCCCCCCC', '-102.643461645226'], ['CCCCCCCCCCCCSS[C]1[N][N][C](S1)SSCCCCCCCCCCCC', '-102.752445118235'], ['CCCCCCCCCCC[CH2].[S].S=C1[N][N][C](S1)SSCCCCCCCCCCCC', '-102.708718648469']], [['CCCCCCCCCCC[CH2].[S].S=C1[N][N][C](S1)SSCCCCCCCCCCCC', '-102.708718648469'], ['CCCCCCCCCCCCSS[C]1[N][N][C](S1)SSCCCCCCCCCCCC', '-102.730896209081'], ['CCCCCCCCCCCCSS[C]1[N][N]C(=S)S1.[S]CCCCCCCCCCCC', '-102.719973340574'], ['CCCCCCCCCCCCSS[C]1[N][N][C](S1)SSCCCCCCCCCCCC', '-102.665803332006']], [['CCCCCCCCCCCCSS[C]1[N][N][C](S1)SSCCCCCCCCCCCC', '-102.665803332006'], ['CCCCCCCCCCCCSSC(=S)[N][N][C]SSCCCCCCCCCCCC', '-102.754915967134'], ['CCCCCCCCCCCCSS[C]1[N][N][C](S1)SSCCCCCCCCCCCC', '-102.744766028688'], ['CCCCCCCCCCCCSSC(=S)/N=N\\[C]SSCCCCCCCCCCCC', '-102.721441123337'], ['CCCCCCCCCCCCSS[C]1[N]N=C(S1)SSCCCCCCCCCCCC', '-102.706423668641']], [['CCCCCCCCCCCCSS[C]1[N]N=C(S1)SSCCCCCCCCCCCC', '-102.706423668641'], ['CCCCCCCCCCCCSSC1=N[N]C(=S)S1.[S]CCCCCCCCCCCC', '-102.747038763646'], ['CCCCCCCCCCCCSS[C]1N=N[C](S1)SSCCCCCCCCCCCC', '-102.716391644738'], ['CCCCCCCCCCCCSSc1nnc(s1)S[S].[CH2]CCCCCCCCCCC', '-102.680511792892']], [['CCCCCCCCCCCCSSc1nnc(s1)S[S].[CH2]CCCCCCCCCCC', '-102.680511792892'], ['CCCCCCCCCCCCSS[C]1[N]N=C(S1)SSCCCCCCCCCCCC', '-102.703678629573'], ['CCCCCCCCCCCC[S].[S][C]/N=N\\C(=S)SSCCCCCCCCCCCC', '-102.655618420991']], [['CCCCCCCCCCCC[S].[S][C]/N=N\\C(=S)SSCCCCCCCCCCCC', '-102.655618420991'], ['CCCCCCCCCCCCSS[C]1[N][N][C](S1)SSCCCCCCCCCCCC', '-102.714449469878'], ['CCCCCCCCCCCCSS[C]/N=N\\C(=S)SSCCCCCCCCCCCC', '-102.676486450894']], [['CCCCCCCCCCCCSS[C]/N=N\\C(=S)SSCCCCCCCCCCCC', '-102.676486450894'], ['CCCCCCCCCCCCSS[C]1[N][N][C](S1)SSCCCCCCCCCCCC', '-102.702312172869'], ['CCCCCCCCCCCCSS[C][N][N]C(=S)SSCCCCCCCCCCCC', '-102.650883426888']]]

I don't know what you are trying to do with your code. Some comments would help. I have an alternative solution that works:

def reaction_components(local_minima, reaction_array):
    '''
    reaction : List of processed frames which are extracted from trajectory
    '''
    results = []

    for i in range(len(local_minima) - 1):
        arr = []
        for j in range(local_minima[i], local_minima[i + 1] + 1):
            arr.append(reaction_array[j][1])
        results.append(arr)
    return results


def get_all_local_minima(array):
    local_minima = []
    for i in range(len(array) - 2):
        if array[i][1] > array[i + 1][1] < array[i + 2][1]:
            local_minima.append(i + 1)
    return local_minima

reaction = [['CCCCCCCCCCCCSSc1nnc(s1)SSCCCCCCCCCCCC', '-103.306546877671'],
            ['CCCCCCCCCCCCSSc1nnc(s1)SSCCCCCC[CH2].[CH2]CCCC', '-102.624657924951'],
            ['CCCCCCCCCCCCSSc1nnc(s1)SSCCCCCCCCCCCC', '-102.684704435085'],
            ['CCCCCCCCCCCCSS[C]1[N][N][C](S1)S[S].[CH2]CCCCCCCCCCC', '-102.672296611091'],
            ['CCCCCCCCCCCCSS/[C]=N/[N]C(=S)SSCCCCCCCCCCCC', '-102.626944643619'],
            ['CCCCCCCCCCCCSSc1nnc(s1)SSCCCCCCCCCCCC', '-102.733656248752'],
            ['CCCCCCCCCCCCSS[C][N][N]C(=S)SSCCCCCCCCCCCC', '-102.705294168498'],
            ['CCCCCCCCCCCCSSC1=N[N][C](S1)SSCCCCCCCCCCCC', '-102.670037250294'],
            ['CCCCCCCCCCCCSS[C]1[N][N]/C(=[S]/SCCCCCCCCCCCC)/S1', '-102.729557090939'],
            ['CCCCCCCCCCCCSSc1nnc(s1)SSCCCCCCCCCCCC', '-102.784465082168'],
            ['CCCCCCCCCCCCSS/[C]=N/[N]C(=S)SSCCCCCCCCCCCC', '-102.678559581466'],
            ['CCCCCCCCCCCCSSc1nnc(s1)SSCCCCCCCCCCCC', '-102.780173450946'],
            ['CCCCCCCCCCCCSS[C]1[N][N]/C(=[S]/SCCCCCCCCCCCC)/S1', '-102.706003472069'],
            ['CCCCCCCCCCCCSS[C]1[N][N][C](S1)SSCCCCCCCCCCCC', '-102.694715899746'],
            ['CCCCCCCCCCCCSS/[C]=N/[N]C(=S)SSCCCCCCCCCCCC', '-102.701110428064'],
            ['CCCCCCCCCCCCSS[C]1[N][N][C](S1)SSCCCCCCCCCCCC', '-102.711452078891'],
            ['CCCCCCCCCCCCSSC(=S)[N]/N=[C]/SSCCCCCCCCCCCC', '-102.753669258961'],
            ['CCCCCCCCCCCCSS[C]1[N]N=C(S1)SSCCCCCCCCCCCC', '-102.636410618884'],
            ['CCCCCCCCCCCCSSC(=S)[N]/N=[C]/SSCCCCCCCCCCCC', '-102.644213340892'],
            ['CCCCCCCCCCCCSS[C]1[N][N][C](S1)SSCCCCCCCCCCCC', '-102.741411107096'],
            ['CCCCCCCCCCCCSSC(=S)[N][N][C]SSCCCCCCCCCCCC', '-102.779722244847'],
            ['CCCCCCCCCCCCSSc1nnc(s1)SSCCCCCCCCCCCC', '-102.726065146631'],
            ['CCCCCCCCCCC[CH2].[S]SC1=N[N][C](S1)SSCCCCCCCCCCCC', '-102.704259648046'],
            ['CCCCCCCCCCCCSS[C]1[N][N][C](S1)SSCCCCCCCCCCCC', '-102.672777278714'],
            ['CCCCCCCCCCC[CH2].[S]S[C]1[N][N][C](S1)SSCCCCCCCCCCCC', '-102.744655804617'],
            ['CCCCCCCCCCCC[S].S=C1N=N[C](S1)SSCCCCCCCCCCCC', '-102.669981592196'],
            ['CCCCCCCCCCCCSS[C]1[N][N][C](S1)SSCCCCCCCCCCCC', '-102.713068529744'],
            ['CCCCCCCCCCCCSSC1=N[N][C](S1)S[S].[CH2]CCCCCCCCCCC', '-102.645422980799'],
            ['CCCCCCCCCCCCSS[C]1[N][N][C](S1)SSCCCCCCCCCCCC', '-102.729184657256'],
            ['CCCCCCCCCCCC[S].[S][C]1[N][N][C](S1)SSCCCCCCCCCCCC', '-102.64224131805'],
            ['CCCCCCCCCCCCSS[C]1[N][N][C](S1)SSCCCCCCCCCCCC', '-102.711487535061'],
            ['CCCCCCCCCCCCSSC1=N[N]C(=S)S1.[S]CCCCCCCCCCCC', '-102.715369662393'],
            ['CCCCCCCCCCCCSS[C]1[N][N][C](S1)SSCCCCCCCCCCCC', '-102.736595850749'],
            ['CCCCCCCCCCCC[S@]1S[C@@]21[N][N][C](S2)SSCCCCCCCCCCCC', '-102.672769568432'],
            ['CCCCCCCCCCCCSS[C]1[N][N][C](S1)SSCCCCCCCCCCCC', '-102.764725479807'],
            ['CCCCCCCCCCCCSSC1=N[N]/C(=[S]\\SCCCCCCCCCCCC)/S1', '-102.695966797633'],
            ['CCCCCCCCCCCCSS[C]1[N][N][C](S1)SSCCCCCCCCCCCC', '-102.626868480522'],
            ['CCCCCCCCCCC[CH2].[S]Sc1nnc(s1)SSCCCCCCCCCCCC', '-102.588700582455'],
            ['CCCCCCCCCCCCSS[C]1[N][N][C](S1)SSCCCCCCCCCCCC', '-102.674540493719'],
            ['CCCCCCCCCCCC[S@@]1S[C]2[N][N][C]([S@@]12)SSCCCCCCCCCCCC', '-102.643461645226'],
            ['CCCCCCCCCCCCSS[C]1[N][N][C](S1)SSCCCCCCCCCCCC', '-102.752445118235'],
            ['CCCCCCCCCCC[CH2].[S].S=C1[N][N][C](S1)SSCCCCCCCCCCCC', '-102.708718648469'],
            ['CCCCCCCCCCCCSS[C]1[N][N][C](S1)SSCCCCCCCCCCCC', '-102.730896209081'],
            ['CCCCCCCCCCCCSS[C]1[N][N]C(=S)S1.[S]CCCCCCCCCCCC', '-102.719973340574'],
            ['CCCCCCCCCCCCSS[C]1[N][N][C](S1)SSCCCCCCCCCCCC', '-102.665803332006'],
            ['CCCCCCCCCCCCSSC(=S)[N][N][C]SSCCCCCCCCCCCC', '-102.754915967134'],
            ['CCCCCCCCCCCCSS[C]1[N][N][C](S1)SSCCCCCCCCCCCC', '-102.744766028688'],
            ['CCCCCCCCCCCCSSC(=S)/N=N\\[C]SSCCCCCCCCCCCC', '-102.721441123337'],
            ['CCCCCCCCCCCCSS[C]1[N]N=C(S1)SSCCCCCCCCCCCC', '-102.706423668641'],
            ['CCCCCCCCCCCCSSC1=N[N]C(=S)S1.[S]CCCCCCCCCCCC', '-102.747038763646'],
            ['CCCCCCCCCCCCSS[C]1N=N[C](S1)SSCCCCCCCCCCCC', '-102.716391644738'],
            ['CCCCCCCCCCCCSSc1nnc(s1)S[S].[CH2]CCCCCCCCCCC', '-102.680511792892'],
            ['CCCCCCCCCCCCSS[C]1[N]N=C(S1)SSCCCCCCCCCCCC', '-102.703678629573'],
            ['CCCCCCCCCCCC[S].[S][C]/N=N\\C(=S)SSCCCCCCCCCCCC', '-102.655618420991'],
            ['CCCCCCCCCCCCSS[C]1[N][N][C](S1)SSCCCCCCCCCCCC', '-102.714449469878'],
            ['CCCCCCCCCCCCSS[C]/N=N\\C(=S)SSCCCCCCCCCCCC', '-102.676486450894'],
            ['CCCCCCCCCCCCSS[C]1[N][N][C](S1)SSCCCCCCCCCCCC', '-102.702312172869'],
            ['CCCCCCCCCCCCSS[C][N][N]C(=S)SSCCCCCCCCCCCC', '-102.650883426888'],
            ['CCCCCCCCCCCCSS[C][N]N=C=S.[S]SCCCCCCCCCCCC', '-102.673888660336'],
            ['CCCCCCCCCCCC[S].S=C=NN=C=S.S=[S]CCCCCCCCCCCC', '-102.632130520839']]

result = reaction_components(get_all_local_minima(reaction), reaction)

print(result)

The result is:

[['-102.624657924951', '-102.684704435085', '-102.672296611091', '-102.626944643619'], ['-102.626944643619', '-102.733656248752', '-102.705294168498', '-102.670037250294'], ['-102.670037250294', '-102.729557090939', '-102.784465082168', '-102.678559581466'], ['-102.678559581466', '-102.780173450946', '-102.706003472069', '-102.694715899746'], ['-102.694715899746', '-102.701110428064', '-102.711452078891', '-102.753669258961', '-102.636410618884'], ['-102.636410618884', '-102.644213340892', '-102.741411107096', '-102.779722244847', '-102.726065146631', '-102.704259648046', '-102.672777278714'], ['-102.672777278714', '-102.744655804617', '-102.669981592196'], ['-102.669981592196', '-102.713068529744', '-102.645422980799'], ['-102.645422980799', '-102.729184657256', '-102.64224131805'], ['-102.64224131805', '-102.711487535061', '-102.715369662393', '-102.736595850749', '-102.672769568432'], ['-102.672769568432', '-102.764725479807', '-102.695966797633', '-102.626868480522', '-102.588700582455'], ['-102.588700582455', '-102.674540493719', '-102.643461645226'], ['-102.643461645226', '-102.752445118235', '-102.708718648469'], ['-102.708718648469', '-102.730896209081', '-102.719973340574', '-102.665803332006'], ['-102.665803332006', '-102.754915967134', '-102.744766028688', '-102.721441123337', '-102.706423668641'], ['-102.706423668641', '-102.747038763646', '-102.716391644738', '-102.680511792892'], ['-102.680511792892', '-102.703678629573', '-102.655618420991'], ['-102.655618420991', '-102.714449469878', '-102.676486450894'], ['-102.676486450894', '-102.702312172869', '-102.650883426888']]

Edit: If you want the the names as well then change the line arr.append(reaction_array[j][1]) in reaction_components method to arr.append(reaction_array[j]). The result you get looks like this:

[[['CCCCCCCCCCCCSSc1nnc(s1)SSCCCCCC[CH2].[CH2]CCCC', '-102.624657924951'], ['CCCCCCCCCCCCSSc1nnc(s1)SSCCCCCCCCCCCC', '-102.684704435085'], ['CCCCCCCCCCCCSS[C]1[N][N][C](S1)S[S].[CH2]CCCCCCCCCCC', '-102.672296611091'], ['CCCCCCCCCCCCSS/[C]=N/[N]C(=S)SSCCCCCCCCCCCC', '-102.626944643619']], [['CCCCCCCCCCCCSS/[C]=N/[N]C(=S)SSCCCCCCCCCCCC', '-102.626944643619'], ['CCCCCCCCCCCCSSc1nnc(s1)SSCCCCCCCCCCCC', '-102.733656248752'], ['CCCCCCCCCCCCSS[C][N][N]C(=S)SSCCCCCCCCCCCC', '-102.705294168498'], ['CCCCCCCCCCCCSSC1=N[N][C](S1)SSCCCCCCCCCCCC', '-102.670037250294']], [['CCCCCCCCCCCCSSC1=N[N][C](S1)SSCCCCCCCCCCCC', '-102.670037250294'], ['CCCCCCCCCCCCSS[C]1[N][N]/C(=[S]/SCCCCCCCCCCCC)/S1', '-102.729557090939'], ['CCCCCCCCCCCCSSc1nnc(s1)SSCCCCCCCCCCCC', '-102.784465082168'], ['CCCCCCCCCCCCSS/[C]=N/[N]C(=S)SSCCCCCCCCCCCC', '-102.678559581466']], [['CCCCCCCCCCCCSS/[C]=N/[N]C(=S)SSCCCCCCCCCCCC', '-102.678559581466'], ['CCCCCCCCCCCCSSc1nnc(s1)SSCCCCCCCCCCCC', '-102.780173450946'], ['CCCCCCCCCCCCSS[C]1[N][N]/C(=[S]/SCCCCCCCCCCCC)/S1', '-102.706003472069'], ['CCCCCCCCCCCCSS[C]1[N][N][C](S1)SSCCCCCCCCCCCC', '-102.694715899746']], [['CCCCCCCCCCCCSS[C]1[N][N][C](S1)SSCCCCCCCCCCCC', '-102.694715899746'], ['CCCCCCCCCCCCSS/[C]=N/[N]C(=S)SSCCCCCCCCCCCC', '-102.701110428064'], ['CCCCCCCCCCCCSS[C]1[N][N][C](S1)SSCCCCCCCCCCCC', '-102.711452078891'], ['CCCCCCCCCCCCSSC(=S)[N]/N=[C]/SSCCCCCCCCCCCC', '-102.753669258961'], ['CCCCCCCCCCCCSS[C]1[N]N=C(S1)SSCCCCCCCCCCCC', '-102.636410618884']], [['CCCCCCCCCCCCSS[C]1[N]N=C(S1)SSCCCCCCCCCCCC', '-102.636410618884'], ['CCCCCCCCCCCCSSC(=S)[N]/N=[C]/SSCCCCCCCCCCCC', '-102.644213340892'], ['CCCCCCCCCCCCSS[C]1[N][N][C](S1)SSCCCCCCCCCCCC', '-102.741411107096'], ['CCCCCCCCCCCCSSC(=S)[N][N][C]SSCCCCCCCCCCCC', '-102.779722244847'], ['CCCCCCCCCCCCSSc1nnc(s1)SSCCCCCCCCCCCC', '-102.726065146631'], ['CCCCCCCCCCC[CH2].[S]SC1=N[N][C](S1)SSCCCCCCCCCCCC', '-102.704259648046'], ['CCCCCCCCCCCCSS[C]1[N][N][C](S1)SSCCCCCCCCCCCC', '-102.672777278714']], [['CCCCCCCCCCCCSS[C]1[N][N][C](S1)SSCCCCCCCCCCCC', '-102.672777278714'], ['CCCCCCCCCCC[CH2].[S]S[C]1[N][N][C](S1)SSCCCCCCCCCCCC', '-102.744655804617'], ['CCCCCCCCCCCC[S].S=C1N=N[C](S1)SSCCCCCCCCCCCC', '-102.669981592196']], [['CCCCCCCCCCCC[S].S=C1N=N[C](S1)SSCCCCCCCCCCCC', '-102.669981592196'], ['CCCCCCCCCCCCSS[C]1[N][N][C](S1)SSCCCCCCCCCCCC', '-102.713068529744'], ['CCCCCCCCCCCCSSC1=N[N][C](S1)S[S].[CH2]CCCCCCCCCCC', '-102.645422980799']], [['CCCCCCCCCCCCSSC1=N[N][C](S1)S[S].[CH2]CCCCCCCCCCC', '-102.645422980799'], ['CCCCCCCCCCCCSS[C]1[N][N][C](S1)SSCCCCCCCCCCCC', '-102.729184657256'], ['CCCCCCCCCCCC[S].[S][C]1[N][N][C](S1)SSCCCCCCCCCCCC', '-102.64224131805']], [['CCCCCCCCCCCC[S].[S][C]1[N][N][C](S1)SSCCCCCCCCCCCC', '-102.64224131805'], ['CCCCCCCCCCCCSS[C]1[N][N][C](S1)SSCCCCCCCCCCCC', '-102.711487535061'], ['CCCCCCCCCCCCSSC1=N[N]C(=S)S1.[S]CCCCCCCCCCCC', '-102.715369662393'], ['CCCCCCCCCCCCSS[C]1[N][N][C](S1)SSCCCCCCCCCCCC', '-102.736595850749'], ['CCCCCCCCCCCC[S@]1S[C@@]21[N][N][C](S2)SSCCCCCCCCCCCC', '-102.672769568432']], [['CCCCCCCCCCCC[S@]1S[C@@]21[N][N][C](S2)SSCCCCCCCCCCCC', '-102.672769568432'], ['CCCCCCCCCCCCSS[C]1[N][N][C](S1)SSCCCCCCCCCCCC', '-102.764725479807'], ['CCCCCCCCCCCCSSC1=N[N]/C(=[S]\\SCCCCCCCCCCCC)/S1', '-102.695966797633'], ['CCCCCCCCCCCCSS[C]1[N][N][C](S1)SSCCCCCCCCCCCC', '-102.626868480522'], ['CCCCCCCCCCC[CH2].[S]Sc1nnc(s1)SSCCCCCCCCCCCC', '-102.588700582455']], [['CCCCCCCCCCC[CH2].[S]Sc1nnc(s1)SSCCCCCCCCCCCC', '-102.588700582455'], ['CCCCCCCCCCCCSS[C]1[N][N][C](S1)SSCCCCCCCCCCCC', '-102.674540493719'], ['CCCCCCCCCCCC[S@@]1S[C]2[N][N][C]([S@@]12)SSCCCCCCCCCCCC', '-102.643461645226']], [['CCCCCCCCCCCC[S@@]1S[C]2[N][N][C]([S@@]12)SSCCCCCCCCCCCC', '-102.643461645226'], ['CCCCCCCCCCCCSS[C]1[N][N][C](S1)SSCCCCCCCCCCCC', '-102.752445118235'], ['CCCCCCCCCCC[CH2].[S].S=C1[N][N][C](S1)SSCCCCCCCCCCCC', '-102.708718648469']], [['CCCCCCCCCCC[CH2].[S].S=C1[N][N][C](S1)SSCCCCCCCCCCCC', '-102.708718648469'], ['CCCCCCCCCCCCSS[C]1[N][N][C](S1)SSCCCCCCCCCCCC', '-102.730896209081'], ['CCCCCCCCCCCCSS[C]1[N][N]C(=S)S1.[S]CCCCCCCCCCCC', '-102.719973340574'], ['CCCCCCCCCCCCSS[C]1[N][N][C](S1)SSCCCCCCCCCCCC', '-102.665803332006']], [['CCCCCCCCCCCCSS[C]1[N][N][C](S1)SSCCCCCCCCCCCC', '-102.665803332006'], ['CCCCCCCCCCCCSSC(=S)[N][N][C]SSCCCCCCCCCCCC', '-102.754915967134'], ['CCCCCCCCCCCCSS[C]1[N][N][C](S1)SSCCCCCCCCCCCC', '-102.744766028688'], ['CCCCCCCCCCCCSSC(=S)/N=N\\[C]SSCCCCCCCCCCCC', '-102.721441123337'], ['CCCCCCCCCCCCSS[C]1[N]N=C(S1)SSCCCCCCCCCCCC', '-102.706423668641']], [['CCCCCCCCCCCCSS[C]1[N]N=C(S1)SSCCCCCCCCCCCC', '-102.706423668641'], ['CCCCCCCCCCCCSSC1=N[N]C(=S)S1.[S]CCCCCCCCCCCC', '-102.747038763646'], ['CCCCCCCCCCCCSS[C]1N=N[C](S1)SSCCCCCCCCCCCC', '-102.716391644738'], ['CCCCCCCCCCCCSSc1nnc(s1)S[S].[CH2]CCCCCCCCCCC', '-102.680511792892']], [['CCCCCCCCCCCCSSc1nnc(s1)S[S].[CH2]CCCCCCCCCCC', '-102.680511792892'], ['CCCCCCCCCCCCSS[C]1[N]N=C(S1)SSCCCCCCCCCCCC', '-102.703678629573'], ['CCCCCCCCCCCC[S].[S][C]/N=N\\C(=S)SSCCCCCCCCCCCC', '-102.655618420991']], [['CCCCCCCCCCCC[S].[S][C]/N=N\\C(=S)SSCCCCCCCCCCCC', '-102.655618420991'], ['CCCCCCCCCCCCSS[C]1[N][N][C](S1)SSCCCCCCCCCCCC', '-102.714449469878'], ['CCCCCCCCCCCCSS[C]/N=N\\C(=S)SSCCCCCCCCCCCC', '-102.676486450894']], [['CCCCCCCCCCCCSS[C]/N=N\\C(=S)SSCCCCCCCCCCCC', '-102.676486450894'], ['CCCCCCCCCCCCSS[C]1[N][N][C](S1)SSCCCCCCCCCCCC', '-102.702312172869'], ['CCCCCCCCCCCCSS[C][N][N]C(=S)SSCCCCCCCCCCCC', '-102.650883426888']]]
~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文