How to average the bond/local values in each chunk?

Dear LAMMPS developers and users,

I’ve known that LAMMPS has two commands: fix ave/chunk for averaging per-atom values of each chunk, and compute reduce for averaging both per-atom and local values to scalars. The question is that is there a command or combination of commands, by which I can reduce (average) the local values, e.g., those obtained by compute bond/local, to scalars in each chunk? If not, do I have to extend the source code?

P.S. To carry out the average, a bond/local value is said to belong to a chunk only if both atoms of the bond belong to the chunk. That is to say, if atom A belongs to chunk 1 and atom B belongs to chunk 2, then the bond connecting atom A & B does not belong to either chunk 1 and chunk 2.

Any advice or comments will be appreciated!

There is no way to do this without C++ programming.
But I also am not convinced that your algorithm will produce meaningful results.

Now I have a tube, whose atoms are connected by bonds like this:

The tube will deform in the simulation. And I want to quantify the deformation of each ring. The only way I can come up with is to sum/average the lengths of bonds in each ring and compare them with the initial states. So I plan to first divide the atoms in N chunks, and average the bond lengths inside each chunk.

You can also have a deformation without a change in the bond length but rather have some angles change.

That’s true. For simplification, the angle change is ignored when I quantify the deformation, and I create no angle in my simulation.

But that is just pointing back to what I was writing in the beginning: I don’t believe that your deformation parameter has much of a meaning. For two reasons, 1. you are ignoring anything that straddles the subdivision boundaries (which means that this can change significantly, if the object is moving, but the subdivisions are not) and 2. you are only capturing one aspect of possible deformations, i.e. your object may deform, but your parameter does not show it.

That said, this is now far beyond the scope of this forum and discussing the science and not LAMMPS. My suggestion is to first find a suitable (per-atom !!) parameter that expresses the possible deformations well (which would probably require a detailed search of the published literature since I cannot believe that you are the first person attempting to do this kind of analysis) and then probably implement it as a new per-atom compute in LAMMPS. See for example compute hexorder/atom as an example for a per-atom structural parameter computation.

Thank you. You pointed out a very important thing I dismissed. I will reconsider this issue carefully!