patonlab / GoodVibes

Calculate quasi-harmonic free energies from Gaussian output files with temperature and other corrections
http://www.patonlab.colostate.edu
MIT License
132 stars 52 forks source link

Fix bug in computing values for solvated molecules over a range of temperatures #27

Closed hmayes closed 4 years ago

hmayes commented 4 years ago

The main reason for the pull request is that when iterating through temperatures, the concentration would always be calculated as if the molecule is in the gas phase, even if the user defined a (liquid) concentration (e.g. "-c 1"). Thus, I added a new Boolean, gas_phase, that would be assigned based on whether or not the user used the "-c" option. Then, iterating through the temperature range, the specified concentration is kept at the user-input value (assuming the liquid is reasonably described as incompressible), and otherwise recalculating the concentration based on an ideal gas assumption (as was previously done in all cases).

Other changes are to move closer to PEP8 standards (https://www.python.org/dev/peps/pep-0008/). For example, variables in all caps should correspond to globals only. Additionally, "line" was redefined within multiple loops, which can lead to unexpected behavior, so the outer-loop "line" was renamed in those cases.

The GoodVibes tests were checked on my local machine and passed (hopefully ensuring that the PEP8 changes caused no problems). Thus, the calculation for solvated molecules over a range of temperatures is likely not currently tested.

luchini18 commented 4 years ago

Thanks for the contribution