jensengroup/xyz2mol

folding out list of iterator, can give memory errors

TermeHansen opened this issue · 1 comments

in AC2BO:
valences_list = list(itertools.product(*valences_list_of_lists))
is just used for iterating over, by folding it out first I have experienced memory error from python (even on a machine with plenty of memory).

xyz2mol.py in AC2BO(AC, atomicNumList, charge, charged_fragments, quick)
    281
    282 # convert [[4],[2,1]] to [[4,2],[4,1]]
--> 283     valences_list = list(itertools.product(*valences_list_of_lists))
    284
    285     best_BO = AC.copy()

MemoryError:

I suggest to remove the list() part and just use the iterator as is.

link to similar issue:
https://stackoverflow.com/questions/6503388/prevent-memory-error-in-itertools-permutation

Agreed