Surface tension calculation of gas-liquid

Excuse me, I’d like to calculate the surface tension of the gas-liquid interface.

Should I use the GMX energy command to get the pressure tensor in the X, y, and z directions and calculate it using the following formula?
Are there any gaps in the process? If that doesn’t work, what other way is there to calculate?Thank you.
@7W25YZ~NU70WDJT3GFN759