Creating index file according to nr in topology

GROMACS version: 5.1.1
GROMACS modification: No
My pdb file has 2 carbon nanotubes and I want to measure VDW energy between two atoms of individual nanotubes. I cannot create individual energy groups according to their resnr (the 3rd column in atom section in topology file) as both of the tubes has similar residue number sequence. I am quite new to gromacs. Is there any way to make energy groups using make_ndx command according to their ‘nr’ (the 1st column in atom section in topology file) instead of ‘resnr’?

You can easily create index groups by selecting atom numbers, but if you’re just looking at the interaction between two atoms you can either (1) write the index groups by hand or (2) simply compute the distance between the atoms and apply the Lennard-Jones equation for any frames within the short-range cutoff.

I am a bit confused. Let’s say I want to measure energy between residue 30 of both nanotube. 30 are their resnr. But their nr are 40 and 620 respectively. How would I choose them individually in make_ndx if I want to follow your first suggestion?

The global residue number is what matters. You can select them easily via make_ndx.