Skip to content

Latest commit

 

History

History
73 lines (49 loc) · 2.18 KB

postprocessing.rst

File metadata and controls

73 lines (49 loc) · 2.18 KB

alchemlyb.postprocessors

Tools for postprocessing

Tools are available for postprocessing the dataframes.

Unit Conversion

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.

Unit Conversion Functions

alchemlyb.postprocessors

units

Constants and auxiliary functions

The postprocessing functions can make use of the following auxiliary functions, which in turn may use constants defined alchemlyb.postprocessors.units.

Scientific constants

Common scientific constants based on scipy.constants and are provided for use across alchemlyb.

alchemlyb.postprocessors.units

kJ2kcal

R_kJmol

Unit conversion developer information

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.