Volume of a group + Distance between atoms

Hello dear all,
First of all I’m gonna say I’m really glad for being a member of this group which its members care about each other.
So thank you.
I need to specify the volume of a group of atoms in a cube before and after minimization.
Basically I need to calculate the length of the cube. So with volume I was intended to use volume of cube in order to get the length.
But after I searched the mailing list I saw it’s impossible to compute the volume of a group of atoms.
So far the only way occurs to me is that I marked 2 atoms at the edges of cube then I track them to see how much is their distance after minimization.
So please tell me how I can mark 2 atoms and have their distance.

If you know the IDs of the 2 atoms that are at corners of your "cube",
then you can define a variable formula (equal-style) to calculate
the distance between them and print it out. See the variable
doc page for details.


Thank you Steve

I could find their IDs by dump command.
I read the variable command deeper, I found
the variable formula (equal-style) x[atom ID] y[atom ID] z[atom ID],
so having the coordinates of atoms we can calculate their distance.
But newer problem is that my program will run in a loop.
So the corners atoms situation and IDs are changing in each loop.
I can define two groups containing only the two atoms I want their distance.
Is there any way to extract the IDs of the corner atoms which are the only members of the defined group systematically?