Plot the Forward and Backward Convergence

The function plot_convergence() allows the user to visualise the convergence by plotting the free energy change computed using the equilibrated snapshots between the proper target time frames in both forward (data points are stored in forward and forward_error) and reverse (data points are stored in backward and backward_error) directions. The unit in the y axis could be labelled to other units by setting units, which by default is \(kT\). The user can pass matplotlib.axes.Axes into the function to have the convergence drawn on a specific axes.

Please check How to plot convergence for usage.

API Reference

alchemlyb.visualisation.plot_convergence(forward, forward_error, backward, backward_error, units='kT', ax=None)

Plot the forward and backward convergence.

Parameters
  • forward (List) – A list of free energy estimate from the first X% of data.

  • forward_error (List) – A list of error from the first X% of data.

  • backward (List) – A list of free energy estimate from the last X% of data.

  • backward_error (List) – A list of error from the last X% of data.

  • units (str) – The label for the unit of the estimate. Default: “kT”

  • ax (matplotlib.axes.Axes) – Matplotlib axes object where the plot will be drawn on. If ax=None, a new axes will be generated.

Returns

An axes with the forward and backward convergence drawn.

Return type

matplotlib.axes.Axes

Note

The code is taken and modified from Alchemical Analysis.

The units variable is for labelling only. Changing it doesn’t change the unit of the underlying variable, which is in the unit of \(kT\).

New in version 0.4.0.