Skip to content

NVT context created during minimization leads to GPU memory issues in the ABFE protocol. #817

Open

Description

@hannahbaumann

As pointed out by @ijpulidos here (

# TODO the NVT Context created above for barostat-free minimization is left in
# energy_context_cache indefinitely (capacity=None means it's never evicted) even
# though nothing else reuses it after this point. Consider explicitly removing it
# from the cache here.
) we're not removing the NVT context after minimization:

This leads to GPU memory issues as reported here:
OpenFreeEnergy/openfe#2222. This was seen in the ABFE protocol where we have many lambda windows, so this would create many context caches.

Instead of removing the caches, I was wondering whether it would make sense to instead preserve the original thermodynamic-state type during minimization, and setting the pressure/barostat to None (as we originally did here https://github.com/choderalab/openmmtools/pull/773/changes). To make that work for the MonteCarloMembraneBarostat, we could then change the pressure setter to always set the surface tension to None when the pressure is set to None, since the membrane surface tension cannot exist without a barostat. I was not thinking about this when I implemented the temporary removal of the barostat here. I'm working on drafting a PR for this to look at for more discussion on how we would want to fix this!

Activity

  1. hannahbaumann commented on Oct 9, 2026

    @hannahbaumann
    ContributorAuthor

    As @jthorton pointed out, the LocalEnergyMinimizer is not a CustomIntegrator and does not take any steps, so we shouldn't need to remove the barostat. I tried this out here #818 and added to the test to check for the box vectors, and with the LocalEnergyMinimizer, the box vectors don't change, even when the barostat is present. This test failed when using the FireMinimizer.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions