Is there a way to find the stress for many n volumes efficiently than writing out compute stress/atom n times?

I would like to partition a channel into n slices and find the stress in each of these volumetric slices. Problem is I would like to have about 20 of these slices. Is there a way I can do this efficiently than writing it out 20 times?

You can use the “chunk” infrastructure in LAMMPS. 8.3.2. Use chunks to calculate system properties — LAMMPS documentation