From d8850fdf5b021a399967cbaf8deebc9a6f3fc70b Mon Sep 17 00:00:00 2001 From: jac16 Date: Wed, 13 Nov 2024 10:28:28 -0500 Subject: [PATCH] Update entropy attribute name from delta_s to delta_sT --- src/alchemlyb/estimators/base.py | 17 +++++++++-------- src/alchemlyb/estimators/mbar_.py | 12 ++++++------ src/alchemlyb/postprocessors/units.py | 6 +++--- src/alchemlyb/tests/test_fep_estimators.py | 4 ++-- 4 files changed, 20 insertions(+), 19 deletions(-) diff --git a/src/alchemlyb/estimators/base.py b/src/alchemlyb/estimators/base.py index 1044f937..230ff782 100644 --- a/src/alchemlyb/estimators/base.py +++ b/src/alchemlyb/estimators/base.py @@ -1,14 +1,15 @@ class _EstimatorMixOut: - """This class creates view for the d_delta_f_, delta_f_, states_ for the - estimator class to consume.""" + """This class creates view for the attributes: states_, delta_f_, d_delta_f_, + delta_h_, d_delta_h_, delta_sT_, d_delta_sT_ for the estimator class to consume. + """ _d_delta_f_ = None _delta_f_ = None _states_ = None _d_delta_h_ = None _delta_h_ = None - _d_delta_s_ = None - _delta_s_ = None + _d_delta_sT_ = None + _delta_sT_ = None @property def d_delta_f_(self): @@ -27,12 +28,12 @@ def delta_h_(self): return self._delta_h_ @property - def d_delta_s_(self): - return self._d_delta_s_ + def d_delta_sT_(self): + return self._d_delta_sT_ @property - def delta_s_(self): - return self._delta_s_ + def delta_sT_(self): + return self._delta_sT_ @property def states_(self): diff --git a/src/alchemlyb/estimators/mbar_.py b/src/alchemlyb/estimators/mbar_.py index 5b964057..78989cc2 100644 --- a/src/alchemlyb/estimators/mbar_.py +++ b/src/alchemlyb/estimators/mbar_.py @@ -64,10 +64,10 @@ class MBAR(BaseEstimator, _EstimatorMixOut): The estimated statistical uncertainty (one standard deviation) in dimensionless enthalpy differences. - delta_s_ : DataFrame, optional + delta_sT_ : DataFrame, optional The estimated dimensionless entropy difference between each state. - d_delta_s_ : DataFrame + d_delta_sT_ : DataFrame The estimated statistical uncertainty (one standard deviation) in dimensionless entropy differences. @@ -218,10 +218,10 @@ def fit(self, u_nk, compute_entropy_enthalpy=False): self._d_delta_h_ = pd.DataFrame( out["dDelta_u"], columns=self._states_, index=self._states_ ) - self._delta_s_ = pd.DataFrame( + self._delta_sT_ = pd.DataFrame( out["Delta_s"], columns=self._states_, index=self._states_ ) - self._d_delta_s_ = pd.DataFrame( + self._d_delta_sT_ = pd.DataFrame( out["dDelta_s"], columns=self._states_, index=self._states_ ) @@ -230,8 +230,8 @@ def fit(self, u_nk, compute_entropy_enthalpy=False): if compute_entropy_enthalpy: self._delta_h_.attrs = u_nk.attrs self._d_delta_h_.attrs = u_nk.attrs - self._delta_s_.attrs = u_nk.attrs - self._d_delta_s_.attrs = u_nk.attrs + self._delta_sT_.attrs = u_nk.attrs + self._d_delta_sT_.attrs = u_nk.attrs return self diff --git a/src/alchemlyb/postprocessors/units.py b/src/alchemlyb/postprocessors/units.py index 9b547055..7e1bde51 100644 --- a/src/alchemlyb/postprocessors/units.py +++ b/src/alchemlyb/postprocessors/units.py @@ -18,7 +18,7 @@ def to_kT(df, T=None): Note that if entropy values are passed it is assumed that they are multiplied by the temperature, S * T. - + If temperature `T` is not provided, the DataFrame need to have attribute `temperature` and `energy_unit`. Otherwise, the temperature of the output dateframe will be set accordingly. @@ -68,7 +68,7 @@ def to_kcalmol(df, T=None): Note that if entropy values are passed, the result is S * T in units of kcal/mol. - + If temperature `T` is not provided, the DataFrame need to have attribute `temperature` and `energy_unit`. Otherwise, the temperature of the output dateframe will be set accordingly. @@ -96,7 +96,7 @@ def to_kJmol(df, T=None): Note that if entropy values are passed, the result is S * T in units of kJ/mol. - + If temperature `T` is not provided, the DataFrame need to have attribute `temperature` and `energy_unit`. Otherwise, the temperature of the output dateframe will be set accordingly. diff --git a/src/alchemlyb/tests/test_fep_estimators.py b/src/alchemlyb/tests/test_fep_estimators.py index 490fdb24..73249590 100644 --- a/src/alchemlyb/tests/test_fep_estimators.py +++ b/src/alchemlyb/tests/test_fep_estimators.py @@ -209,7 +209,7 @@ def test_enthalpy_entropy_mbar(gmx_benzene_Coulomb_u_nk): assert mbar.delta_h_.iloc[0, :].to_numpy() == pytest.approx( np.array([0.0, 1.241970, 1.695000, 1.706555, 1.388906]), abs=1e-6 ) - assert mbar.delta_s_.iloc[0, :].to_numpy() == pytest.approx( + assert mbar.delta_sT_.iloc[0, :].to_numpy() == pytest.approx( np.array([0.0, -0.377099, -0.862990, -1.279746, -1.652250]), abs=1e-6 ) assert mbar.d_delta_f_.iloc[0, :].to_numpy() == pytest.approx( @@ -218,7 +218,7 @@ def test_enthalpy_entropy_mbar(gmx_benzene_Coulomb_u_nk): assert mbar.d_delta_h_.iloc[0, :].to_numpy() == pytest.approx( np.array([0.0, 0.011598, 0.016538, 0.018077, 0.018940]), abs=1e-6 ) - assert mbar.d_delta_s_.iloc[0, :].to_numpy() == pytest.approx( + assert mbar.d_delta_sT_.iloc[0, :].to_numpy() == pytest.approx( np.array([0.0, 0.012242, 0.019519, 0.023606, 0.026107]), abs=1e-6 )