# [gmx-users] Some simple questions about using -rerun in mdrun for energy between two groups

Justin Lemkul jalemkul at vt.edu
Mon Apr 18 18:38:08 CEST 2016

```
On 4/18/16 1:19 PM, Sheng Bi wrote:
> Dear GMX Users
> I have some questions when using -rerun in mdrun to get some specific energy for my groups. Let me describe my question in this way.
> I have a system containing some groups which include A and B and others. My goal is to calculate the energy between A and B.
> So Here is my steps:
> first, I use gmx trjconv to get trajectory contains only A and B called A_B.xtc.
> Second, I grompp a new tpr which is also only contain group A and B called A_B.tpr.
> Third, I use mdrun -rerun A_B.xtc -s A_B.tpr -v -deffnm energy_A_B
> Last, I use gmx energy -f energy_A_B.edr and choose "Total Energy" to get total energy of A_B system.
> My question is, by this way, I can get the total energy (name it E_total), but in my opinion this energy is composed of the energy
>
> between A and A (name it E_A_A), energy between B and B (name it E_B_B), and energy between A and B (name it E_A_B). I only care
>
> about E_A_B. By now, I have to repeat above four steps to get E_A_A, and E_B_B, then use E_total minus E_A_A and E_B_B to get E_A_B.
>
> This is a very tedious work.
> I am not quite familiar with -rerun, Is there any ingenious method to get E_A_B ? I am not quite familiar with -rerun?

Just set:

energygrps = A B

and create a new .tpr, which is used for the rerun.

-Justin

--
==================================================

Justin A. Lemkul, Ph.D.
Ruth L. Kirschstein NRSA Postdoctoral Fellow

Department of Pharmaceutical Sciences
School of Pharmacy
Health Sciences Facility II, Room 629
University of Maryland, Baltimore
20 Penn St.
Baltimore, MD 21201

jalemkul at outerbanks.umaryland.edu | (410) 706-7441
http://mackerell.umaryland.edu/~jalemkul

==================================================
```