Skip to content

Commit

Permalink
use Version to compare versions
Browse files Browse the repository at this point in the history
  • Loading branch information
mikemhenry committed Sep 25, 2024
1 parent 060d5c1 commit 39b683b
Showing 1 changed file with 7 additions and 0 deletions.
7 changes: 7 additions & 0 deletions openmmtools/multistate/multistateanalyzer.py
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@
import copy
import inspect
import logging
from packaging.version import Version
import re
from typing import Optional, NamedTuple, Union

Expand All @@ -37,6 +38,7 @@
import simtk.unit as units
from scipy.special import logsumexp

from openmmtools.multistate import pymbar
from openmmtools import multistate, utils, forces
from openmmtools.multistate.pymbar import (
statistical_inefficiency_multiple,
Expand Down Expand Up @@ -567,6 +569,11 @@ def __init__(self, reporter, name=None, reference_states=(0, -1),
self.reference_states = reference_states
self._user_extra_analysis_kwargs = analysis_kwargs # Store the user-specified (higher priority) keywords

# If we are using pymbar 4, change the default behavior to use the robust solver protocol if the user
# didn't set a kwarg to control the solver protocol
if Version(pymbar.version.short_version) >= Version("4") and "solver_protocol" not in self._user_extra_analysis_kwargs:
self._user_extra_analysis_kwargs["solver_protocol"] = "robust"

# Initialize cached values that are read or derived from the Reporter.
self._cache = {} # This cache should be always set with _update_cache().
self.clear()
Expand Down

0 comments on commit 39b683b

Please sign in to comment.