Skip to content

Commit

Permalink
Update entropy attribute name from delta_s to delta_sT
Browse files Browse the repository at this point in the history
  • Loading branch information
jaclark5 committed Nov 13, 2024
1 parent f312b6d commit d8850fd
Show file tree
Hide file tree
Showing 4 changed files with 20 additions and 19 deletions.
17 changes: 9 additions & 8 deletions src/alchemlyb/estimators/base.py
Original file line number Diff line number Diff line change
@@ -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):
Expand All @@ -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):
Expand Down
12 changes: 6 additions & 6 deletions src/alchemlyb/estimators/mbar_.py
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand Down Expand Up @@ -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_
)

Expand All @@ -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

Expand Down
6 changes: 3 additions & 3 deletions src/alchemlyb/postprocessors/units.py
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand Down Expand Up @@ -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.
Expand Down Expand Up @@ -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.
Expand Down
4 changes: 2 additions & 2 deletions src/alchemlyb/tests/test_fep_estimators.py
Original file line number Diff line number Diff line change
Expand Up @@ -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(
Expand All @@ -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
)

Expand Down

0 comments on commit d8850fd

Please sign in to comment.