Goodman-lab / DP5

Python workflow for DP5 and DP4 analysis of organic molecules
Other
175 stars 102 forks source link

UnboundLocalError: local variable 'atoms' referenced before assignment #27

Closed WeiYongqiang55 closed 4 years ago

WeiYongqiang55 commented 4 years ago

File "/home/wyq/Downloads/DP4-AI-master3/DP4-AI-master/Gaussian.py", line 560, in ReadGeometries iso.Atoms = atoms UnboundLocalError: local variable 'atoms' referenced before assignment

can fixed like

for iso in Isomers:

        iso.DFTConformers = [[] for x in iso.OptOutputFiles]
        atoms=[]

        for num, GOutpFile in enumerate(iso.OptOutputFiles):

            atoms, coords = ReadGeometry(GOutpFile)

            iso.DFTConformers[num] = coords

        iso.Atoms = atoms
KristapsE commented 4 years ago

This arises from there not being any optimization output files in the expected place - probably because of incorrect input file/output folder specification. The whole process will fail with empty iso.Atoms atribute anyway, so there isn't really any point in fixing it like that. Gaussian.py is probably our most tested source file, so the issue is likely somewhere before this. I might add a more explicit error message, but the process really cannot continue with no atoms in the atom list.