How to obtain the height change and damage depth of the system during the simulation of radiation damage?

Hello LAMMPS users!
I am simulating the collision of different particles on polyimide and hope to get damage results. Now I have a problem that I don’t know how to obtain the maximum height change of the system and the change of damage depth.I have the following ideas, but I don’t know if they are correct.
1、Is there a way to get the maximum height of a certain type of atom?This can indirectly tell the height change of the system.However, the collision process may cause some atoms to be lost and escape from the system.
2、Convert the output file of lammps into Materials Studio and calculate the height manually.This method is very laborious.

Please let me know if you have any better methods. I hope to get methods and useful codes please.

Please have a look at the compute reduce command. It operates on a group, so you need to first define a suitable group containing all relevant atoms, i.e. with the specific type you are interested in.