Gromacs parsing

Parsers for extracting alchemical data from Gromacs output files.

The parsers featured in this module are constructed to properly parse XVG files containing Hamiltonian differences (for obtaining reduced potentials, \(u_{nk}\)) and/or Hamiltonian derivatives (for obtaining gradients, \(\frac{dH}{d\lambda}\)). To produce such a file from an existing EDR energy file, use gmx energy -f <.edr> -odh dhdl.xvg with your installation of Gromacs.

If you wish to use FEP-based estimators such as MBAR that require reduced potentials for all lambda states in the alchemical leg, you will need to use these MDP options:

calc-lambda-neighbors = -1     ; calculate Delta H values for all other lambda windows
dhdl-print-energy = potential  ; total potential energy of system included

In addition, the full set of lambda states for the alchemical leg should be explicitly specified in the fep-lambdas option (or coul-lambdas, vdw-lambdas, etc.), since this is what Gromacs uses to determine what lambda values to calculate \(\Delta H\) values for.

To use TI-based estimators that require gradients, you will need to include these options:

dhdl-derivatives = yes         ; write derivatives of Hamiltonian with respect to lambda

Additionally, the parsers can properly parse XVG files (containing Hamiltonian differences and/or Hamiltonian derivatives) produced during expanded ensemble simulations. To produce such a file during the simulation, use gmx mdrun -deffnm <name> -dhdl dhdl.xvg with your installation of Gromacs. To run an expanded ensemble simulation you will need to use the following MDP option:

free_energy = expanded        ; turns on expanded ensemble simulation, lambda state becomes a dynamic variable

API Reference

This submodule includes these parsing functions:

alchemlyb.parsing.gmx.extract_dHdl(xvg, T)

Return gradients dH/dl from a Hamiltonian differences XVG file.

Parameters
  • xvg (str) – Path to XVG file to extract data from.

  • T (float) – Temperature in Kelvin the simulations sampled.

Returns

dH/dl – dH/dl as a function of time for this lambda window.

Return type

Series

alchemlyb.parsing.gmx.extract_u_nk(xvg, T)

Return reduced potentials u_nk from a Hamiltonian differences XVG file.

Parameters
  • xvg (str) – Path to XVG file to extract data from.

  • T (float) – Temperature in Kelvin the simulations sampled.

Returns

u_nk – Potential energy for each alchemical state (k) for each frame (n).

Return type

DataFrame