Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
This PR fixes the LJ correction and closes this issue.
I found two issues with the script:
1 . The LJ correction script consistently worked for me with Sire 2021.1.0, but started to fail for the complex legs of ABFE calculations for Sire 2022.1.0. This was due to overflow in the calculation of the exponential average of free energies. For energies more positive than - 420 kcal per mol at 298 K, exp(-E/kT) was just less than 1.7E308, causing no issues. However, for the complex, the LJ energy was greater, causing overflow of the float64s. The smaller LJ energy with the solvent leg system meant there were no issues. I'm not sure what update made for Sire 2022.1.0 caused the LJ energy of my complex leg system to increase to the extent that this issue surfaced. I've fixed this by subtracting the mean of the energies before exponential averaging and adding back on afterwards.
I've made the script compatible with recent changes to OpenMMMD.py. I've also modified runLambda() to return the correction, and resolveParameters() to allow return values to allow me to write a test for the correction. I'll open a PR for the test shortly.