Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Introduced
getNumberDegreesOfFreedom
into conformer class
This partially addressed issue ReactionMechanismGenerator#213. This function gives the total molecular degrees of freedom for a species. I think it belongs in the conformer class, but please let me know if you think otherwise. I've also included a couple unittests for ethane and ethylene. I've recompiled RMG-Py and ensured that it's working. That it's working is one thing, but apologies in advance for the crappy programming style :) fixup! Introduced `getNumberDegreesOfFreedom` into conformer class Rather than look up self.conformer.modes[i] loads of times, we look it up once and store it in a local variable 'mode'. It is lookups that take time in Python, so this would be faster (as well as hopefully easier to read and debug) fixup! Introduced `getNumberDegreesOfFreedom` into conformer class Better to explicitly check for what you are looking for, than assume that the exception you catch in a try/catch block is the right one. Makes code easier to read too. My question is should we be checking for `Torsion` or is `HinderedRotor` the correct class? fixup! Introduced `getNumberDegreesOfFreedom` into conformer class Try/except could catch other exceptions, and suggests that the try ought to work. Maybe this should actually be a type check on mode (is it an instance of `Vibration`, for example)? fixup! Introduced `getNumberDegreesOfFreedom` into conformer class The "else: pass" blocks are redundant. You may consider chaining all the "if" blocks as "elif", and end with a final "else:" that raises an "I don't know what this type of mode is!" type of error. reformat code style, missing colon in `conformer.pyx` This commit is in response to rwest's suggestions for your pull request
- Loading branch information