top of page

How to Calculate the Free Energy of Methane in Water Using Gromacs with Cloud HPC

A step-by-step tutorial about using Gromacs to calculate the free energy on a cloud-based HPC platform with an example of methane in water.


This tutorial will guide the user to calculate a simple free energy change: the decoupling of van der Waals interactions between neutral methane and a box of water. The calculation uses the 2021-fosscuda-2019b version of GROMACS. In this tutorial, we will only focus on using GROMACS on Cloudam and calculate the specific practical steps of free energy, in order to reproduce the results of the free energy calculation for a very simple system.

Unlike the thermodynamic integration methods used in some other tutorials, this tutorial uses the gmx bar module of GROMACS to analyze the data, which was introduced in GROMACS version 4.5 (formerly known as g_bar). There are many practical applications for free energy calculations, some common ones include the solvation or hydration energy, and the binding free energy between a small molecule and some large acceptor biomolecule (usually a protein). Both of these processes involve add (introduction/coupling) or removal (decoupling/elimination) of the studied small molecule from the system and the calculation of the corresponding free energy change. In the free energy

calculations, two types of non-bonding interactions can be converted, Coulomb interactions and van der Waals interactions. GROMACS can also handle bond interactions, but for safety purposes, there will be not discussed.

In this tutorial, we will calculate the free energy of a quite simple process: turning off the Lennard-Jones interaction between the atomic sites of the molecule to be studied in water (refer to methane).

Step 1: Examine the topology file

1. Download the coordinate file of the system to be studied along with the topology file, and examine the topology file, where you will find the following points.

; Topology for methane in TIP3P
#include "oplsaa.ff/forcefield.itp"
[ moleculetype ]
; Name nrexcl
Methane 3
[ atoms ]
; nr type resnr residue atom cgnr charge mass typeB
chargeB massB
1 opls_138 1 ALAB CB 1 0.000 12.011
2 opls_140 1 ALAB HB1 2 0.000 1.008
3 opls_140 1 ALAB HB2 3 0.000 1.008
4 opls_140 1 ALAB HB3 4 0.000 1.008
5 opls_140 1 ALAB HB4 5 0.000 1.008
[ bonds ]
; ai aj funct c0 c1 c2 c3
1 2 1
1 3 1
1 4 1
1 5 1
[ angles ]
; ai aj ak funct c0 c1 c2 c3
2 1 3 1
2 1 4 1
2 1 5 1
3 1 4 1
3 1 5 1
4 1 5 1
; water topology
#include "oplsaa.ff/tip3p.itp"
[ system ]
; Name
Methane in water
[ molecules ]
; Compound #mols
Methane 1
SOL 596

It can be noticed that all of the charges are set to zero. There is a reason for this setting: normally before the van der Waals interactions are turned off, the interaction of charges between solute and water is turned off first. If only the interaction of charges is retained and the Lennard-Jones term is turned off, the distance between the positive and negative charges approaching each other may be infinitely small, leading to a quite unstable system and even collapse possibly.

2. After examining the topology files, upload the two files to Cloudam for backup: create the Methane folder in General Workspace, and upload the two files into that folder, and finally rename the files to methane_water.gro and