Goodman-lab / DP5

Python workflow for DP5 and DP4 analysis of organic molecules
Other
173 stars 99 forks source link

Change parsing method for /params/mmff.prm to be more pythonic. #35

Closed zjp closed 4 years ago

zjp commented 4 years ago

This fixes a bug where the first line (or first lines, I did not test how many were missing) of the atom types did not get pulled into atomtypes/atomnums properly.

Since the original logic also split the line on spaces within quoted substrings, a negative list index is a more reliable way to pull data from the end of the list-ified line.

KristapsE commented 4 years ago

So I just tested this, and both versions give identical output - both the original and your commit output all file types, starting with the first. The original actually splits at double spaces ' ', rather than single space ' ', so the quoted substrings are honoured. I do agree that your version is probably more robust and definitely more pleasing to look at, so I'm merging it, thanks.

zjp commented 4 years ago

Thanks!

But also, I think maybe the lines have shifted in some new version of Tinker, as there was definitely an off-by-one error on my machine. Regardless, the code shouldn't be vulnerable to that. 20200522_09h36m55s_grim