Skip to content

Commit

Permalink
Store convergence data in simulation runner objects
Browse files Browse the repository at this point in the history
  • Loading branch information
fjclark committed Nov 24, 2023
1 parent 4681ef7 commit 54cc528
Showing 1 changed file with 8 additions and 2 deletions.
10 changes: 8 additions & 2 deletions EnsEquil/run/_simulation_runner.py
Original file line number Diff line number Diff line change
Expand Up @@ -128,9 +128,11 @@ def __init__(
for attribute, value in self.runtime_attributes.items():
setattr(self, attribute, value)

# Create attributes to store the free energy
# Create attributes to store the free energy and convergence data
self._delta_g: _Union[None, _np.ndarray] = None
self._delta_g_er: _Union[None, _np.ndarray] = None
self._delta_g_convergence: _Union[None, _np.ndarray] = None
self._delta_g_convergence_fracts: _Union[None, _np.ndarray] = None

# Register the ensemble size
self.ensemble_size = ensemble_size
Expand Down Expand Up @@ -328,7 +330,7 @@ def analyse(
plot_rmsds: bool = False,
) -> _Tuple[_np.ndarray, _np.ndarray]:
f"""
Analyse the {self.__class__.__name__} and any
Analyse the simulation runner and any
sub-simulations, and return the overall free energy
change.
Expand Down Expand Up @@ -585,6 +587,10 @@ def analyse_convergence(
self._logger.info(f"Overall free energy changes: {dg_overall} kcal mol-1")
self._logger.info(f"Fractions of (equilibrated) simulation time: {fracts}")

# Save the convergence information as an attribute
self._delta_g_convergence = dg_overall
self._delta_g_convergence_fracts = fracts

# Plot the overall convergence and the squared SEM of the free energy change
for plot in [_plot_convergence, _plot_sq_sem_convergence]:
plot(
Expand Down

0 comments on commit 54cc528

Please sign in to comment.