Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Pymbar 3 4 #659

Merged
merged 37 commits into from Mar 17, 2023
Merged

Pymbar 3 4 #659

merged 37 commits into from Mar 17, 2023

Conversation

mikemhenry
Copy link
Contributor

Description

Provide a brief description of the PR's purpose here.

Todos

  • Implement feature / fix bug
  • Add tests
  • Update documentation as needed
  • Update changelog to summarize changes in behavior, enhancements, and bugfixes implemented in this PR

Status

  • Ready to go

Changelog message


@mikemhenry
Copy link
Contributor Author

Supersedes #630

@mikemhenry
Copy link
Contributor Author

hmmmm, seeing the same errors for pymbar 3&4


======================================================================
ERROR: Test multistate sampler on a harmonic oscillator without unsampled endstates
----------------------------------------------------------------------
Traceback (most recent call last):
  File "/home/runner/micromamba-root/envs/openmmtools-test/lib/python3.8/site-packages/nose/case.py", line 197, in runTest
    self.test(*self.arg)
  File "/home/runner/work/openmmtools/openmmtools/openmmtools/tests/test_sampling.py", line 234, in test_without_unsampled_states
    self.run(include_unsampled_states=False)
  File "/home/runner/work/openmmtools/openmmtools/openmmtools/tests/test_sampling.py", line 223, in run
    raise Exception("Dimensionless free energy difference exceeds MAX_SIGMA of %.1f" % MAX_SIGMA)
Exception: Dimensionless free energy difference exceeds MAX_SIGMA of 6.0

@mikemhenry
Copy link
Contributor Author

That test passes fine on main but on this branch it fails ~10% of the time...

@mikemhenry
Copy link
Contributor Author

I yelled when I saw this: https://github.com/choderalab/openmmtools/blob/main/openmmtools/multistate/utils.py#L178-L183

I could not figure out how an import fixed things, well it "solved" the problem that this bare except hid.

BUT what is crazier is that we don't get a failure every time, but will essentially calculate a subsample rate larger than than our input array, which causes our equilibrated indices to be indices=[0] which sometimes passes our tests if we are lucky...

Anyway, bare excepts were a bad idea. I can't belive the amount of time I spent on this.

@mikemhenry
Copy link
Contributor Author

I will be cleaning up those exceptions in this PR as well....

@ijpulidos
Copy link
Contributor

Oh yeah, of course bare excepts are biting us, good catch! Thanks.

@mikemhenry
Copy link
Contributor Author

On windows-latest, py-3.8.10, OpenMM-8.0, pymbar-4

======================================================================
ERROR: Test expected number of entries in real time analysis output yaml file.
----------------------------------------------------------------------
Traceback (most recent call last):
  File "C:\Users\runneradmin\micromamba-root\envs\openmmtools-test\lib\site-packages\nose\case.py", line 197, in runTest
    self.test(*self.arg)
  File "D:\a\openmmtools\openmmtools\openmmtools\tests\test_sampling.py", line 1577, in test_real_time_analysis_yaml
    sampler.run()
  File "D:\a\openmmtools\openmmtools\openmmtools\multistate\multistatesampler.py", line 791, in run
    self._update_timing(iteration_time, partial_total_time, run_initial_iteration, iteration_limit)
  File "D:\a\openmmtools\openmmtools\openmmtools\multistate\multistatesampler.py", line 1773, in _update_timing
    self._timing_data["ns_per_day"] = iteration_simulated_nanoseconds / (
ZeroDivisionError: float division by zero

and on windows-latest, py-3.10, OpenMM-8.0, pymbar-3

======================================================================
ERROR: Test that creating a MultiState by storage string and reporter is the same
----------------------------------------------------------------------
Traceback (most recent call last):
  File "C:\Users\runneradmin\micromamba-root\envs\openmmtools-test\lib\site-packages\nose\case.py", line 197, in runTest
    self.test(*self.arg)
  File "D:\a\openmmtools\openmmtools\openmmtools\tests\test_sampling.py", line 1436, in test_storage_reporter_and_string
    sampler.run()
  File "D:\a\openmmtools\openmmtools\openmmtools\multistate\multistatesampler.py", line 791, in run
    self._update_timing(iteration_time, partial_total_time, run_initial_iteration, iteration_limit)
  File "D:\a\openmmtools\openmmtools\openmmtools\multistate\multistatesampler.py", line 1773, in _update_timing
    self._timing_data["ns_per_day"] = iteration_simulated_nanoseconds / (
ZeroDivisionError: float division by zero

All the other windows builds are fine, but we probably do want to catch that error so it doesn't crash a simulation if it happens. That can be done in another PR.

@mikemhenry
Copy link
Contributor Author

Okay! Since everything is passing except those two errors, I am now going to switch up the CI matrix so that we are testing mostly with pymbar 4, but will keep a few jobs at pymbar 3 to make sure we maintain support for both.

@mikemhenry
Copy link
Contributor Author

Once we finalize the matrix, I will mark them as required

Copy link
Contributor

@ijpulidos ijpulidos left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is looking great. Just a few comments I think we need to adress.

openmmtools/multistate/multistatesampler.py Show resolved Hide resolved
Comment on lines +183 to +184
print("If you see this, open an issue https://github.com/choderalab/openmmtools/issues")
raise e
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Do we want to raise the exception here? I feel like this might be disruptive for current users/applications.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

See #659 (comment) I think we can see if perses has any problems as well as other downstream packages as a double check. I worry it does more damage leaving it in the codebase. I could be convinced to just log an error but I think no one will see it.

Copy link
Contributor

@ijpulidos ijpulidos left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks great, thanks! I tested with perses locally in a tyk2 benchmark system and it seems to be working (using pymbar3). LGTM!

openmmtools/multistate/multistatesampler.py Show resolved Hide resolved
@ijpulidos ijpulidos added this to the 0.22.0 milestone Mar 17, 2023
@mikemhenry mikemhenry merged commit aaa4719 into main Mar 17, 2023
@mikemhenry mikemhenry deleted the pymbar-3-4 branch March 17, 2023 02:30
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants