How to calculate the work done by pressure

Hello everyone. I have used fix npt in my simulation, and I want to calculate the work done by pressure during this process. As shown by the thermo_style, I have got pxx, pyy, pzz, press and volume changes in the simulation.
However, I am confused about how to calculate the work done by pressure. Can I simply multiply the press value by the volume changes? Furthermore, how can I determine whether the pressure is doing positive or negative work to the system? And what’s the means of positive and negative signs of pressure?
For example, In state 1, the pressure and volume are P1 and V1. In state 2, the pressure and volume is P2 and V2. How can I determine the magnitude and sign of the pressure work done from state 1 to state 2? Based on the positive and negative values of P1 and P2, as well as the magnitude of V1 and V2?

These are all questions that you should discuss with your adviser or tutor. They are really a matter of understanding the science and not a matter of understanding what LAMMPS does. Thus this question is off-topic here and I will thus close this topic.