alchemlyb.postprocessors
Tools are available for postprocessing the dataframes.
For all of the input and output dataframes (such as u_nk
, dHdl
, Estimator.delta_f_
, Estimator.d_delta_f_
), the metadata
<metadata>
is stored as pandas.DataFrame.attrs
. The unit of the data can be converted to kT, kJ/mol or kcal/mol via the functions ~alchemlyb.postprocessors.units.to_kT
, ~alchemlyb.postprocessors.units.to_kJmol
, ~alchemlyb.postprocessors.units.to_kcalmol
.
alchemlyb.postprocessors
units
The postprocessing functions can make use of the following auxiliary functions, which in turn may use constants defined alchemlyb.postprocessors.units
.
Common scientific constants based on scipy.constants
and are provided for use across alchemlyb.
alchemlyb.postprocessors.units
kJ2kcal
R_kJmol
The function alchemlyb.postprocessors.units.get_unit_converter
provides the relevant converter for unit conversion via a built-in dispatch table:
>>> from alchemlyb.postprocessors.units import get_unit_converter
>>> get_unit_converter('kT')
<function to_kT>
>>> get_unit_converter('kJ/mol')
<function to_kJmol>
>>> get_unit_converter('kcal/mol')
<function to_kcalmol>
For unit conversion to work, the dataframes must maintain the energy_unit and temperature metadata in pandas.DataFrame.attrs
as described under note-on-units
.
When implementing code then ensure that the metadata are maintained
<metadata>
by using alchemlyb.concat
in place of pandas.concat
and use the alchemlyb.pass_attrs
decorator to copy metadata from an input dataframe to an output dataframe.