Specify length of a group of atoms

I have 3 groups that first and third groups are 4 rows of first and last atoms in cnt and second ones is middle atoms. By variable “lz” the length of whole cnt (including all groups) is specified but I only want to know the length variations of middle atoms, which is a second group of atoms in cnt.

Thanks.

I have 3 groups that first and third groups are 4 rows of first and last
atoms in cnt and second ones is middle atoms. By variable "lz" the length of
whole cnt (including all groups) is specified but I only want to know the
length variations of middle atoms, which is a second group of atoms in cnt.

how about you compute the center of mass for each group and then
compute the distance between those through an equal style variable?

axel.

There isn’t any other way?
Because the said length " the distance between two center of mass of each groups" can’t calculate the exact length and there will be a little error.

There isn't any other way?
Because the said length " the distance between two center of mass of each
groups" can't calculate the exact length and there will be a little error.

well, what *is* the exact length of an object on the atomic scale?
i contend that it is an ill defined entity altogether, since you don't
know the size of an atom.

in any case, if you have a better way to determine the sizes that you
are looking for, you first have to explain it better, or just
implement it yourself. it is probably easiest to do this in post
processing.

axel.