# Calculating interaction energy

**URL:** <https://gromacs.bioexcel.eu/t/calculating-interaction-energy/5860>\
**Category:** User discussions\
**Created:** [February 23, 2023, 7:19pm UTC](https://gromacs.bioexcel.eu/t/calculating-interaction-energy/5860 "2023-02-23T19:19:32Z")\
**Posts on this page:** 6\
**Page:** 1

<div class="post-metadata">

**Author:** ![peter.mawanga](https://avatars.discourse-cdn.com/v4/letter/p/ccd318/32.png) [@peter.mawanga](https://gromacs.bioexcel.eu/u/peter.mawanga)\
**Post date:** [February 23, 2023, 7:19pm UTC](https://gromacs.bioexcel.eu/t/calculating-interaction-energy/5860/1 "2023-02-23T19:19:32Z")

</div>

GROMACS version: 2019.6  
GROMACS modification: No

Hey everyone,

Is it possible to calculate interaction energy between two groups without running the simulations again? I went through the previous posts and noted that in the discussion, it was mentioned that the groups were defined at the beginning of the simulation.

It would be very convenient to provide two index groups, as applicable for many other commands, such as one that calculates distance (`gmx distance`) for example. Also, please let me know the GROMACS commands that are useful for this purpose.

Thank you very much.

---

<div class="post-metadata">

**Author:** ![jalemkul](https://dub1.discourse-cdn.com/flex017/user_avatar/gromacs.bioexcel.eu/jalemkul/32/18_2.png) [@jalemkul](https://gromacs.bioexcel.eu/u/jalemkul)\
**Post date:** [February 23, 2023, 7:31pm UTC](https://gromacs.bioexcel.eu/t/calculating-interaction-energy/5860/2 "2023-02-23T19:31:23Z")

</div>

Computing interaction energy can (and should) be done just like analysis, after the simulation is done. In fact, GPU runs don’t even support `energygrps` so they have to be calculated after the fact. Generate a new `.tpr` file with the groups defined, and use `mdrun -rerun` (on CPU) on the existing trajectory file and the new `.tpr`. The calculation will be done in a few minutes and you’ll have the interaction energy.

---

<div class="post-metadata">

**Author:** ![peter.mawanga](https://avatars.discourse-cdn.com/v4/letter/p/ccd318/32.png) [@peter.mawanga](https://gromacs.bioexcel.eu/u/peter.mawanga)\
**Post date:** [February 25, 2023, 3:10am UTC](https://gromacs.bioexcel.eu/t/calculating-interaction-energy/5860/3 "2023-02-25T03:10:29Z")

</div>

Thank you very much for your reply. I was able to generate the energy file (`.edr`) using these steps.

However, I still have a minor query regarding the `gmx enemat` command. More specifically, I am not sure how to use the `-groups` flag even after going through the [webpage](https://manual.gromacs.org/2021/onlinehelp/gmx-enemat.html).

As far as I could comprehend, the first number denotes the number of groups, and then the two groups are mentioned in the example `-groups` file.

> 2  
> Protein  
> SOL

Suppose my system consists of a receptor RCP and different ligands denoted as L1, L2, L3, etc., and I want to analyze the interaction between RCP and the different ligands pairwise. Then would I have to create multiple files like:

> 2  
> RCP  
> L1/L2/L3/etc.

for each of the ligands, or is there an alternative way to proceed with this? Please let me know as feasible.

---

<div class="post-metadata">

**Author:** ![jalemkul](https://dub1.discourse-cdn.com/flex017/user_avatar/gromacs.bioexcel.eu/jalemkul/32/18_2.png) [@jalemkul](https://gromacs.bioexcel.eu/u/jalemkul)\
**Post date:** [February 25, 2023, 6:53pm UTC](https://gromacs.bioexcel.eu/t/calculating-interaction-energy/5860/4 "2023-02-25T18:53:02Z")

</div>

`gmx enemat` produces a cute visualization, which I don’t think is terribly useful. All the energy terms are in the `.edr` file and are easily extracted with `gmx energy` like any other energy term. From this you can plot the data and do actual statistical analysis.

---

<div class="post-metadata">

**Author:** ![peter.mawanga](https://avatars.discourse-cdn.com/v4/letter/p/ccd318/32.png) [@peter.mawanga](https://gromacs.bioexcel.eu/u/peter.mawanga)\
**Post date:** [March 6, 2023, 5:51pm UTC](https://gromacs.bioexcel.eu/t/calculating-interaction-energy/5860/5 "2023-03-06T17:51:14Z")

</div>

Thank you very much for the reply. I was able to extract the desired energies using the recommended command.

I still have a question regarding the `gmx energy` command. I tried calculating the free energy with the `-fee` flag and also set the `-fetemp` parameter accordingly, but there was no new data generated by the command. Moreover, I could not observe any additional options when the command was executed.

If there is something that might be missing, please let me know. Thanks a lot again.

---

<div class="post-metadata">

**Author:** ![jalemkul](https://dub1.discourse-cdn.com/flex017/user_avatar/gromacs.bioexcel.eu/jalemkul/32/18_2.png) [@jalemkul](https://gromacs.bioexcel.eu/u/jalemkul)\
**Post date:** [March 6, 2023, 7:06pm UTC](https://gromacs.bioexcel.eu/t/calculating-interaction-energy/5860/6 "2023-03-06T19:06:34Z")

</div>

The `-fee` option does not give you any property related to interaction energies (like a binding free energy). AFAIK this is designed for thermodynamic properties of pure liquids. I could be wrong. But it’s not going to give you any kind of sensible property for a protein-ligand complex in water.
