Estimation of stress on structure

Hello,
I am trying to compute mechanical properties of a graphene sheet centered in a cubic simulation box. What I am doing is changing the box size in one direction (say x), running energy minimization, and then npt equilibration. What I want to get is the stress in the direction x. How to compute the stress? Should I consider pressure change in the x direction using gmx energy and divide by the cross-sectional area of the box perpendicular to the x-direction?
Looking forward to any assistance,
Thank you.

I don’t understand what you mean by pressure change. The stress would simply be the pressure (maybe minus the ambient pressure) in a dimension, potentially divided by the box aera or height, depending on what units you want. If you run NPT, any stress will disappear. You need to run at constant volume or box length.